request; if ($request->isAjax && $request->isGet) { try { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['user_id', 'page', 'limit'], 'integer'], [['keyword'], 'string'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $get['store_id'] = $this->store_id; $list = (new ClerkService(['mall_id' => $this->mall_id]))->getClerkMemberList($get); return $this->success('获取成功', $list); } catch (\Exception $e) { return $this->error($e->getMessage()); } } return $this->render($this->action->id); } public function actionSearchUser() { $request = Yii::$app->request; if ($request->isAjax && $request->isGet) { try { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['keyword'], 'string'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $list = (new ClerkService(['mall_id' => $this->mall_id]))->searchUser($get); return $this->success('获取成功', $list); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } //添加核销员 public function actionEdit() { $request = Yii::$app->request; if ($request->isAjax) { if ($request->isPost) { try { $post = $request->post(); $res = Yii::$app->services->validate->validate($post, [ [['id', 'user_id'], 'integer'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $post['store_id'] = $this->store_id; $res = (new ClerkService(['mall_id' => $this->mall_id]))->addClerk($post); return $this->success('操作成功'); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } } //删除核销员 public function actionDelete() { $request = Yii::$app->request; if ($request->isAjax && $request->isPost) { try { $post = $request->post(); $res = Yii::$app->services->validate->validate($post, [ [['id'], 'integer'] ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $res = (new ClerkService(['mall_id' => $this->mall_id]))->deleteClerk($post); return $this->success('操作成功'); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } //核销明细 public function actionClerkLog() { $request = Yii::$app->request; if ($request->isAjax) { if ($request->isGet) { try { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['page', 'limit'], 'integer'], [['clerk_id', 'user_id', 'order_no'], 'string'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $list = (new ClerkService(['mall_id' => $this->mall_id, 'store_id' => $this->store_id]))->storeClerkLog($get); return $this->success('获取成功', $list); } catch (\Exception $e) { $this->error($e->getMessage()); } } } return $this->render($this->action->id); } public function actionChangeClerkStatus() { $request = Yii::$app->request; if ($request->isAjax && $request->isPost) { try { $post = $request->post(); $res = Yii::$app->services->validate->validate($post, [ [['id', 'status'], 'integer'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $res = (new ClerkService(['mall_id' => $this->mall_id, 'store_id' => $this->store_id]))->changeClerkStatus($post); return $this->success('操作成功'); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } }