diff --git a/src/api_s2c/event/yangchengmubiao/ApiOpen.ts b/src/api_s2c/event/yangchengmubiao/ApiOpen.ts index 89f91a9..611e38e 100644 --- a/src/api_s2c/event/yangchengmubiao/ApiOpen.ts +++ b/src/api_s2c/event/yangchengmubiao/ApiOpen.ts @@ -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) { let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid) @@ -9,6 +11,23 @@ export default async function (call: ApiCall) { // 无此活动 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);