| 94342c3f  Key
 
feat: user util | 1 |   import 'package:wow_english/common/core/user_util.dart';
 | 
| 05f9b20a  Key
 
fixed: api调用方式,未完善 | 2 |   import 'package:wow_english/models/user_entity.dart';
 | 
| e6a4e63c  Key
 
fixed: 修改个人信息性别 | 3 |   import 'package:wow_english/utils/log_util.dart';
 | 
| 05f9b20a  Key
 
fixed: api调用方式,未完善 | 4 |   
 | 
| 056970d8  Key
 
feat: api | 5
6 |   import '../request_client.dart';
  
 | 
| da82bd70  Key
 
feat: user_inform... | 7
8 |   enum SmsType { login, change_passWord, stdDestroy }
  
 | 
| 056970d8  Key
 
feat: api | 9 |   class UserDao {
 | 
| c95453ce  Key
 
feat: User界面完善 | 10 |     /// 登录
 | 
| 94342c3f  Key
 
feat: user util | 11 |     static Future<UserEntity?> login(phoneNumber, type, checkKey, checkNumber) async {
 | 
| 05f9b20a  Key
 
fixed: api调用方式,未完善 | 12 |       var params = {'phoneNum': phoneNumber, 'type': type, checkKey: checkNumber};
 | 
| 94342c3f  Key
 
feat: user util | 13 |       var data = await requestClient.post<UserEntity>(
 | 
| 05f9b20a  Key
 
fixed: api调用方式,未完善 | 14
15
16 |         Apis.login,
        data: params,
      );
 | 
| aa4e28be  Key
 
removed: cache_bl... | 17 |       if (data != null) {
 | 
| 94342c3f  Key
 
feat: user util | 18
19 |         UserUtil.saveUser(data);
      }
 | 
| 05f9b20a  Key
 
fixed: api调用方式,未完善 | 20 |       return data;
 | 
| 056970d8  Key
 
feat: api | 21 |     }
 | 
| 39e06486  liangchengyou
 
feat:获取验证码逻辑处理 | 22 |   
 | 
| c95453ce  Key
 
feat: User界面完善 | 23
24
25
26
27
28
29
30
31 |     /// 登出
    static Future logout() async {
      var result = await requestClient.post(Apis.logout);
      print('logout result=$result');
      UserUtil.logout();
      return result;
    }
  
    /// 发送验证码
 | 
| da82bd70  Key
 
feat: user_inform... | 32 |     /// [msgType] 消息类型 登录:login, 更改密码:change_passWord, 账号注销:stdDestroy
 | 
| c95453ce  Key
 
feat: User界面完善 | 33
34
35
36
37 |     static Future sendCode(phoneNumber, {smsType = 'login'}) async {
      final params = {'phoneNum': phoneNumber, 'smsType': smsType};
      await requestClient.post(Apis.sendSmsCode, data: params);
    }
  
 | 
| 4b2c2f07  Key
 
feat: 三种修改密码的类型及接口 | 38
39
40
41
42
43
44
45 |     /// 设置密码,初始化密码
    /// [password] 密码
    static Future initPassword(String password) async {
      final params = {'password': password};
      await requestClient.post(Apis.initPassword, data: params);
    }
  
    /// 修改密码
 | 
| da82bd70  Key
 
feat: user_inform... | 46 |     /// [phoneNum] 手机号
 | 
| 4b2c2f07  Key
 
feat: 三种修改密码的类型及接口 | 47 |     /// [password] 密码
 | 
| da82bd70  Key
 
feat: user_inform... | 48
49
50 |     /// [smsCode] 短信验证码
    static Future changePassword(String phoneNum, String password, String smsCode) async {
      final params = {'phoneNum': phoneNum, 'password': password, 'code': smsCode};
 | 
| 4b2c2f07  Key
 
feat: 三种修改密码的类型及接口 | 51
52
53
54 |       await requestClient.post(Apis.changePassword, data: params);
    }
  
    /// 忘记密码
 | 
| da82bd70  Key
 
feat: user_inform... | 55 |     /// [phoneNum] 手机号
 | 
| 4b2c2f07  Key
 
feat: 三种修改密码的类型及接口 | 56 |     /// [password] 密码
 | 
| da82bd70  Key
 
feat: user_inform... | 57 |     /// [smsCode] 短信验证码
 | 
| 4b2c2f07  Key
 
feat: 三种修改密码的类型及接口 | 58
59
60
61
62 |     static Future resetPassword(String phoneNum, String password, String smsCode) async {
      final params = {'phoneNum': phoneNum, 'password': password, 'code': smsCode};
      await requestClient.post(Apis.resetPassword, data: params);
    }
  
 | 
| da82bd70  Key
 
feat: user_inform... | 63
64
65
66
67
68
69 |     /// 验证短信验证码
    /// [msgType] 消息类型 登录:login, 更改密码:change_passWord, 账号注销:stdDestroy
    static Future checkSmsCode(String phoneNum, String smsCode, String msgType) async {
      final params = {'phoneNum': phoneNum, 'code': smsCode, 'msgType': msgType};
      await requestClient.post(Apis.checkSmsCode, data: params);
    }
  
 | 
| c95453ce  Key
 
feat: User界面完善 | 70
71
72
73
74
75
76 |     /// 获取用户信息
    static Future<UserEntity?> getUserInfo() async {
      return await requestClient.post(Apis.getUserInfo);
    }
  
    /// 更新用户信息,返回即成功,无body
    static Future updateUserInfo(UserEntity userEntity) async {
 | 
| e6a4e63c  Key
 
fixed: 修改个人信息性别 | 77 |       Log.d('updateUserInfo, userEntity: $userEntity');
 | 
| c95453ce  Key
 
feat: User界面完善 | 78 |       return await requestClient.put(Apis.setUserInfo, data: userEntity.toUpdateJson());
 | 
| 39e06486  liangchengyou
 
feat:获取验证码逻辑处理 | 79 |     }
 | 
| e6a4e63c  Key
 
fixed: 修改个人信息性别 | 80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 |   
    static Future updateUserInfoField({name, age, gender, avatarUrl}) async {
      final Map<String, dynamic> data = <String, dynamic>{};
      if (name != null) {
        data['name'] = name;
      }
      if (age != null) {
        data['age'] = age;
      }
      if (gender != null) {
        data['gender'] = gender;
      }
      if (avatarUrl != null) {
        data['avatarUrl'] = avatarUrl;
      }
      return await requestClient.put(Apis.setUserInfo, data: data);
    }
 | 
| 056970d8  Key
 
feat: api | 97 |   }
 |