Blame view

lib/common/request/dao/user_dao.dart 558 Bytes
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
  import '../apis.dart';
056970d8   Key   feat: api
5
6
7
  import '../request_client.dart';
  
  class UserDao {
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,
      );
94342c3f   Key   feat: user util
14
15
16
      if (data != null && data.token.isNotEmpty) {
        UserUtil.saveUser(data);
      }
05f9b20a   Key   fixed: api调用方式,未完善
17
      return data;
056970d8   Key   feat: api
18
    }
056970d8   Key   feat: api
19
  }