| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace addons\Agent\backend\controllers;
- use addons\Agent\common\models\AgentApply;
- use common\enums\RabbitMqEnum;
- use Yii;
- class ApplyController extends BaseController{
- public $enableCsrfValidation = false;
-
- /**
- * Notes:列表
- * User: LD
- * Date: 2024/4/11
- * Time: 10:55
- */
- public function actionIndex(){
- if (\Yii::$app->request->isAjax) {
- if (\Yii::$app->request->isGet) {
- $params = \Yii::$app->request->get();
- $get['mall_id'] = $this->mall_id;
- $params['where'] = [['mall_id'=>$this->mall_id]];
- $params['with'] = ['user'];
- $params['order'] = 'id desc';
- $params['limit'] = 10;
- $pageData = AgentApply::listPage($params, false);
- if ($pageData === false) return $this->error(AgentApply::getStaticError());
- return $this->success('操作成功', $pageData);
- }
- }
- return $this->render('index', []);
- }
- /**
- * Notes:审核
- * User: LD
- * Date: 2024/4/11
- * Time: 14:04
- * @return mixed|void
- */
- public function actionCheck()
- {
- if (\Yii::$app->request->isAjax) {
- if (\Yii::$app->request->isPost) {
- $params = \Yii::$app->request->post();
- $res = Yii::$app->services->validate->validate($params, [
- [['id', 'check_status'], 'required'],
- [['check_remark'], 'safe'],
- ]);
- if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
- $params['mall_id'] = $this->mall_id;
- if ($params['check_status'] == AgentApply::CHECK_STATUS_FAIL && empty($params['check_remark'])) return $this->error('请填写审核不通过的原因');
- $res = AgentApply::setData($params);
- if ($res === false) return $this->error(AgentApply::getStaticError());
- if($params['check_status'] == AgentApply::CHECK_STATUS_SUCCESS){
- //推送队列进行升级
- \Yii::$app->services->rabbitMq->push(RabbitMqEnum::EXCHANGE_TASK, RabbitMqEnum::TASK_QUEUE, ['mall_id' => $this->mall_id, 'user_id' => $res->user_id], AgentApply::class, 'upgradeLevel');
- }
- return $this->success('操作成功');
- }
- }
- }
-
- }
|