BalanceChangeController.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace hd\controllers;
  3. use Yii;
  4. class BalanceChangeController extends BaseController
  5. {
  6. public function actionList()
  7. {
  8. $get = Yii::$app->request->get();
  9. $export = $get['export'] ?? 0;
  10. $where = [];
  11. $where['mainId'] = $this->mainId;
  12. $searchTime = $get['searchTime'] ?? '';
  13. if (!empty($searchTime)) {
  14. $startTime = $get['startTime'] ?? '';
  15. $endTime = $get['endTime'] ?? '';
  16. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  17. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  18. } else {
  19. if ($export == 1) {
  20. util::fail('请选择时间');
  21. }
  22. }
  23. $customId = $get['customId'] ?? 0;
  24. if (!empty($customId)) {
  25. $custom = CustomClass::getById($customId);
  26. CustomClass::valid($custom, $this->shopId);
  27. $where['customId'] = $customId;
  28. }
  29. $respond = CustomBalanceChangeClass::getChangeList($where);
  30. util::success($respond);
  31. }
  32. }