101 lines
3.0 KiB
Dart
101 lines
3.0 KiB
Dart
import 'package:pj_supermarket_cloud/common/index.dart';
|
|
|
|
abstract class WalletApi {
|
|
/// 优惠列表
|
|
static Future<List<DiscountsItem>?> getDiscountsListByUserId(
|
|
dynamic params,
|
|
) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/wallet-setting/ad/get-discounts-list",
|
|
queryParameters: params,
|
|
);
|
|
if (res.data == null) return null;
|
|
return (res.data as List).map((e) => DiscountsItem.fromJson(e)).toList();
|
|
}
|
|
|
|
/// 支付配置
|
|
static Future<ServicePaySetting?> getPaySetting() async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/wallet-setting/ad/get-setting",
|
|
);
|
|
if (res.data == null) return null;
|
|
return ServicePaySetting.fromJson(res.data);
|
|
}
|
|
|
|
/// 开卡列表
|
|
static Future<ServiceOpenCardPage?> openCardList(
|
|
dynamic pa,
|
|
) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/wallet-active/ad/open-card-list",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return ServiceOpenCardPage.fromJson(res.data);
|
|
}
|
|
|
|
/// 开卡成功
|
|
static Future<bool> openCardSuccess(dynamic pa) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/wallet-active/ad/open-card-success",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return false;
|
|
return true;
|
|
}
|
|
|
|
/// 重新激活
|
|
static Future<bool> refreshAvatar(dynamic pa) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/wallet-active/ad/refresh-avatar",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return false;
|
|
return true;
|
|
}
|
|
|
|
/// 根据短码查询加密信息
|
|
static Future<String?> getByShortCode(dynamic pa) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/wallet-code-use/ad/by-short-code",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return res.data;
|
|
}
|
|
|
|
/// 获取钱包规则(android离线计算展示使用)
|
|
static Future<List<ServiceMchRule>?> getMchRoleList(dynamic pa) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/mch-rule-join/ad/list",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return res.data
|
|
?.map<ServiceMchRule>((e) => ServiceMchRule.fromJson(e))
|
|
.toList();
|
|
}
|
|
|
|
/// 获取钱包规则(android离线计算展示使用)
|
|
static Future<List<ServiceWallet>?> getWalletList(dynamic pa) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/wallet-manage/ad/wallet/list",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return res.data
|
|
?.map<ServiceWallet>((e) => ServiceWallet.fromJson(e))
|
|
.toList();
|
|
}
|
|
|
|
/// 获取通用活动详情
|
|
static Future<ServiceComAct?> getComAct(dynamic pa) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/wallet/act/com/ad/get-act",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return ServiceComAct.fromJson(res.data);
|
|
}
|
|
}
|