Merge branch 'feature/huangqijiuguan' into release
# Conflicts: # src/public/task.ts
This commit is contained in:
commit
de40641464
@ -32,6 +32,7 @@ export default async function (call: ApiCall<ReqDuiHuan, ResDuiHuan>) {
|
||||
|
||||
// 检查消耗
|
||||
await PlayerFun.checkNeedIsMeet(call, need);
|
||||
await PlayerFun.cutNeed(call, need);
|
||||
// 发送奖励
|
||||
await PlayerFun.sendPrize(call, prize);
|
||||
// 记录兑换次数
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { ReqGiftRec, ResGiftRec } from "../../../shared/protocols/event/huangqijiuguan/PtlGiftRec";
|
||||
import HQJGFun from "./fun";
|
||||
import { PlayerFun } from "../../../public/player";
|
||||
|
||||
export default async function (call: ApiCall<ReqGiftRec, ResGiftRec>) {
|
||||
let hd = await HQJGFun.HdInfo(call, call.req.hdid);
|
||||
@ -38,7 +39,7 @@ export default async function (call: ApiCall<ReqGiftRec, ResGiftRec>) {
|
||||
mydata.giftbuy[call.req.giftid].num++;
|
||||
await HQJGFun.setMyData(call.uid, call.req.hdid, { giftbuy: mydata.giftbuy });
|
||||
|
||||
await PlayerFun.sendPrize(call, prize);
|
||||
call.succ({ data: mydata, prize: prize })
|
||||
|
||||
G.server.sendMsgByUid(call.uid, "msg_s2c/HongDianChange", ["huodonghd"])
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { PublicShared } from "../../../shared/public/public"
|
||||
import { EmailFun } from "../../../public/email"
|
||||
import { playerInfo } from "../../../shared/protocols/user/PtlLogin"
|
||||
import { PlayerFun } from "../../../public/player"
|
||||
import { Player } from "../../../shared/fightControl/Player"
|
||||
import { TaskFun } from "../../../public/task"
|
||||
|
||||
// hddata.data
|
||||
export interface Data {
|
||||
@ -372,15 +372,15 @@ export default class HQJGFun {
|
||||
|
||||
let mydata = await this.getMydata(call, hd.hdid);
|
||||
|
||||
if (!mydata.task.val[`day${today}`]) {
|
||||
mydata.task.val[`day${today}`] = {}
|
||||
}
|
||||
|
||||
let isset = 0;
|
||||
let setData = {
|
||||
$inc: {},
|
||||
$set: {}
|
||||
};
|
||||
if (!mydata.task.val[`day${today}`]) {
|
||||
isset = 1;
|
||||
mydata.task.val[`day${today}`] = {}
|
||||
for (let taskid in tasks) {
|
||||
let taskcon = tasks[taskid];
|
||||
mydata.task.val[`day${today}`][taskid] = await TaskFun.getTaskNval(call, taskcon);
|
||||
}
|
||||
}
|
||||
|
||||
for (let taskid of Object.keys(tasks)) {
|
||||
let taskCon = tasks[taskid];
|
||||
@ -393,18 +393,20 @@ export default class HQJGFun {
|
||||
val = await alchangeVal(call, taskCon, val, arg)
|
||||
|
||||
isset = 1
|
||||
if (isinc == 1) { // 累加
|
||||
mydata.task.val[`day${today}`][taskid] = (mydata.task.val[`day${today}`][taskid] || 0) + val
|
||||
setData["$inc"][`task.val.day${today}.${taskid}`] = val
|
||||
if (isinc != 1) { // 累加
|
||||
mydata.task.val[`day${today}`][taskid] = val;
|
||||
} else {
|
||||
mydata.task.val[`day${today}`][taskid] = val
|
||||
setData["$set"][`task.val.day${today}.${taskid}`] = val
|
||||
mydata.task.val[`day${today}`][taskid] = (mydata.task.val[`day${today}`][taskid] || 0) + val;
|
||||
}
|
||||
}
|
||||
|
||||
// 设置任务
|
||||
if (isset == 1) {
|
||||
await G.mongodb.collection('event').updateOne({ uid: call.uid, type: this.dataType(hd.hdid) }, setData)
|
||||
await G.mongodb.collection('event').updateOne({ uid: call.uid, type: this.dataType(hd.hdid) }, {
|
||||
$set: {
|
||||
[`task.val.day${today}`]: mydata.task.val[`day${today}`]
|
||||
}
|
||||
})
|
||||
|
||||
if ((await this.getHongDian(call, hd, mydata)).show) {
|
||||
G.server.sendMsgByUid(call.uid, "msg_s2c/HongDianChange", ["huodonghd"])
|
||||
|
Loading…
Reference in New Issue
Block a user