param('open_id', ''); if (empty($openId)) { return $next($request); } // $openIdRes = CmbLifeUtils::decrypt($openId, config('cmb.merchant_sm2_pri_key')); // $openId = $openIdRes['open_id'] ?? ''; $request->open_id = $openId; $user = User::getUserByOpenId($openId); if ($user->isEmpty()) { throw new LogicException('用户不存在' . $openId); } $request->user_id = $user->id; // $res = CmbService::checkAccessToken($user); // if ($res['respCode'] == 1000) { // $request->user_id = $user->id; // } else { // return json(['code' => 403, 'message' => '登录超时,请重新登录!', 'data' => []], 401); // } return $next($request); } }