元旦红点,破冰红点
This commit is contained in:
parent
944ef41d5d
commit
1cf4784d42
@ -4,6 +4,7 @@ import {HuoDongFun} from "../../../public/huodongfun";
|
|||||||
import {PlayerFun} from "../../../public/player";
|
import {PlayerFun} from "../../../public/player";
|
||||||
import {HongDianChange} from "../../hongdian/fun";
|
import {HongDianChange} from "../../hongdian/fun";
|
||||||
import {Yuandanfun} from "./fun";
|
import {Yuandanfun} from "./fun";
|
||||||
|
import {PublicShared} from "../../../shared/public/public";
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqZLRec, ResZLRec>) {
|
export default async function (call: ApiCall<ReqZLRec, ResZLRec>) {
|
||||||
let _hd = await Yuandanfun.getCon(call)
|
let _hd = await Yuandanfun.getCon(call)
|
||||||
@ -18,11 +19,15 @@ export default async function (call: ApiCall<ReqZLRec, ResZLRec>) {
|
|||||||
let rec = data?.qiandao?.[call.req.id]
|
let rec = data?.qiandao?.[call.req.id]
|
||||||
if (rec) return call.errorCode(-3)
|
if (rec) return call.errorCode(-3)
|
||||||
|
|
||||||
|
if (data && data.qiandaoTime && PublicShared.chkSameDate(data.qiandaoTime, G.time)) {
|
||||||
|
return call.errorCode(-4)
|
||||||
|
}
|
||||||
|
|
||||||
// 奖励不符合,严格判断
|
// 奖励不符合,严格判断
|
||||||
let dlzList = R.flatten(gift.dlz.map(i => R.values(i)))
|
let dlzList = R.flatten(gift.dlz.map(i => R.values(i)))
|
||||||
call.req.dlz.map(i => {
|
call.req.dlz.map(i => {
|
||||||
let item = dlzList.find(v => i.a == v.a && i.t == v.t && i.n == v.n)
|
let item = dlzList.find(v => i.a == v.a && i.t == v.t && i.n == v.n)
|
||||||
if (!item) call.errorCode(-4)
|
if (!item) call.errorCode(-5)
|
||||||
})
|
})
|
||||||
|
|
||||||
let prize = [...gift.prize, ...call.req.dlz]
|
let prize = [...gift.prize, ...call.req.dlz]
|
||||||
@ -30,7 +35,7 @@ export default async function (call: ApiCall<ReqZLRec, ResZLRec>) {
|
|||||||
await PlayerFun.sendPrize(call, prize);
|
await PlayerFun.sendPrize(call, prize);
|
||||||
|
|
||||||
await G.mongodb.cEvent(`yuandan${_hd.hdid}`).updateOne({uid: call.uid, type: `yuandan${_hd.hdid}`}, {
|
await G.mongodb.cEvent(`yuandan${_hd.hdid}`).updateOne({uid: call.uid, type: `yuandan${_hd.hdid}`}, {
|
||||||
$set: {[`qiandao.${call.req.id}`]: prize},
|
$set: {[`qiandao.${call.req.id}`]: prize, qiandaoTime: G.time},
|
||||||
}, {upsert: true})
|
}, {upsert: true})
|
||||||
|
|
||||||
call.succ({[call.req.id]: prize})
|
call.succ({[call.req.id]: prize})
|
||||||
|
@ -369,6 +369,10 @@ export class HuoDongHongDianFun {
|
|||||||
// 检测 htype 10 破冰活动红点
|
// 检测 htype 10 破冰活动红点
|
||||||
ishd = await this.pobinglibao(call, element)
|
ishd = await this.pobinglibao(call, element)
|
||||||
}
|
}
|
||||||
|
if (element.htype == 14) {
|
||||||
|
// 检测 htype 10 破冰活动红点
|
||||||
|
ishd = await this.yuandan(call, element)
|
||||||
|
}
|
||||||
|
|
||||||
// 此活动有红点
|
// 此活动有红点
|
||||||
if (ishd.show) {
|
if (ishd.show) {
|
||||||
@ -383,7 +387,7 @@ export class HuoDongHongDianFun {
|
|||||||
|
|
||||||
/**破冰礼包红点 */
|
/**破冰礼包红点 */
|
||||||
static async pobinglibao(call: ApiCall, _hd: ReqAddHuoDong): Promise<hongdianVal> {
|
static async pobinglibao(call: ApiCall, _hd: ReqAddHuoDong): Promise<hongdianVal> {
|
||||||
let gift = _hd?.data?.gift?.find(i => i.id == call.req.id)
|
let gift = _hd?.data?.gift?.find(i => i.free == true && !i.payId)
|
||||||
if (!gift) return {show: false}
|
if (!gift) return {show: false}
|
||||||
|
|
||||||
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
|
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
|
||||||
@ -397,6 +401,25 @@ export class HuoDongHongDianFun {
|
|||||||
return {show: true}
|
return {show: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**元旦活动红点 */
|
||||||
|
static async yuandan(call: ApiCall, _hd: ReqAddHuoDong): Promise<hongdianVal> {
|
||||||
|
|
||||||
|
let gift = _hd?.data?.gift?.find(i => i.free && !i.payId)
|
||||||
|
|
||||||
|
// 取奖励列表,判断是否有可领取奖励
|
||||||
|
let data = await G.mongodb.cEvent(`yuandan${_hd.hdid}`).findOne({uid: call.uid, type: `yuandan${_hd.hdid}`})
|
||||||
|
|
||||||
|
if (gift && !data?.gift?.[gift.id]) return {show: true}
|
||||||
|
|
||||||
|
if (data?.gameNum < _hd.data.gamefree) return {show: true}
|
||||||
|
|
||||||
|
if (!PublicShared.chkSameDate(data.qiandaoTime || 0, G.time)) {
|
||||||
|
return {show: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {show: false}
|
||||||
|
}
|
||||||
|
|
||||||
/**开服狂欢红点 */
|
/**开服狂欢红点 */
|
||||||
static async kfkhHongDian(call: ApiCall) {
|
static async kfkhHongDian(call: ApiCall) {
|
||||||
let _res: hongdianVal = {
|
let _res: hongdianVal = {
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
* 元旦
|
* 元旦
|
||||||
*/
|
*/
|
||||||
export type ReqOpen = {
|
export type ReqOpen = {}
|
||||||
}
|
|
||||||
|
|
||||||
export type ResOpen = {
|
export type ResOpen = {
|
||||||
|
qiandao: { [k: string]: any };
|
||||||
|
gift: { [k: string]: any };
|
||||||
|
taskfinish: string[];
|
||||||
|
taskval: { [k: string]: any }
|
||||||
|
exchange: { [k: string]: any }
|
||||||
|
gameNum: number
|
||||||
|
refreshTime: number;
|
||||||
|
qiandaoTime: number;
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
}
|
}
|
||||||
|
@ -11525,6 +11525,84 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
|||||||
},
|
},
|
||||||
"event/yuandan/PtlOpen/ResOpen": {
|
"event/yuandan/PtlOpen/ResOpen": {
|
||||||
"type": "Interface",
|
"type": "Interface",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"name": "qiandao",
|
||||||
|
"type": {
|
||||||
|
"type": "Interface",
|
||||||
|
"indexSignature": {
|
||||||
|
"keyType": "String",
|
||||||
|
"type": {
|
||||||
|
"type": "Any"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "gift",
|
||||||
|
"type": {
|
||||||
|
"type": "Interface",
|
||||||
|
"indexSignature": {
|
||||||
|
"keyType": "String",
|
||||||
|
"type": {
|
||||||
|
"type": "Any"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"name": "taskfinish",
|
||||||
|
"type": {
|
||||||
|
"type": "Array",
|
||||||
|
"elementType": {
|
||||||
|
"type": "String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"name": "taskval",
|
||||||
|
"type": {
|
||||||
|
"type": "Interface",
|
||||||
|
"indexSignature": {
|
||||||
|
"keyType": "String",
|
||||||
|
"type": {
|
||||||
|
"type": "Any"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"name": "exchange",
|
||||||
|
"type": {
|
||||||
|
"type": "Interface",
|
||||||
|
"indexSignature": {
|
||||||
|
"keyType": "String",
|
||||||
|
"type": {
|
||||||
|
"type": "Any"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"name": "gameNum",
|
||||||
|
"type": {
|
||||||
|
"type": "Number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"name": "refreshTime",
|
||||||
|
"type": {
|
||||||
|
"type": "Number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"indexSignature": {
|
"indexSignature": {
|
||||||
"keyType": "String",
|
"keyType": "String",
|
||||||
"type": {
|
"type": {
|
||||||
|
Loading…
Reference in New Issue
Block a user