ShopYeChangeController.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\shop\classes\ShopYeChangeClass;
  4. use common\components\dict;
  5. use common\components\util;
  6. use common\components\dateUtil;
  7. use Yii;
  8. class ShopYeChangeController extends BaseController
  9. {
  10. public $guestAccess = [];
  11. public function actionList()
  12. {
  13. $get = Yii::$app->request->get();
  14. $status = $get['status'] ?? 0;
  15. $export = $get['export']??0;
  16. $where = [];
  17. $where['mainId'] = $this->mainId;
  18. if (!empty($status)) {
  19. $where['status'] = $status;
  20. }
  21. $tx = $get['tx'] ?? 0;
  22. if (!empty($tx)) {
  23. $where['tx'] = $tx;
  24. }
  25. $searchTime = isset($get['searchTime']) && !empty($get['searchTime']) ? $get['searchTime'] : '';
  26. $startTime = $get['startTime'] ?? '';
  27. $endTime = $get['endTime'] ?? '';
  28. if (!empty($searchTime)) {
  29. $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
  30. $start = date("Y-m-d 00:00:00", strtotime($period['startTime']));
  31. $end = date("Y-m-d 23:59:59", strtotime($period['endTime']));
  32. $where['addTime'] = ['between', [$start, $end]];
  33. }
  34. $list = ShopYeChangeClass::getChangeList($where);
  35. if ($export == 1) {
  36. ShopYeChangeClass::exportData($list, $this->mainId);
  37. }
  38. util::success($list);
  39. }
  40. }