圣诞功能还原版本
This commit is contained in:
parent
23f56c3964
commit
192ee578dc
@ -1,7 +1,39 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { ReqSelect, ResSelect } from "../../../shared/protocols/event/christmas/PtlSelect";
|
||||
import {Christmasfun} from "./fun";
|
||||
import {HongDianChange} from "../../hongdian/fun";
|
||||
|
||||
export default async function (call: ApiCall<ReqSelect, ResSelect>) {
|
||||
// TODO
|
||||
call.error('API Not Implemented');
|
||||
let initCon = await Christmasfun.getCon(call)
|
||||
let index = call.req.index;
|
||||
let pid = call.req.pid;
|
||||
let lbid = call.req.lbid;
|
||||
let _con = initCon[call.req.hdid].data.libao[lbid];
|
||||
if (!_con) {
|
||||
// 礼包id 不存在
|
||||
return call.error('', { code: -1, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
if (index >= _con.dlz.length){
|
||||
// 礼包id 不存在
|
||||
return call.error('', { code: -2, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
if (index >= _con.dlz.length){
|
||||
// 礼包id 不存在
|
||||
return call.error('', { code: -3, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
if (!_con.dlz[index][pid]){
|
||||
// 礼包id 不存在
|
||||
return call.error('', { code: -4, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
let _mydata = await Christmasfun.getMyData(call, call.req.hdid)
|
||||
let lb_select = _mydata.select[lbid] || {}
|
||||
lb_select[index.toString()] = pid
|
||||
_mydata.select[lbid] = lb_select
|
||||
let _setData = {}
|
||||
_setData["select"] = _mydata.select
|
||||
await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData })
|
||||
let changedata = { mydata: _mydata}
|
||||
// 推送红点
|
||||
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
|
||||
call.succ(changedata);
|
||||
}
|
@ -1,7 +1,37 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { ReqTaskRec, ResTaskRec } from "../../../shared/protocols/event/christmas/PtlTaskRec";
|
||||
import {Christmasfun} from "./fun";
|
||||
import {HongDianChange} from "../../hongdian/fun";
|
||||
import {PlayerFun} from "../../../public/player";
|
||||
|
||||
export default async function (call: ApiCall<ReqTaskRec, ResTaskRec>) {
|
||||
// TODO
|
||||
call.error('API Not Implemented');
|
||||
let initCon = await Christmasfun.getCon(call)
|
||||
let taskid = call.req.taskid;
|
||||
let _con = initCon[call.req.hdid].data.task[taskid];
|
||||
if (!_con) {
|
||||
// 任务id 不存在
|
||||
return call.error('', { code: -1, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
let _mydata = await Christmasfun.getMyData(call, call.req.hdid)
|
||||
if (_mydata.taskval[taskid] < _con.pval) {
|
||||
// 任务未完成
|
||||
return call.error('', { code: -2, message: globalThis.lng.yangchengmubiao_3 })
|
||||
}
|
||||
if (_mydata.taskfinish.includes(taskid)) {
|
||||
// 任务已领取
|
||||
return call.error('', { code: -3, message: globalThis.lng.yangchengmubiao_4 })
|
||||
}
|
||||
_mydata.taskfinish.push(taskid)
|
||||
|
||||
let _setData = {}
|
||||
_setData["taskfinish"] = _mydata.taskfinish
|
||||
await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData })
|
||||
let _prize = _con.prize
|
||||
await PlayerFun.sendPrize(call, _prize);
|
||||
let changedata = { mydata: _mydata, prize: _prize}
|
||||
// 推送红点
|
||||
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
|
||||
call.succ(changedata);
|
||||
|
||||
|
||||
}
|
@ -20,7 +20,7 @@ export default async function (call: ApiCall<ReqBuyLv, ResBuyLv>) {
|
||||
let change: ResBuyLv['change'] = {};
|
||||
|
||||
change.lv = data.lv + lv;
|
||||
change.exp = data.exp + 1000
|
||||
change.exp = data.exp + 1000;
|
||||
|
||||
G.mongodb.cEvent('zhanling').updateOne(
|
||||
{ uid: call.uid, type: 'zhanling' },
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {ApiCall} from "tsrpc"
|
||||
import {YangChengMuBiaofun} from "../api_s2c/event/yangchengmubiao/fun"
|
||||
import {Christmasfun} from "../api_s2c/event/christmas/fun"
|
||||
// import { YangChengMuBiaofun } from "../api_s2c/event/yangchengmubiao/fun"
|
||||
import {Wjjl} from "../module/collection_wjjl"
|
||||
import {PublicShared} from "../shared/public/public"
|
||||
@ -73,6 +74,8 @@ export module manager {
|
||||
TaskFun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
|
||||
// 养成目标任务计数
|
||||
YangChengMuBiaofun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
|
||||
// 圣诞活动任务计数
|
||||
Christmasfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
|
||||
}
|
||||
|
||||
// 任务数值, 和检测值,看情况需要上层复写
|
||||
|
Loading…
Reference in New Issue
Block a user