parent
9b1833e196
commit
0c4a6c8d9f
@ -0,0 +1,10 @@
|
|||||||
|
import 'package:recook/constants/api_v2.dart';
|
||||||
|
import 'package:recook/manager/http_manager.dart';
|
||||||
|
import 'package:recook/pages/user/model/user_balance_info_model.dart';
|
||||||
|
|
||||||
|
class UserBalanceFunc {
|
||||||
|
static Future<UserBalanceInfoModel> info() async {
|
||||||
|
ResultData result = await HttpManager.post(APIV2.userAPI.balanceInfo, {});
|
||||||
|
return UserBalanceInfoModel.fromJson(result.data);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
class UserBalanceInfoModel {
|
||||||
|
String code;
|
||||||
|
String msg;
|
||||||
|
Data data;
|
||||||
|
|
||||||
|
UserBalanceInfoModel({this.code, this.msg, this.data});
|
||||||
|
|
||||||
|
UserBalanceInfoModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
code = json['code'];
|
||||||
|
msg = json['msg'];
|
||||||
|
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
|
||||||
|
}
|
||||||
|
UserBalanceInfoModel.zero() {
|
||||||
|
code = '';
|
||||||
|
msg = '';
|
||||||
|
data = Data.zero();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['code'] = this.code;
|
||||||
|
data['msg'] = this.msg;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data.toJson();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
double balance;
|
||||||
|
double totalWithdraw;
|
||||||
|
|
||||||
|
Data({this.balance, this.totalWithdraw});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
balance = json['balance'] ?? 0 + .0;
|
||||||
|
totalWithdraw = json['totalWithdraw'] ?? .0 + .0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Data.zero() {
|
||||||
|
balance = 0;
|
||||||
|
totalWithdraw = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['balance'] = this.balance;
|
||||||
|
data['totalWithdraw'] = this.totalWithdraw;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue