养成目标礼包重置
This commit is contained in:
xichaoyin 2024-01-06 17:30:41 +08:00
parent f61b59123b
commit 2d62a387b6

View File

@ -2,6 +2,8 @@ import { ApiCall } from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun";
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/yangchengmubiao/PtlOpen";
import { YangChengMuBiaofun } from "./fun";
import { PayFun } from "../../../public/pay";
import { payLog } from "../../../shared/protocols/pay/PtlGetList";
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
@ -9,6 +11,23 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
// 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
let delPay: { payId: string, val: payLog[] }[] = [];
let payIds = _hdinfo.data.gift.map(v => v.payId);
let payLogs = await PayFun.getPayLogs(call.uid, payIds);
for (let payid in payLogs) {
if (payLogs[payid].length > 0) {
if (payIds[payIds].slice(-1)[0].time < _hdinfo.stime) {
delPay.push({ payId: payid, val: [] });
}
}
}
if (delPay.length > 0) {
await PayFun.delPayLog(call.uid, ...delPay);
}
let _mydata = await YangChengMuBiaofun.getMyData(call, call.req.hdid)
let changedata = { mydata: _mydata, hdinfo: _hdinfo }
call.succ(changedata);