getRechargeList method
审核模式-mode:true审核模式,false正式模式
Implementation
Future<void> getRechargeList(changed,
{String type = '0',
bool mode = true,
bool pop = true,
bool cache = true}) async {
if (mode) {
if (cache &&
rechargeModels.isNotEmpty &&
rechargeModels.values.first.isNotEmpty) {
changed?.call(CommonUtils.pageStatusSuccess);
return;
}
clearRechargeList();
showLoading = false;
changed?.call(CommonUtils.pageStatusLoading);
RechargeTypeList codeType = RechargeTypeList()
..type = Platform.isAndroid ? '2' : '1';
bool ok = await rechargeInList(type, codeType, pop: pop);
changed
?.call(rechargeModels.isEmpty || rechargeModels.values.first.isEmpty
? CommonUtils.pageStatusEmpty
: ok
? CommonUtils.pageStatusSuccess
: CommonUtils.pageStatusError);
} else {
showLoading = false;
changed?.call(CommonUtils.pageStatusLoading);
RechargeDao.rechargeSupport().then((res) async {
if (res.result) {
List<RechargeTypeList> list = res.data.rechargeModels;
if (list.isNotEmpty) {
clearRechargeList();
bool ok = false;
for (RechargeTypeList item in list) {
ok = await rechargeInList(type, item, pop: pop);
if (!ok) {
changed?.call(CommonUtils.pageStatusError);
return;
}
}
} else {
clearRechargeList();
}
}
changed?.call(
rechargeModels.isEmpty || rechargeModels.values.first.isEmpty
? CommonUtils.pageStatusEmpty
: CommonUtils.pageStatusSuccess);
});
}
}