团购活动:定时退费
This commit is contained in:
@@ -60,6 +60,7 @@ export enum MAIL_TYPE {
|
||||
LADDER = 30, // 名将擂台
|
||||
GUILD_MAIL = 31, // 军团邮件
|
||||
REBATE = 32, // 返利邮件
|
||||
GROUP_SHOP_REFUND = 33, // 退费
|
||||
};
|
||||
|
||||
export const SEND_NAME = '系统';
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
|
||||
export class RefundRec {
|
||||
@prop({ required: true })
|
||||
roleId: string;
|
||||
|
||||
@prop({ required: true })
|
||||
itemId: number;
|
||||
|
||||
@prop({ required: true })
|
||||
diff: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动系统 - 团购玩家记录
|
||||
*/
|
||||
@index({ activityId: 1 })
|
||||
|
||||
export default class Activity_Group_Shop_Refund extends BaseModel {
|
||||
|
||||
@prop({ required: true })
|
||||
activityId: number; // 活动Id
|
||||
|
||||
@prop({ required: true, type: RefundRec, _id: false })
|
||||
refundRec: RefundRec[]; // 是否退好费了
|
||||
|
||||
public static async check(activityId: number) {
|
||||
return await ActivityGroupShopRefundModel.exists({ activityId });
|
||||
}
|
||||
|
||||
public static async refund(activityId: number, refundRec: RefundRec[]) {
|
||||
let result: ActivityGroupShopRefundRecType = await ActivityGroupShopRefundModel.findOneAndUpdate({ activityId }, { $set: { refundRec } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export const ActivityGroupShopRefundModel = getModelForClass(Activity_Group_Shop_Refund);
|
||||
|
||||
export interface ActivityGroupShopRefundRecType extends Pick<DocumentType<Activity_Group_Shop_Refund>, keyof Activity_Group_Shop_Refund> { }
|
||||
export type ActivityGroupShopRefundRecTypeParam = Partial<ActivityGroupShopRefundRecType>; // 将所有字段变成可选项
|
||||
@@ -30,9 +30,6 @@ export class GroupShopBuyRecord {
|
||||
@prop({ required: true })
|
||||
buyCnt: number; // 购买次数
|
||||
|
||||
@prop({ required: true })
|
||||
refundPrice: number; // 退费价格
|
||||
|
||||
constructor(curDiscount: GroupShopDiscount, buyCnt: number) {
|
||||
this.time = nowSeconds();
|
||||
if(curDiscount) {
|
||||
@@ -42,7 +39,6 @@ export class GroupShopBuyRecord {
|
||||
this.price = curDiscount.price;
|
||||
}
|
||||
this.buyCnt = buyCnt;
|
||||
this.refundPrice = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -229,5 +229,12 @@
|
||||
"sendName": "您忠诚的小跟班",
|
||||
"content": "亲爱的主公,欢迎回来!感谢您在封测期间的支持,您在测试期间共充值%d元,现将获得%d元宝返还。请查收",
|
||||
"time": 720
|
||||
},
|
||||
{
|
||||
"id": 33,
|
||||
"title": "&",
|
||||
"sendName": "您忠诚的小跟班",
|
||||
"content": "退费",
|
||||
"time": 720
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user