初始化
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/// 积分记录
|
||||
class CreditRecordModel {
|
||||
String? desc;
|
||||
num? integral;
|
||||
String? createdAt;
|
||||
|
||||
CreditRecordModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
desc = json['desc'];
|
||||
integral = json['integral'];
|
||||
createdAt = json['createdAt'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/// 单条账单
|
||||
class BillItemModel {
|
||||
final String? createdAt;
|
||||
final String? desc;
|
||||
final String? tranType;
|
||||
final int? tranTypeInt;
|
||||
|
||||
final int? actualAmount; //实际变动金币
|
||||
final int? actualIntegral; //实际变动积分
|
||||
final int? integral;
|
||||
|
||||
BillItemModel({
|
||||
this.createdAt,
|
||||
this.desc,
|
||||
this.tranType,
|
||||
this.tranTypeInt,
|
||||
this.actualAmount,
|
||||
this.actualIntegral,
|
||||
this.integral,
|
||||
});
|
||||
|
||||
/// 数量单位:有积分变动记积分,特定交易类型记次数,其余记金币
|
||||
String get unit {
|
||||
if ((integral ?? 0) != 0) return '积分';
|
||||
if (const {103, 104, 109, 110, 111}.contains(tranTypeInt)) return '次';
|
||||
return '金币';
|
||||
}
|
||||
|
||||
/// 展示用数量:金币和积分只会变动其中一种,同时变动时不展示
|
||||
int get realCount {
|
||||
if (actualAmount == 0) return actualIntegral ?? 0;
|
||||
if (actualIntegral == 0) return actualAmount ?? 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
factory BillItemModel.fromJson(Map<String, dynamic> json) => BillItemModel(
|
||||
createdAt: json["createdAt"],
|
||||
desc: json["desc"],
|
||||
tranType: json["tranType"],
|
||||
tranTypeInt: json["tranTypeInt"],
|
||||
actualAmount: json["actualAmount"],
|
||||
actualIntegral: json["actualIntegral"],
|
||||
integral: json["integral"],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/// 代充商人
|
||||
class PayForModel {
|
||||
int? imId; //商人在聊天系统中的ID
|
||||
String? userId; //商人在代充系统中的ID
|
||||
String? avatar; //头像
|
||||
String? nickName; //昵称
|
||||
String? welcomeMsg; //商人欢迎语
|
||||
List<PayInfoModel>? payInfos; //支持的支付方式
|
||||
|
||||
PayForModel();
|
||||
|
||||
PayForModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
imId = json['imId'];
|
||||
userId = json['userId'];
|
||||
avatar = json['avatar'];
|
||||
nickName = json['nickName'];
|
||||
welcomeMsg = json['welcomeMsg'];
|
||||
payInfos = (json['payInfos'] as List?)?.map((e) => PayInfoModel.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"imId": imId,
|
||||
"userId": userId,
|
||||
"avatar": avatar,
|
||||
"welcomeMsg": welcomeMsg,
|
||||
"nickName": nickName,
|
||||
"payInfos": payInfos,
|
||||
};
|
||||
|
||||
PayForModel clone() => PayForModel()
|
||||
..imId = imId
|
||||
..userId = userId
|
||||
..avatar = avatar
|
||||
..nickName = nickName
|
||||
..welcomeMsg = welcomeMsg
|
||||
..payInfos = payInfos?.map((e) => e.clone()).toList() ?? [];
|
||||
}
|
||||
|
||||
/// 一种支付方式
|
||||
class PayInfoModel {
|
||||
int? payMethod;
|
||||
List<int>? payType;
|
||||
|
||||
PayInfoModel();
|
||||
|
||||
PayInfoModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
payMethod = json['payMethod'];
|
||||
payType = (json['payType'] as List?)?.cast<int>().toList() ?? [];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"payMethod": payMethod,
|
||||
"payType": payType,
|
||||
};
|
||||
|
||||
PayInfoModel clone() => PayInfoModel()
|
||||
..payMethod = payMethod
|
||||
..payType = [...?payType];
|
||||
}
|
||||
|
||||
/// 代充配置,整体 base64 后透传给代充 H5
|
||||
class DCModel {
|
||||
bool? isReconnect;
|
||||
|
||||
/// 商人列表 为空则不展示代充
|
||||
List<PayForModel>? traders;
|
||||
String? url;
|
||||
String? ordUrl;
|
||||
String? traderUrl;
|
||||
|
||||
int? chargeMoney;
|
||||
|
||||
///大额支付 小额支付
|
||||
int? limit;
|
||||
String? userAgent;
|
||||
|
||||
String? wsUrl;
|
||||
|
||||
String? picUrl;
|
||||
|
||||
/// 商品id,客户端添加,非后端返回,代充值给h5的时候使用
|
||||
String? productInfo;
|
||||
|
||||
DcUserInfo? userInfo;
|
||||
|
||||
/// 支付渠道,客户端下单时赋值,非后端返回
|
||||
String? channel;
|
||||
|
||||
DCModel();
|
||||
|
||||
DCModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
isReconnect = json['isReconnect'];
|
||||
//只取第一个商人,后续逻辑都按 traders[0] 走
|
||||
final trader = (json['traders'] as List?)?.firstOrNull;
|
||||
if (trader != null) traders = [PayForModel.fromJson(trader)];
|
||||
url = json['url'];
|
||||
wsUrl = json['wsUrl'];
|
||||
picUrl = json['picUrl'];
|
||||
ordUrl = json['ordUrl'];
|
||||
traderUrl = json['traderUrl'];
|
||||
userInfo = DcUserInfo.fromJson(json['userInfo']);
|
||||
chargeMoney = json['chargeMoney'];
|
||||
limit = json['limit'];
|
||||
userAgent = json['userAgent'];
|
||||
productInfo = json['productInfo'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"isReconnect": isReconnect,
|
||||
"traders": traders,
|
||||
"url": url,
|
||||
"ordUrl": ordUrl,
|
||||
"traderUrl": traderUrl,
|
||||
"userInfo": userInfo,
|
||||
"chargeMoney": chargeMoney,
|
||||
"limit": limit,
|
||||
"wsUrl": wsUrl,
|
||||
"picUrl": picUrl,
|
||||
"userAgent": userAgent,
|
||||
"productInfo": productInfo,
|
||||
"channel": channel,
|
||||
};
|
||||
|
||||
DCModel clone() => DCModel()
|
||||
..isReconnect = isReconnect
|
||||
..traders = traders?.map((e) => e.clone()).toList() ?? []
|
||||
..url = url
|
||||
..ordUrl = ordUrl
|
||||
..traderUrl = traderUrl
|
||||
..userInfo = userInfo?.clone()
|
||||
..chargeMoney = chargeMoney
|
||||
..limit = limit
|
||||
..userAgent = userAgent
|
||||
..wsUrl = wsUrl
|
||||
..picUrl = picUrl
|
||||
..productInfo = productInfo
|
||||
..channel = channel;
|
||||
}
|
||||
|
||||
/// 代充里透传给 H5 的用户信息
|
||||
class DcUserInfo {
|
||||
int? uid;
|
||||
String? gender;
|
||||
String? name;
|
||||
String? portrait;
|
||||
|
||||
DcUserInfo();
|
||||
|
||||
DcUserInfo.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
uid = json['uid'];
|
||||
if (json['gender'] is String) gender = json['gender'];
|
||||
name = json['name'];
|
||||
portrait = json['portrait'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"uid": uid,
|
||||
"gender": gender,
|
||||
"name": name,
|
||||
"portrait": portrait,
|
||||
};
|
||||
|
||||
DcUserInfo clone() => DcUserInfo()
|
||||
..uid = uid
|
||||
..gender = gender
|
||||
..name = name
|
||||
..portrait = portrait;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:hgdj/hj_model/mine/exchange/recharge_type_list_model.dart';
|
||||
|
||||
import 'dc_model.dart';
|
||||
|
||||
/// 可供充值的金币列表
|
||||
class RechargeListModel {
|
||||
DCModel? daichong;
|
||||
List<RechargeTypeModel>? list;
|
||||
|
||||
RechargeListModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
daichong = DCModel.fromJson(json['daichong']);
|
||||
//代充数据挂在上级,逐条塞给档位,档位内部才能拼出代充支付方式
|
||||
list = (json['list'] as List?)
|
||||
?.map((e) => RechargeTypeModel.fromJson(e)..daichong = daichong)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import '../../../hj_page/mine/mine_vip/vip_support_model.dart';
|
||||
import 'dc_model.dart';
|
||||
|
||||
/// 代充的 payMethod → (type, 展示名)
|
||||
const _dcPayTypes = {
|
||||
101: ('alipy', '支付寶(人工充值)'),
|
||||
102: ('wechat', '微信(人工充值)'),
|
||||
103: ('union', '银联(人工充值)'),
|
||||
104: ('credit', '信用卡(人工充值)'),
|
||||
105: ('huabei', '花呗(人工充值)'),
|
||||
106: ('yunSanPay', '云闪付(人工充值)'),
|
||||
107: ('qqWallet', 'QQ錢包(人工充值)'),
|
||||
108: ('jindongPay', '京东支付(人工充值)'),
|
||||
};
|
||||
|
||||
/// 一个充值档位
|
||||
class RechargeTypeModel {
|
||||
String? id;
|
||||
int? amount;
|
||||
int? money;
|
||||
String? couponDesc;
|
||||
DCModel? daichong; // 从上级数据结构手动赋值过来
|
||||
List<RchgType>? rechargeTypeList;
|
||||
|
||||
/// 展示用的支付方式:代充那条要按商人支持的 payMethod 展开成多条
|
||||
List<RchgType> get rechargeTypeListUI {
|
||||
final payList = <RchgType>[];
|
||||
for (final rchg in (rechargeTypeList ?? [])) {
|
||||
if (rchg.type != 'daichong') {
|
||||
payList.add(rchg);
|
||||
continue;
|
||||
}
|
||||
final payInfos = daichong?.traders?.firstOrNull?.payInfos ?? [];
|
||||
for (final info in payInfos) {
|
||||
final named = _dcPayTypes[info.payMethod];
|
||||
payList.add(RchgType()
|
||||
..isOfficial = true
|
||||
..channel = rchg.channel
|
||||
..incrAmount = rchg.incrAmount
|
||||
..incTax = rchg.incTax
|
||||
..payMethod = info.payMethod
|
||||
..type = named?.$1
|
||||
..typeName = named?.$2);
|
||||
}
|
||||
}
|
||||
return payList;
|
||||
}
|
||||
|
||||
//money是分单位 需要/100
|
||||
int get moneyYuan => ((money ?? 0) / 100).round();
|
||||
|
||||
RechargeTypeModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
amount = json['amount'];
|
||||
money = json['money'];
|
||||
couponDesc = json['couponDesc'];
|
||||
rechargeTypeList = (json['rchgType'] as List?)?.map((o) => RchgType.fromJson(o)).toList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// 下单返回的支付链接
|
||||
class RechargeUrlModel {
|
||||
String? payUrl;
|
||||
|
||||
/// url-打开外部支付链接;sdk-走 sdk
|
||||
String? mode;
|
||||
|
||||
RechargeUrlModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
payUrl = json['payUrl'];
|
||||
mode = json['mode'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/// 兑换码记录列表
|
||||
class ExchangeRecordList {
|
||||
int? total;
|
||||
List<ExchangeRecordModel>? data;
|
||||
|
||||
ExchangeRecordList.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
total = json['total'];
|
||||
data = (json['data'] as List?)?.map((e) => ExchangeRecordModel.fromJson(e)).toList();
|
||||
}
|
||||
}
|
||||
|
||||
/// 单条兑换记录
|
||||
class ExchangeRecordModel {
|
||||
String? code;
|
||||
String? desc;
|
||||
String? createdAt;
|
||||
|
||||
ExchangeRecordModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
code = json['code'];
|
||||
desc = json['desc'];
|
||||
createdAt = json['createdAt'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/// 关注 / 粉丝列表里的用户
|
||||
class FollowUserModel {
|
||||
String? id;
|
||||
int? uid;
|
||||
String? objcId;
|
||||
String? name;
|
||||
String? portrait;
|
||||
|
||||
int? fans;
|
||||
int? totalWorks;
|
||||
int? videoCount;
|
||||
|
||||
bool? hasFollow;
|
||||
bool? hasCollected;
|
||||
|
||||
FollowUserModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
uid = json['uid'];
|
||||
objcId = json['objcId'];
|
||||
name = json['name'];
|
||||
portrait = json['portrait'];
|
||||
|
||||
fans = json['fans'];
|
||||
totalWorks = json['totalWorks'];
|
||||
videoCount = json['videoCount'];
|
||||
|
||||
hasFollow = json['hasFollow'];
|
||||
hasCollected = json['hasCollected'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:hgdj/hj_model/splash/ads_model.dart';
|
||||
|
||||
class AdGroup {
|
||||
final List<AdsInfoModel>? items;
|
||||
final String? title;
|
||||
AdGroup({this.title, this.items});
|
||||
}
|
||||
|
||||
class AdTabConfig {
|
||||
/// 对应着列表数据
|
||||
final AdGroup? shuAds;
|
||||
final List<AdsInfoModel>? bannerAds;
|
||||
|
||||
/// 对应着网格排版
|
||||
final AdGroup? hengAds;
|
||||
AdTabConfig({this.shuAds, this.bannerAds, this.hengAds});
|
||||
}
|
||||
|
||||
class HappyModel {
|
||||
List<AdsInfoModel>? shuApp;
|
||||
List<AdsInfoModel>? hengApp;
|
||||
List<AdsInfoModel>? adv;
|
||||
List<AdsInfoModel>? gameApp;
|
||||
List<AdsInfoModel>? ypApp;
|
||||
List<AdsInfoModel>? zbApp;
|
||||
List<AdsInfoModel>? qpApp;
|
||||
|
||||
HappyModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
shuApp = _ads(json['shuApp']);
|
||||
hengApp = _ads(json['hengApp']);
|
||||
adv = _ads(json['adv']);
|
||||
gameApp = _ads(json['gameApp']);
|
||||
ypApp = _ads(json['ypApp']);
|
||||
zbApp = _ads(json['zbApp']);
|
||||
qpApp = _ads(json['qpApp']);
|
||||
}
|
||||
|
||||
static List<AdsInfoModel>? _ads(dynamic raw) =>
|
||||
raw is! List ? null : raw.map((e) => AdsInfoModel.fromJson(e)).toList();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// 官方渠道列表项
|
||||
class OfficialListItemModel {
|
||||
String? officialName;
|
||||
String? officialDesc;
|
||||
String? officialImg;
|
||||
String? officialUrl;
|
||||
num? position;
|
||||
|
||||
OfficialListItemModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
officialName = json['officialName'];
|
||||
officialDesc = json['officialDesc'];
|
||||
officialImg = json['officialImg'];
|
||||
officialUrl = json['officialUrl'];
|
||||
position = json['position'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// 推广记录里的下线用户
|
||||
class Promotion {
|
||||
String? name;
|
||||
String? portrait;
|
||||
String? createAt;
|
||||
|
||||
Promotion.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
name = json['name'];
|
||||
portrait = json['portrait'];
|
||||
createAt = json['createAt'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/// 积分兑换商品
|
||||
class IntegralExchangeModel {
|
||||
String? id;
|
||||
int? type; //5_实物,兑换后要联系客服填地址
|
||||
String? img;
|
||||
int? price;
|
||||
|
||||
IntegralExchangeModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
type = json['type'];
|
||||
img = json['img'];
|
||||
price = json['price'];
|
||||
}
|
||||
}
|
||||
|
||||
/// 任务中心:按类型分组的任务列表
|
||||
class TaskCenterData {
|
||||
List<DailyTask>? dailyTask; //每日任务
|
||||
List<DailyTask>? onceTask; //一次性任务
|
||||
List<DailyTask>? growthTasks; //成长任务
|
||||
|
||||
TaskCenterData.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
dailyTask = _tasks(json['dailyTask']);
|
||||
onceTask = _tasks(json['onceTask']);
|
||||
growthTasks = _tasks(json['growthTasks']);
|
||||
}
|
||||
|
||||
static List<DailyTask>? _tasks(dynamic raw) => (raw as List?)?.map((e) => DailyTask.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
/// 单个任务
|
||||
class DailyTask {
|
||||
String? id;
|
||||
String? title;
|
||||
String? subTitle;
|
||||
String? desc;
|
||||
String? img;
|
||||
String? link;
|
||||
int? type;
|
||||
int? prizesIntegral; //完成可得积分
|
||||
int? countdownType;
|
||||
String? startAt;
|
||||
String? endAt;
|
||||
int? status;
|
||||
|
||||
/// 任务所属分组,后端不下发,合并列表时由客户端标记:1_每日 2_一次性 3_成长
|
||||
int? doType;
|
||||
|
||||
DailyTask.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
title = json['title'];
|
||||
subTitle = json['subTitle'];
|
||||
desc = json['desc'];
|
||||
img = json['img'];
|
||||
link = json['link'];
|
||||
type = json['type'];
|
||||
prizesIntegral = json['prizesIntegral'];
|
||||
countdownType = json['countdownType'];
|
||||
startAt = json['startAt'];
|
||||
endAt = json['endAt'];
|
||||
status = json['status'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/// VIP 卡片统计事件(POST /analytics/events)
|
||||
class VipCardAnalyticsEvent {
|
||||
final String eventId;
|
||||
final String eventName;
|
||||
final String sessionId;
|
||||
final String occurredAt;
|
||||
final String? experimentId;
|
||||
final String? variant;
|
||||
final String? productId;
|
||||
final int? price; // 分;下单相关扩展字段,后端可忽略未知字段
|
||||
|
||||
VipCardAnalyticsEvent({
|
||||
required this.eventId,
|
||||
required this.eventName,
|
||||
required this.sessionId,
|
||||
required this.occurredAt,
|
||||
this.experimentId,
|
||||
this.variant,
|
||||
this.productId,
|
||||
this.price,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'eventId': eventId,
|
||||
'eventName': eventName,
|
||||
'sessionId': sessionId,
|
||||
'occurredAt': occurredAt,
|
||||
if (experimentId != null) 'experimentId': experimentId,
|
||||
if (variant != null) 'variant': variant,
|
||||
if (productId != null) 'productId': productId,
|
||||
if (price != null) 'price': price,
|
||||
};
|
||||
}
|
||||
|
||||
/// 事件名
|
||||
abstract class VipCardAnalyticsEventName {
|
||||
/// 卡皮页展示(A/B)
|
||||
static const pageView = 'VIP_CARD_PAGE_VIEW';
|
||||
|
||||
/// 套餐曝光(选中 / 默认选中)
|
||||
static const productImpression = 'VIP_PRODUCT_IMPRESSION';
|
||||
|
||||
/// 无购买直接关闭
|
||||
static const closeWithoutPurchase = 'VIP_CARD_CLOSE_WITHOUT_PURCHASE';
|
||||
}
|
||||
Reference in New Issue
Block a user