| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace hd\controllers;
- use bizHd\goods\classes\KindClass;
- use bizHd\work\classes\WorkClass;
- use bizHd\work\classes\WorkItemClass;
- use common\components\dateUtil;
- use Yii;
- use common\components\util;
- class StatKindController extends BaseController
- {
- //各渠道收入 ssh 20220711
- public function actionProfile()
- {
- $get = Yii::$app->request->get();
- $searchTime = isset($get['searchTime']) && !empty($get['searchTime']) ? $get['searchTime'] : 'today';
- $startTime = $get['startTime'] ?? '';
- $endTime = $get['endTime'] ?? '';
- $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
- $start = $period['startTime'];
- $end = $period['endTime'];
- $currentStartDate = date('Y-m-d', strtotime($start));
- $currentEndDate = date('Y-m-d', strtotime($end));
- $currentStartTime = $currentStartDate . ' 00:00:00';
- $currentEndTime = $currentEndDate . ' 23:59:59';
- $mainId = $this->mainId;
- $kindList = KindClass::getAllByCondition(['mainId' => $mainId, 'flower' => 1, 'delStatus' => 0, 'status' => 1], null, '*', 'id');
- $arr = [];
- $where = ['mainId' => $mainId, 'status' => 1];
- $where['finishTime'] = ['between', [$currentStartTime, $currentEndTime]];
- $workList = WorkClass::getAllByCondition($where, null, '*', null, true);
- if (!empty($workList)) {
- foreach ($workList as $work) {
- $kindId = $work->kindId ?? 0;
- if (empty($kindId)) {
- continue;
- }
- $kindName = $kindList[$kindId]['name'] ?? '';
- $num = $work->num ?? 0;
- if (isset($arr[$kindId]['makeNum'])) {
- $arr[$kindId]['makeNum'] = bcadd($arr[$kindId]['makeNum'], $num);
- } else {
- $arr[$kindId]['makeNum'] = $num;
- $arr[$kindId]['name'] = $kindName;
- }
- }
- }
- //util::success(['list' => $incomeList, 'totalIncome' => $totalIncome]);
- }
- }
|