fix:
十五天累计充值
This commit is contained in:
parent
d2ce3dd143
commit
50087cd543
@ -13,30 +13,31 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
let _zt = PublicShared.getToDayZeroTime();
|
||||
let pays = await PayFun.getPayLogs(call.uid, payids);
|
||||
for (; day <= G.gc.shiwuleichong.tasks.length; day++) {
|
||||
let pay = pays[G.gc.shiwuleichong.tasks[day - 1].payid];
|
||||
if (!pay || pay.length == 0) {
|
||||
let pay = pays[G.gc.shiwuleichong.tasks[day].payid];
|
||||
if (!pay) {
|
||||
break
|
||||
} else {
|
||||
// 如果是最后一天奖励
|
||||
if (day >= G.gc.shiwuleichong.tasks.length) {
|
||||
// 充值订单隔天了
|
||||
if (pay.slice(-1)[0].time < _zt) {
|
||||
// 重置所有订单
|
||||
await PayFun.delPayLog(call.uid, ...payids.map(i => {
|
||||
return {payId: i, val: []}
|
||||
}))
|
||||
day = 1;
|
||||
pays = {};
|
||||
}
|
||||
break;
|
||||
} else if (pay.slice(-1)[0].time >= _zt) {
|
||||
if (pay.slice(-1)[0].time >= _zt) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果是最后一天奖励 并且 充值订单隔天了
|
||||
if (
|
||||
day == G.gc.shiwuleichong.tasks.length &&
|
||||
pays[G.gc.shiwuleichong.tasks[day - 1].payid] &&
|
||||
pays[G.gc.shiwuleichong.tasks[day - 1].payid].slice(-1)[0].time < _zt
|
||||
) {
|
||||
// 重置所有订单
|
||||
await PayFun.delPayLog(call.uid, ...payids.map(i => {
|
||||
return {payId: i, val: []}
|
||||
}))
|
||||
day = 1;
|
||||
pays = {};
|
||||
}
|
||||
|
||||
call.succ({
|
||||
day: day,
|
||||
payIds: Object.keys(pays).filter((i) => pays[i].length > 0)
|
||||
payIds: Object.keys(pays)
|
||||
});
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { PayFun } from '../../../public/pay';
|
||||
import { PlayerFun } from '../../../public/player';
|
||||
import { ReqRec, ResRec } from "../../../shared/protocols/event/shiwuleichong/PtlRec";
|
||||
|
||||
export default async function (call: ApiCall<ReqRec, ResRec>) {
|
||||
let db = await G.mongodb.cEvent('15leichong').findOne({ uid: call.uid, type: '15leichong' });
|
||||
let confArr = G.gc.shiwuleichong.data[db.index];
|
||||
|
||||
if (!confArr.tasks[call.req.index]) return call.error('', { code: -1 });
|
||||
if (db.recIndex.includes(call.req.index)) return call.error('', { code: -2 });
|
||||
|
||||
let payDay = await PayFun.getPayDaysBuyPayNum(call.uid, db.sTime, db.sTime + confArr.time, G.gc.shiwuleichong.dayPayNeed);
|
||||
if (payDay < confArr.tasks[call.req.index].total) return call.error('', { code: -3 });
|
||||
|
||||
await PlayerFun.sendPrize(call, confArr.tasks[call.req.index].prize);
|
||||
|
||||
G.mongodb.cEvent('15leichong').updateOne(
|
||||
{ uid: call.uid, type: '15leichong' },
|
||||
{ $push: { recIndex: call.req.index } }
|
||||
);
|
||||
|
||||
call.succ({
|
||||
prize: confArr.tasks[call.req.index].prize
|
||||
});
|
||||
}
|
@ -877,7 +877,7 @@ export class HuoDongHongDianFun {
|
||||
}
|
||||
};
|
||||
_res.val.meirijingxuan = await this.heiShiHongDian(call)
|
||||
_res.val.jitianhaoli = await this.heiShiLCHongDian(call)
|
||||
// _res.val.jitianhaoli = await this.heiShiLCHongDian(call)
|
||||
_res.val.niudanji = await this.heiShiNiuDanJi(call)
|
||||
Object.values(_res.val).forEach(x => _res.show = _res.show || x.show)
|
||||
return _res
|
||||
@ -913,25 +913,25 @@ export class HuoDongHongDianFun {
|
||||
}
|
||||
|
||||
/**黑市 积天豪礼 */
|
||||
static async heiShiLCHongDian(call: ApiCall): Promise<hongdianVal> {
|
||||
let _res: hongdianVal = {
|
||||
show: false
|
||||
};
|
||||
let db = await G.mongodb.cEvent('15leichong').findOne({uid: call.uid, type: '15leichong'});
|
||||
|
||||
if (!db) return _res;
|
||||
|
||||
let _con = G.gc.shiwuleichong.data[db.index];
|
||||
let payDay = await PayFun.getPayDaysBuyPayNum(call.uid, db.sTime, db.sTime + _con.time, G.gc.shiwuleichong.dayPayNeed);
|
||||
for (let index = 0; index < _con.tasks.length; index++) {
|
||||
const element = _con.tasks[index];
|
||||
if (db.recIndex.includes(index)) continue;
|
||||
if (payDay < element.total) continue;
|
||||
_res.show = true;
|
||||
break;
|
||||
}
|
||||
return _res;
|
||||
}
|
||||
// static async heiShiLCHongDian(call: ApiCall): Promise<hongdianVal> {
|
||||
// let _res: hongdianVal = {
|
||||
// show: false
|
||||
// };
|
||||
// let db = await G.mongodb.cEvent('15leichong').findOne({uid: call.uid, type: '15leichong'});
|
||||
//
|
||||
// if (!db) return _res;
|
||||
//
|
||||
// let _con = G.gc.shiwuleichong.data[db.index];
|
||||
// let payDay = await PayFun.getPayDaysBuyPayNum(call.uid, db.sTime, db.sTime + _con.time, G.gc.shiwuleichong.dayPayNeed);
|
||||
// for (let index = 0; index < _con.tasks.length; index++) {
|
||||
// const element = _con.tasks[index];
|
||||
// if (db.recIndex.includes(index)) continue;
|
||||
// if (payDay < element.total) continue;
|
||||
// _res.show = true;
|
||||
// break;
|
||||
// }
|
||||
// return _res;
|
||||
// }
|
||||
|
||||
/**黑市 扭蛋机 */
|
||||
static async heiShiNiuDanJi(call: ApiCall): Promise<hongdianVal> {
|
||||
|
@ -1179,7 +1179,7 @@ type gc_shiwucom = {
|
||||
}, "comment": { "jichu_colour": string, "fujia_colour": string, "fujianum_colour": string, "putongxilian": string, "gaojixilian": string, "hero_zhuanshu": string, "buff_zhuanshu": string, "skill_zhuanshu": string, "chongzhuneed": string, "chongzhurate": string, "tilianhuobi": string, [x: string]: any }, [x: string]: any
|
||||
}
|
||||
|
||||
type gc_shiwuleichong = { "dayPayNeed": number, "data": { "time": number, "tasks": { "total": number, "prize": { "a": string, "t": string, "n": number, [x: string]: any }[], [x: string]: any }[], [x: string]: any }[], [x: string]: any }
|
||||
type gc_shiwuleichong = { tasks: { day: number, payid: string }[] }
|
||||
|
||||
type gc_shoot = { [key: string]: { "name": string, "num": number, "speed": number, "cartridge": number, "time": number, "prize": { [key: string]: { "describe": string, "hit": number, "content": { "a": string, "t": string, "n": number, [x: string]: any }[], [x: string]: any } }, [x: string]: any } }
|
||||
|
||||
|
@ -5,7 +5,7 @@ export default {
|
||||
/**是否开发模式 */
|
||||
debug: true,
|
||||
/**消息服socket端口*/
|
||||
msgPort: 7785,
|
||||
msgPort: 7778,
|
||||
/**http端口 msg服专用*/
|
||||
// httpPort: 7779,
|
||||
/**跨服socket端口 */
|
||||
|
@ -1,18 +1,10 @@
|
||||
|
||||
/**
|
||||
* 进入15天累充
|
||||
*/
|
||||
export type ReqOpen = {
|
||||
|
||||
};
|
||||
export type ReqOpen = {};
|
||||
|
||||
export type ResOpen = {
|
||||
/**礼包组 取G.gc.shiwuleichong[index] */
|
||||
index: number;
|
||||
/**开始时间 倒计时显示 sTime+G.gc.shiwuleichong[index].time */
|
||||
sTime: number;
|
||||
/**已领取的奖励下标 */
|
||||
recIndex: number[];
|
||||
/**已充值的天数 */
|
||||
payDay: number;
|
||||
day: number;
|
||||
payIds: string[];
|
||||
};
|
@ -1,13 +0,0 @@
|
||||
import { prizeType } from '../../type';
|
||||
|
||||
|
||||
/**
|
||||
* 领取15天累充奖励
|
||||
*/
|
||||
export type ReqRec = {
|
||||
index: number;
|
||||
};
|
||||
|
||||
export type ResRec = {
|
||||
prize: prizeType[];
|
||||
};
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user