getMobile(); $password = $data->getPassword(); Log::info('获取登录参数', [ 'mobile' => $mobile, 'has_password' => !empty($password) ]); if (empty($mobile)) { Log::error('手机号验证失败', ['error' => '手机号不能为空']); throw new \Exception('手机号不能为空'); } if (empty($password)) { Log::error('密码验证失败', ['error' => '密码不能为空']); throw new \Exception('密码不能为空'); } // 2. 使用Login4uHandler的公共静态方法处理URS登录逻辑 $loginResult = Login4uHandler::processUrsLoginByMobilePassword($mobile, $password); // 3. 创建响应对象 $response = new ResponsePublicLogin4urs(); $response->setToken($loginResult['sessionId']); // 设置用户状态(默认不封禁) $response->setIsProhibit(false); // 设置最后登录信息 $lastLoginInfo = new LastLoginInfo(); $lastLoginInfo->setLastLoginTimes(time()); $response->setLastLoginInfo($lastLoginInfo); Log::info('URS login4urs登录成功', [ 'mobile' => $mobile, 'urs_user_id' => $loginResult['ursUserId'], 'farm_user_id' => $loginResult['farmUserId'], 'session_id' => $loginResult['sessionId'] ]); return $response; } catch (\Exception $e) { Log::error('URS login4urs登录失败', [ 'mobile' => $mobile ?? '', 'has_password' => !empty($password), 'error' => $e->getMessage(), 'trace' => $e->getTraceAsString() ]); throw $e; } } }