request->get(); $query = xhMerchantCapital::find(); $query->where(['merchantId' => $this->merchantId, 'io' => 1]); if (isset($get['payWay']) && $get['payWay'] != -1) { $query->andWhere(['payWay' => $get['payWay']]); } if (isset($get['date']) && !empty($get['date'])) { $arrDate = explode(' - ', $get['date']); $startTime = strtotime($arrDate[0]); $endTime = strtotime($arrDate[1]); $query->andWhere(['>=', 'addTime', $startTime]); $query->andWhere(['<', 'addTime', $endTime]); } $countQuery = clone $query; //总计 $totalAmount = $countQuery->sum('amount'); $totalCount = $countQuery->count(); $pages = new Pagination(['totalCount' => $totalCount, 'pageSize' => 50]); $models = $query->offset($pages->offset)->limit($pages->limit)->orderBy('addTime desc')->all(); $payWay = configDict::getConfig('payWayName'); $capitalTypeList = configDict::getConfig('capitalTypeList'); return $this->render('list', ['models' => $models, 'pages' => $pages, 'payWay' => $payWay, 'capitalTypeList' => $capitalTypeList, 'totalAmount' => $totalAmount]); } /** * 收入统计 shish 2019.9.21 */ public function actionIndex() { $date = dateUtil::getTime(1); $start = $date[0]; $end = $date[1]; /**变化趋势**/ $latestIncome = StatIncomeService::getLatestIncome($start, $end); $latestIncomeDate = array_column($latestIncome, 'time'); $latestIncomeAmount = array_column($latestIncome, 'amount'); /** 来源 **/ $source = StatIncomeSourceService::getLatestSource($start, $end); /** 分类 **/ $category = StatIncomeCategoryService::getLatestIncome($start, $end); /** 用途 **/ $usage = StatIncomeUsageService::getLatestIncome($start, $end); return $this->render('index', [ 'latestIncomeDate' => json_encode($latestIncomeDate), 'latestIncomeAmount' => json_encode($latestIncomeAmount), 'source' => $source, 'category' => $category, 'usage' => $usage, ]); } public function actionPer() { return $this->render('per'); } public function actionCustomer() { return $this->render('customer'); } public function actionIncome() { $where = ['merchantId' => $this->merchantId]; $return = StatIncomeService::getBackendList('*', $where, 'addTime desc'); $pages = $return['pages']; $list = $return['list']; $list = []; return $this->render('income', ['list' => $list, 'pages' => $pages, 'list' => $list]); } //对帐 shish 2019.9.8 public function actionCheckUp() { $this->errorExportJson(); $id = Yii::$app->request->get('id'); StatIncomeService::checkUp($id); util::ok(); } }