领奖,红点
This commit is contained in:
parent
38b2f9a99e
commit
65d306227b
@ -8,19 +8,25 @@ import {PublicShared} from "../../../shared/public/public";
|
||||
|
||||
export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
|
||||
// 查询活动是否有当前领奖的免费选项
|
||||
// 查询活动是否是可领取状态
|
||||
let _hd = (await HuoDongFun.gethdList(call, 10))[0]
|
||||
let gift = _hd?.data?.gift?.find(i => i.id == call.req.id)
|
||||
if (!gift || !call.req.recId) return call.errorCode(-1)
|
||||
|
||||
// 查询购买状态
|
||||
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
|
||||
payLog = payLog?.filter(i => i.time >= _hd.stime && i.time <= _hd.etime) || []
|
||||
if (!payLog || !payLog.length) return call.errorCode(-2)
|
||||
|
||||
// 取奖励列表,判断是否有可领取奖励
|
||||
/**
|
||||
* 取奖励列表,判断是否有可领取奖励
|
||||
* 购买日起,每种礼包每天可领一次礼包,每种类型独立
|
||||
* 活动结束前的最后一天,可领取所有奖励
|
||||
*/
|
||||
let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`})
|
||||
let rec = data?.record?.[call.req.id]?.length
|
||||
let _payDiff = PublicShared.getDiff(payLog[0].time)
|
||||
_payDiff = _payDiff > 3 ? 3 : _payDiff
|
||||
let _endDiff = PublicShared.getDiff(_hd.etime)
|
||||
if ((rec >= _payDiff && _endDiff < 1) || data?.record?.[gift.id] == call.req.recId) return call.errorCode(-3)
|
||||
|
||||
|
@ -390,6 +390,7 @@ export class HuoDongHongDianFun {
|
||||
|
||||
let rec = data?.record?.[item.id]?.length
|
||||
let _payDiff = PublicShared.getDiff(payLog[0].time)
|
||||
_payDiff = _payDiff > 3 ? 3 : _payDiff
|
||||
let _endDiff = PublicShared.getDiff(_hd.etime)
|
||||
if ((rec < _payDiff)) return {show: true}
|
||||
if ((rec < 3 && _endDiff > 0)) return {show: true}
|
||||
|
@ -5,7 +5,7 @@ import {prizeType} from "../../type";
|
||||
*/
|
||||
export type ReqReceive = {
|
||||
id: string
|
||||
recId: string
|
||||
recId: 'prize' | 'recPrize1' | 'recPrize2'
|
||||
}
|
||||
|
||||
export type ResReceive = {
|
||||
|
@ -10554,7 +10554,30 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"id": 1,
|
||||
"name": "recId",
|
||||
"type": {
|
||||
"type": "String"
|
||||
"type": "Union",
|
||||
"members": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Literal",
|
||||
"literal": "prize"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"type": {
|
||||
"type": "Literal",
|
||||
"literal": "recPrize1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": {
|
||||
"type": "Literal",
|
||||
"literal": "recPrize2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user