94342c3f
Key
feat: user util
|
1
|
import 'package:wow_english/common/core/user_util.dart';
|
05f9b20a
Key
fixed: api调用方式,未完善
|
2
3
|
import 'package:wow_english/models/user_entity.dart';
|
056970d8
Key
feat: api
|
4
5
6
|
import '../request_client.dart';
class UserDao {
|
c95453ce
Key
feat: User界面完善
|
7
|
/// 登录
|
94342c3f
Key
feat: user util
|
8
|
static Future<UserEntity?> login(phoneNumber, type, checkKey, checkNumber) async {
|
05f9b20a
Key
fixed: api调用方式,未完善
|
9
|
var params = {'phoneNum': phoneNumber, 'type': type, checkKey: checkNumber};
|
94342c3f
Key
feat: user util
|
10
|
var data = await requestClient.post<UserEntity>(
|
05f9b20a
Key
fixed: api调用方式,未完善
|
11
12
13
|
Apis.login,
data: params,
);
|
aa4e28be
Key
removed: cache_bl...
|
14
|
if (data != null) {
|
94342c3f
Key
feat: user util
|
15
16
|
UserUtil.saveUser(data);
}
|
05f9b20a
Key
fixed: api调用方式,未完善
|
17
|
return data;
|
056970d8
Key
feat: api
|
18
|
}
|
39e06486
liangchengyou
feat:获取验证码逻辑处理
|
19
|
|
c95453ce
Key
feat: User界面完善
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/// 登出
static Future logout() async {
var result = await requestClient.post(Apis.logout);
print('logout result=$result');
UserUtil.logout();
return result;
}
/// 发送验证码
static Future sendCode(phoneNumber, {smsType = 'login'}) async {
final params = {'phoneNum': phoneNumber, 'smsType': smsType};
await requestClient.post(Apis.sendSmsCode, data: params);
}
|
4b2c2f07
Key
feat: 三种修改密码的类型及接口
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/// 设置密码,初始化密码
/// [password] 密码
static Future initPassword(String password) async {
final params = {'password': password};
await requestClient.post(Apis.initPassword, data: params);
}
/// 修改密码
/// [password] 密码
static Future changePassword(String password) async {
final params = {'password': password};
await requestClient.post(Apis.changePassword, data: params);
}
/// 忘记密码
/// [password] 密码
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);
}
|
c95453ce
Key
feat: User界面完善
|
55
56
57
58
59
60
61
62
|
/// 获取用户信息
static Future<UserEntity?> getUserInfo() async {
return await requestClient.post(Apis.getUserInfo);
}
/// 更新用户信息,返回即成功,无body
static Future updateUserInfo(UserEntity userEntity) async {
return await requestClient.put(Apis.setUserInfo, data: userEntity.toUpdateJson());
|
39e06486
liangchengyou
feat:获取验证码逻辑处理
|
63
|
}
|
056970d8
Key
feat: api
|
64
|
}
|