StatYjController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\stat\classes\StatYjClass;
  4. use common\components\dateUtil;
  5. use Yii;
  6. use common\components\util;
  7. class StatYjController extends BaseController
  8. {
  9. //员工业绩 ssh 20221115
  10. public function actionProfile()
  11. {
  12. ini_set('memory_limit', '2045M');
  13. set_time_limit(0);
  14. $mainId = $this->mainId;
  15. $respond = StatYjClass::profile($mainId);
  16. $income = $respond['income'] ?? 0;
  17. $expend = $respond['expend'] ?? 0;
  18. $balance = $respond['balance'] ?? 0;
  19. util::success(['income' => $income, 'expend' => $expend, 'balance' => floatval($balance)]);
  20. }
  21. //员工业绩 ssh 2021.3.15
  22. public function actionList()
  23. {
  24. $get = Yii::$app->request->get();
  25. $where = [];
  26. $where['mainId'] = $this->mainId;
  27. $searchTime = $get['searchTime'] ?? 'today';
  28. if (!empty($searchTime)) {
  29. $startTime = $get['startTime'] ?? '';
  30. $endTime = $get['endTime'] ?? '';
  31. $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
  32. $where['time'] = ['between', [$period['startTime'], $period['endTime']]];
  33. }
  34. $respond = StatYjClass::getYjList($where);
  35. util::success($respond);
  36. }
  37. }