This commit is contained in:
dy 2023-12-15 11:12:04 +08:00
parent b524f2a847
commit fe8a68a6eb

View File

@ -6,7 +6,6 @@ import {PublicShared} from "../../../shared/public/public";
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let data = await G.mongodb.cEvent('zhoumolibao').findOne({uid: call.uid, type: 'zhoumolibao'})
let _hd = (await HuoDongFun.gethdList(call, 9))[0]
@ -17,6 +16,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
record: data?.record || {},
buyLog: await PayFun.getPayLogs(call.uid, payIds)
})
checkResetBuyLog(call)
}
export async function getConf(call, args?: { id?: string; payId?: string }) {
@ -31,10 +31,10 @@ export async function checkResetBuyLog(call) {
let zeroTime = PublicShared.getToDayZeroTime()
let data = await G.mongodb.cEvent('zhoumolibao').findOne({uid: call.uid, type: 'zhoumolibao'})
if (data?.refreshTime <= zeroTime) {
if (!data?.refreshTime || data?.refreshTime < zeroTime) {
G.mongodb.cEvent(`zhoumolibao`).updateOne(
{uid: call.uid, type: `zhoumolibao`},
{$set: {record: {}}},
{$set: {record: {}, refreshTime: G.time}},
{upsert: true}
)
}
@ -43,7 +43,7 @@ export async function checkResetBuyLog(call) {
let payIds = gifts.filter(i => i.payId)?.map(i => i.payId)
let payLogs = await PayFun.getPayLogs(call.uid, payIds)
let payLogLength = R.values(payLogs).filter(i => i.time < zeroTime).length
let payLogLength = R.flatten(R.values(payLogs)).filter(i => i.time < zeroTime).length
if (payLogLength) {
PayFun.delPayLog(call.uid, payIds.map(i => ({payId: i, val: []})))
}