getUserInfo static method

Future<DataResult> getUserInfo(
  1. UserProvider userProvider
)

获取自己用户信息

Implementation

static Future<DataResult> getUserInfo(UserProvider userProvider) async {
  // DataResult vipRes = await OtherDao.getPlusVip();
  var res = await BaseDao.fromBaseEncrypt({}, Address.getUserInfo());
  if (res.result) {
    var entity = UserEntity.fromJson(res.data);
    Address.baseToken = entity.token ?? '';
    SpUtil.putString(AppConfig.appToken, entity.token!);
    UserEntity userEntityPro = await updateUserInfo(entity, update: true);
    // if (vipRes.result) {
    //   userEntityPro.isVip = vipRes.data.level;
    // }
    userProvider.setUserEntity(userEntityPro);
    return DataResult(entity, true);
  }
  return res;
}