request->isAjax) { if (\Yii::$app->request->isPost) { } else { $form = new StoreBossListForm(); $form->attributes = \Yii::$app->request->get(); $form->store_id = $this->store_id; return $this->asJson($form->getList()); } } return $this->render('/boss/index'); } /** * @Author: 广东七件事 * Date: 2021-08-10 * Time: 21:36 * @Note:修改备注 */ public function actionRemarksEdit() { if (\Yii::$app->request->isAjax) { if (\Yii::$app->request->isPost) { $params = \Yii::$app->request->post(); $boss = StoreBoss::findOne(['id' => $params['id'], 'status' => 1, 'store_id' => $this->store_id]); if (!$boss) { return $this->error('该门店股东不存在'); } $boss->remarks = $params['remarks']; if (!$boss->save()) { return $this->error('保存失败'); } return $this->success('保存成功'); } } } /** * @Author: 广东七件事 ganxiaohao * @Date: 2020-05-11 * @Time: 15:36 * @Note:查找用户 */ public function actionSearchUser() { if (\Yii::$app->request->isAjax) { $where = [ ['mall_id' => $this->mall_id], ['store_id' => $this->store_id], ['status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]], ]; $get = \Yii::$app->request->get(); $user_where = []; if (!empty($get['nickname_or_mobile'])) { $user_where[] = [ 'OR', ['like', 'mobile', $get['nickname_or_mobile'] . '%', false], ['like', 'nickname', $get['nickname_or_mobile'] . '%', false] ]; } if (!empty($get['level'])) { $user_where[] = ['level' => $get['level']]; } if (!empty($get['user_id'])) { $user_where[] = ['id' => $get['user_id']]; } if (!empty($user_where)) { $user_list = User::lists(['where' => $user_where, 'select' => 'id']); $user_id_arr = array_column($user_list, 'id'); $where[] = ['user_id' => $user_id_arr]; } $params = [ 'where' => $where, 'with' => ['user' => function ($query) { $query->select('id,avatar_url,nickname,username,mobile'); }], 'order' => 'id desc' ]; $list = StoreUser::listPage($params); $return = []; foreach ($list['list'] as $user) { $return['list'][] = $user['user']; } return $this->success('success', $return); } } /** * @Author: 广东七件事 ganxiaohao * @Date: 2020-05-11 * @Time: 15:45 * @Note: * @return string|\yii\web\Response */ public function actionEdit() { if (\Yii::$app->request->isAjax) { $form = new StoreBossUserEditForm(); $form->attributes = \Yii::$app->request->post(); $form->store_id = $this->store_id; return $this->asJson($form->save()); } else { return $this->render('/boss/edit'); } } /** * @Author: 广东七件事 ganxiaohao * @Date: 2020-05-11 * @Time: 16:56 * @Note:修改等级 * @return \yii\web\Response */ public function actionLevelChange() { if (\Yii::$app->request->isAjax) { $form = new StoreBossUserEditForm(); $form->attributes = \Yii::$app->request->post(); $form->store_id = $this->store_id; return $this->asJson($form->changeLevel()); } } /** * @Author: 广东七件事 ganxiaohao * @Date: 2020-05-11 * @Time: 16:56 * @Note:批量修改股东等级 * @return \yii\web\Response */ public function actionBatchLevel() { if (\Yii::$app->request->isAjax) { $form = new StoreBossUserEditForm(); $form->attributes = \Yii::$app->request->post(); $form->store_id = $this->store_id; return $this->asJson($form->batchLevel()); } } /** * @Author: 广东七件事 ganxiaohao * @Date: 2020-07-10 * @Time: 9:18 * @Note:股东设置 * @return string|\yii\web\Response */ public function actionSetting() { if (\Yii::$app->request->isAjax) { if (\Yii::$app->request->isPost) { $form = new StoreBossSettingForm(); $form->attributes = \Yii::$app->request->post(); return $this->asJson($form->setDate()); } else { $form = new StoreBossSettingForm(); return $this->asJson($form->search()); } } return $this->render('/boss/setting'); } /** * @Author: 广东七件事 ganxiaohao * @Date: 2020-07-10 * @Time: 9:19 * @Note:提成明细 */ public function actionIncomeList() { if (\Yii::$app->request->isAjax) { if (\Yii::$app->request->isPost) { $form = new StoreBossIncome(); $param = \Yii::$app->request->post(); $param['store_id'] = $this->store_id; $param['mall_id'] = $this->mall_id; return $this->asJson($form->getList($param)); } } return $this->render('/boss/income-list'); } /** * @Author: 广东七件事 zal * @Date: 2020-07-10 * @Time: 9:19 * @Note:结算列表 */ public function actionSettlementList() { $retuest = \Yii::$app->request; if ($retuest->isAjax) { if ($retuest->isPost) { // 检查提交的参数 $params = $retuest->post(); $form = new StoreBossIncome(); return $this->asJson($form->getSettlementList($params)); } } return $this->render('/boss/settlement-list'); } /** * @Author: 广东七件事 ganxiaohao * @Date: 2020-08-21 * @Time: 20:02 * @Note:经销商删除 */ public function actionDelete() { if (\Yii::$app->request->isAjax) { if (\Yii::$app->request->isPost) { $id = \Yii::$app->request->post('id'); $agent = StoreBoss::findOne(['id' => $id, 'status' => 1]); if (!$agent) { return $this->asJson(['code' => 1, 'msg' => '该股东不存在或者已被删除!']); } $agent->status = 0; if (!$agent->save()) { return $this->asJson(['code' => 1, 'msg' => '删除失败!', 'error' => $agent->getErrors()]); } return $this->asJson(['code' => 0, 'msg' => '删除成功!']); } } } }