Merge branch 'bugfix' into dev
# Conflicts: # src/api_s2c/event/christmas/ApiGame.ts # src/api_s2c/event/christmas/ApiLiBao.ts # src/api_s2c/event/christmas/ApiOpen.ts # src/api_s2c/event/christmas/ApiQianDao.ts # src/api_s2c/event/christmas/ApiZhanLingRec.ts # src/api_s2c/event/christmas/fun.ts # src/api_s2c/hongdian/fun.ts # src/api_s2c/pushgift/ApiOpen.ts # src/globalListener.ts
This commit is contained in:
commit
159bafcea9
@ -1,39 +1,7 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import { ApiCall } from "tsrpc";
|
||||||
import { ReqSelect, ResSelect } from "../../../shared/protocols/event/christmas/PtlSelect";
|
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>) {
|
export default async function (call: ApiCall<ReqSelect, ResSelect>) {
|
||||||
let initCon = await Christmasfun.getCon(call)
|
// TODO
|
||||||
let index = call.req.index;
|
call.error('API Not Implemented');
|
||||||
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,37 +1,7 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import { ApiCall } from "tsrpc";
|
||||||
import { ReqTaskRec, ResTaskRec } from "../../../shared/protocols/event/christmas/PtlTaskRec";
|
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>) {
|
export default async function (call: ApiCall<ReqTaskRec, ResTaskRec>) {
|
||||||
let initCon = await Christmasfun.getCon(call)
|
// TODO
|
||||||
let taskid = call.req.taskid;
|
call.error('API Not Implemented');
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,24 +1,24 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import {ApiCall} from "tsrpc";
|
||||||
import { KuangDongfun } from "../../public/kuangdong";
|
import {KuangDongfun} from "../../public/kuangdong";
|
||||||
import { PlayerFun } from "../../public/player";
|
import {PlayerFun} from "../../public/player";
|
||||||
import { ReqYanShi, ResYanShi } from "../../shared/protocols/kuangdong/PtlYanShi";
|
import {ReqYanShi, ResYanShi} from "../../shared/protocols/kuangdong/PtlYanShi";
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqYanShi, ResYanShi>) {
|
export default async function (call: ApiCall<ReqYanShi, ResYanShi>) {
|
||||||
let hdid = call.req.hdid
|
let hdid = call.req.hdid
|
||||||
let kdInfo = await KuangDongfun.getKaiCaiInfo(hdid)
|
let kdInfo = await KuangDongfun.getKaiCaiInfo(hdid)
|
||||||
|
|
||||||
if (!kdInfo) {
|
if (!kdInfo) {
|
||||||
return call.error('', { code: -1, message: globalThis.lng.kudangdong_1 })
|
return call.error('', {code: -1, message: globalThis.lng.kudangdong_1})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不是自己占领的
|
// 不是自己占领的
|
||||||
if (kdInfo.uid != call.uid) {
|
if (kdInfo.uid != call.uid) {
|
||||||
return call.error('', { code: -2, message: globalThis.lng.kudangdong_8 })
|
return call.error('', {code: -2, message: globalThis.lng.kudangdong_8})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 已经延时
|
// 已经延时
|
||||||
if (kdInfo.yanshi != 0) {
|
if (kdInfo.yanshi != 0) {
|
||||||
return call.error('', { code: -2, message: globalThis.lng.kudangdong_10 })
|
return call.error('', {code: -2, message: globalThis.lng.kudangdong_10})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -30,7 +30,13 @@ export default async function (call: ApiCall<ReqYanShi, ResYanShi>) {
|
|||||||
_need && await PlayerFun.cutNeed(call, _need);
|
_need && await PlayerFun.cutNeed(call, _need);
|
||||||
|
|
||||||
kdInfo.yanshi = 8 * 3600
|
kdInfo.yanshi = 8 * 3600
|
||||||
await KuangDongfun.setminingZhanLing(call.uid, hdid, { $set: { yanshi: kdInfo.yanshi } })
|
|
||||||
|
// 如果调用这个方法,会upsert,在没有查到数据的情况下,
|
||||||
|
// 会插入空数据,全服玩家的查询列表接口都会报错
|
||||||
|
// await KuangDongfun.setminingZhanLing(call.uid, hdid, { $set: { yanshi: kdInfo.yanshi } })
|
||||||
|
await G.mongodb.collection('kuangdong').updateOne({uid: call.uid, hdid: hdid},
|
||||||
|
{$set: {yanshi: kdInfo.yanshi}});
|
||||||
|
|
||||||
kdInfo._id = kdInfo._id.toString()
|
kdInfo._id = kdInfo._id.toString()
|
||||||
let changeData = {
|
let changeData = {
|
||||||
kdinfo: kdInfo
|
kdinfo: kdInfo
|
||||||
|
@ -81,7 +81,6 @@ export class KuangDongfun {
|
|||||||
upsert: true
|
upsert: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**获取所有矿洞信息 */
|
/**获取所有矿洞信息 */
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import {ApiCall} from "tsrpc"
|
import {ApiCall} from "tsrpc"
|
||||||
import {YangChengMuBiaofun} from "../api_s2c/event/yangchengmubiao/fun"
|
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 { YangChengMuBiaofun } from "../api_s2c/event/yangchengmubiao/fun"
|
||||||
import {Wjjl} from "../module/collection_wjjl"
|
import {Wjjl} from "../module/collection_wjjl"
|
||||||
import {PublicShared} from "../shared/public/public"
|
import {PublicShared} from "../shared/public/public"
|
||||||
@ -74,8 +73,6 @@ export module manager {
|
|||||||
TaskFun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
|
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)
|
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