/// 登录请求模型 class LoginRequest { final String username; final String password; final String wechatJsCode; LoginRequest({ required this.username, required this.password, this.wechatJsCode = "", }); Map toJson() { return { 'username': username, 'password': password, 'wechatJsCode': wechatJsCode, }; } // 从 Map 创建 LoginRequest 对象 factory LoginRequest.fromJson(Map json) { return LoginRequest( username: json['username'] as String, password: json['password'] as String, wechatJsCode: json['wechatJsCode'] as String, ); } } /// 登录响应模型 class LoginResponse { final String token; final String refreshToken; final int expires; final String name; LoginResponse({ required this.token, required this.refreshToken, required this.expires, required this.name, }); factory LoginResponse.fromJson(Map json) { return LoginResponse( token: json['token'] ?? '', refreshToken: json['refresh_token'] ?? '', expires: json['expires'] ?? '', name: json['name'] ?? '', ); } }