response->format = Response::FORMAT_JSON; \Yii::$app->response->data = [ 'code' => 401, 'msg' => 'access_token 不能为空' ]; return false; } $saasUser = SaasUser::findIdentityByAccessToken($access_token); if (!$saasUser) { \Yii::$app->response->format = Response::FORMAT_JSON; \Yii::$app->response->data = [ 'code' => 401, 'msg' => '登录失败 获取不到用户信息' ]; return false; } $user = User::findOne(['store_id' => $store_id, 'binding' => $saasUser->mobile, 'is_delete' => 0]); if (!$user) { \Yii::$app->response->format = Response::FORMAT_JSON; \Yii::$app->response->data = [ 'code' => 401, 'msg' => '登录失败 获取不到商城用户信息' ]; return false; } if (!intval($user->is_cashier)) { \Yii::$app->response->format = Response::FORMAT_JSON; \Yii::$app->response->data = [ 'code' => 1, 'msg' => '当前用户不是收银台管理员' ]; return false; } $cashierUserExt = CashierUserExt::findOne(['user_id' => $user->id, 'is_delete' => 0]); if ($cashierUserExt) { $action->controller->md_id = intval($cashierUserExt->md_id); return true; } return true; } }