StatBookController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. public function actionPrintOrder()
  26. {
  27. $get = Yii::$app->request->get();
  28. $where = [];
  29. $where['mainId'] = $this->mainId;
  30. $searchTime = $get['searchTime'] ?? 'today';
  31. if (!empty($searchTime)) {
  32. $startTime = $get['startTime'] ?? '';
  33. $endTime = $get['endTime'] ?? '';
  34. $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
  35. $where['time'] = ['between', [$period['startTime'], $period['endTime']]];
  36. }
  37. $list = StatBookClass::getAllByCondition($where, 'time DESC', '*');
  38. if (empty($list)) {
  39. util::fail('没有花材需要打印');
  40. }
  41. }
  42. }