request; if ($request->isAjax) { try { if ($request->isGet) { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['page', 'limit'], 'integer'], [['keyword', 'goods_keyword', 'tabname'], 'string'], [['date'], 'safe'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $get['store_id'] = $this->store_id; $list = (new StoreFinanceService(['mall_id' => $this->mall_id]))->getClientFinanceData($get); if ($get['tabname'] == 'order-detail') { $export_list = (new StoreFinanceService(['mall_id' => $this->mall_id]))->storeFinanceDetailFieldList(); } else if ($get['tabname'] == 'cashier') { $export_list = (new StoreFinanceService(['mall_id' => $this->mall_id]))->cashierFinanceDetailFieldList(); } $list['export_list'] = $export_list; return $this->success('获取成功', $list); } if ($request->isPost) { if (\Yii::$app->request->post('flag') == 'EXPORT') { $post = \Yii::$app->request->post(); $post['mall_id'] = $this->mall_id; $post['store_id'] = $this->store_id; $filename = 'o2o门店财务明细-' . date('YmdHis') . '_' . rand(10000, 99999); $func_model = 'exportStoreFinanceData'; if ($post['tabname'] == 'cashier') { $func_model = 'exportCashierFinanceData'; } $res = CsvExportHelper::exportDownLoadCenter($this->mall_id, $filename, DownloadEnum::TYPE_STORE_FINANCE, StoreFinanceService::class, $func_model, $post, 0, $this->store_id); if ($res === false) return $this->error('加入导出任务失败' . CsvExportHelper::getStaticError()); return $this->success('添加导出任务成功,任务完成后请在下载中心进行下载!'); } } } catch (\Exception $e) { return $this->error($e->getMessage()); } } return $this->render($this->action->id); } public function actionGetStoreStatics() { $request = Yii::$app->request; if ($request->isAjax && $request->isGet) { try { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['store_id'], 'integer'], [['date'], 'safe'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $get['store_id'] = $this->store_id; $info = (new StoreFinanceService(['mall_id' => $this->mall_id]))->getStoreStatics($get); return $this->success('获取成功', $info); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } }