| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace addons\CloudStock\backend\controllers;
- use addons\CloudStock\common\services\AgentService;
- use common\enums\DownloadEnum;
- use common\helpers\csv\CsvExportHelper;
- use Yii;
- /**
- * 默认控制器
- *
- * Class DefaultController
- * @package addons\CloudStock\backend\controllers
- */
- class AgentController extends BaseController
- {
- public $enableCsrfValidation = false;
- public function actionDispenseOrderManagement()
- {
- // 查询参数
- if (Yii::$app->request->isAjax) {
- if (Yii::$app->request->isGet) {
- $params = Yii::$app->request->get();
- $params['mall_id'] = $this->mall_id;
- $list = (new AgentService(['mall_id' => $this->mall_id]))->dispenseOrderManagement($params);
- return $this->success('操作成功', $list);
- }
- if (\Yii::$app->request->post('flag') == 'EXPORT') {
- $data = \Yii::$app->request->post();
- $data['mall_id'] = $this->mall_id;
- $filename = "云库存-配货管理-" . date('YmdHis') . '_' . rand(10000, 99999);
- $res = CsvExportHelper::exportDownLoadCenter($this->mall_id, $filename, DownloadEnum::TYPE_CLOUD_STOCK, AgentService::class, 'exportData', $data);
- if ($res === false) return $this->error('加入导出任务失败' . CsvExportHelper::getStaticError());
- return $this->success('添加导出任务成功,任务完成后请在下载中心进行下载!');
- }
- }
- return $this->render($this->action->id);
- }
- public function actionGetDetail()
- {
- // 查询参数
- if (Yii::$app->request->isAjax) {
- if (Yii::$app->request->isGet) {
- $params = Yii::$app->request->get();
- $params['mall_id'] = $this->mall_id;
- $list = (new AgentService(['mall_id' => $this->mall_id]))->getDetail($params);
- return $this->success('操作成功', $list);
- }
- }
- }
- public function actionGetExportList()
- {
- $data = (new AgentService(['mall_id' => $this->mall_id]))->getExportFieldList();
- return $this->success('操作成功', $data);
- }
- }
|