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; } $teamGrades = TeamGrades::getUserTeamGrades($user->id); if (!empty($teamGrades['id'])) { $action->controller->teamGrades = $teamGrades; return true; } $teamGradesLevelList = TeamGradesLevel::getLevelList($store_id); if (empty($teamGradesLevelList)) { \Yii::$app->response->format = Response::FORMAT_JSON; \Yii::$app->response->data = [ 'code' => 1, 'msg' => '错误 系统未设置团队业绩分红等级' ]; return false; } $is_open_apply = $teamGradesLevelList[0]['is_open_apply']; if ($is_open_apply) { if (in_array($params_r, self::$allow_list)) { \Yii::$app->response->format = Response::FORMAT_JSON; \Yii::$app->response->data = [ 'code' => 0, 'msg' => '错误 需要申请成为团队业绩分红会员', 'data' => [ 'is_open_apply' => 1 ] ]; return false; } } \Yii::$app->response->format = Response::FORMAT_JSON; \Yii::$app->response->data = [ 'code' => 1, 'msg' => '错误 请先申请或升级成为团队业绩分红会员' ]; return false; } }