StatBookController.php 863 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\stat\classes\StatBookClass;
  4. use common\components\dateUtil;
  5. use Yii;
  6. use common\components\util;
  7. class StatBookController extends BaseController
  8. {
  9. //花材销量 ssh 20211021
  10. public function actionProfile()
  11. {
  12. $get = Yii::$app->request->get();
  13. $where = [];
  14. $where['mainId'] = $this->mainId;
  15. $searchTime = $get['searchTime'] ?? 'today';
  16. if (!empty($searchTime)) {
  17. $startTime = $get['startTime'] ?? '';
  18. $endTime = $get['endTime'] ?? '';
  19. $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
  20. $where['time'] = ['between', [$period['startTime'], $period['endTime']]];
  21. }
  22. $list = StatBookClass::getAllByCondition($where, 'time DESC', '*');
  23. util::success(['list' => $list]);
  24. }
  25. }