request; if ($retuest->isAjax) { if ($retuest->isGet) { $get = Yii::$app->request->get(); // 检查提交的参数 $res = Yii::$app->services->validate->validate($get,[ [['user_id','sign_status','mobile'], 'integer'], [['start_at','end_at'], 'safe'], ]); if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage()); $where = $list = []; $where[] = ['=', 'mall_id', $this->mall_id]; !empty($get['user_id']) && $where[] = ['=', 'user_id', $get['user_id']]; !empty($get['mobile']) && $where[] = ['=', 'mobile', $get['mobile']]; !empty($get['sign_status']) && $where[] = ['=', 'sign_status', $get['sign_status']]; if (!empty($get['start_at']) && !empty($get['end_at'])) { $where[] = ['between', 'created_at', strtotime($get['start_at']), strtotime($get['end_at'])]; } $where[] = ['=', 'status', StatusEnum::ENABLED]; $with = ['user']; $order = 'created_at desc'; $params = array('where' => $where, 'order'=>$order, 'with' => $with, 'limit' => $get['limit']); $list = DianqianApply::listPage($params, false, true); $list['export_list'] = DianqianApply::fieldsList(); $this->success('获取成功', $list); } } else { return $this->render($this->action->id); } } /** * 状态修改 * @Author: lun * @DateTime: 2023/5/11 0011 19:05 * @Copyright: copyright (c) 2021 广东七件事集团 * @return mixed|void */ public function actionHandle() { $request = Yii::$app->request; if ($request->isAjax) { if ($request->isGet) { $params = Yii::$app->request->get(); // 检查提交的参数 $res = Yii::$app->services->validate->validate($params,[ [['id'], 'required'], [['id','sign_status','status'], 'integer'], [['reason','remark'], 'string'], ]); if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage()); $params = DianqianApply::exceptNullVal($params); $params['mall_id'] = $this->mall_id; $res = DianqianApply::setData($params); if (!$res) return $this->error('修改失败:msg=' . DianqianApply::getStaticError()); return $this->success('修改成功'); } } } /** * 导出 * @Author: lun * @DateTime: 2023/5/13 0013 14:11 * @Copyright: copyright (c) 2021 广东七件事集团 * @return mixed|void */ public function actionApplyExport() { $retuest = Yii::$app->request; if ($retuest->isPost && $retuest->post('flag') == 'EXPORT') { $post = Yii::$app->request->post(); $post['mall_id'] = $this->mall_id; $filename = '电子签约列表-' . date('YmdHis').'_'.rand(10000,99999); $res = CsvExportHelper::exportDownLoadCenter($this->mall_id, $filename,DownloadEnum::TYPE_STATISTICS,DianqianApply::class,'exportHandle', $post); if ($res === false) return $this->error('加入导出任务失败'.CsvExportHelper::getStaticError()); return $this->success('添加导出任务成功,任务完成后请在下载中心进行下载!'); } } }