check_worker_auth(); } protected function check_worker_auth(){ //判断登录用户是否是员工 $user_id = 0; $user = $this->auth->getUser();//登录用户 if($user)$user_id = $user['id']; if(!$user_id)$this->error("请登录后再访问该接口!",['errcode'=>30002], 401); try{ $this->shop_id = ClassesLib::checkOptionAuth(0,$user_id,"user"); }catch (\Exception $e){ $this->error($e->getMessage(),['errcode'=>30003]); } $this->classes_lib_ids = (new ClassesLib)->getClassesAuthIds($user_id); $this->classes_activity_ids = (new Activity())->getActivityAuthIds($user_id); //如果没有任何可管理的classes_lib_id 则返回错误 if(!$this->classes_lib_ids && !$this->shop_id && !$this->classes_activity_ids)$this->error("您没有员工权限访问该接口!",['errcode'=>30003]); } }