fix kuangdong
This commit is contained in:
parent
934097ec16
commit
8d3b2178fc
@ -1,24 +1,24 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { KuangDongfun } from "../../public/kuangdong";
|
||||
import { PlayerFun } from "../../public/player";
|
||||
import { ReqYanShi, ResYanShi } from "../../shared/protocols/kuangdong/PtlYanShi";
|
||||
import {ApiCall} from "tsrpc";
|
||||
import {KuangDongfun} from "../../public/kuangdong";
|
||||
import {PlayerFun} from "../../public/player";
|
||||
import {ReqYanShi, ResYanShi} from "../../shared/protocols/kuangdong/PtlYanShi";
|
||||
|
||||
export default async function (call: ApiCall<ReqYanShi, ResYanShi>) {
|
||||
let hdid = call.req.hdid
|
||||
let kdInfo = await KuangDongfun.getKaiCaiInfo(hdid)
|
||||
|
||||
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) {
|
||||
return call.error('', { code: -2, message: globalThis.lng.kudangdong_8 })
|
||||
return call.error('', {code: -2, message: globalThis.lng.kudangdong_8})
|
||||
}
|
||||
|
||||
// 已经延时
|
||||
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
|
||||
@ -30,7 +30,13 @@ export default async function (call: ApiCall<ReqYanShi, ResYanShi>) {
|
||||
_need && await PlayerFun.cutNeed(call, _need);
|
||||
|
||||
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()
|
||||
let changeData = {
|
||||
kdinfo: kdInfo
|
||||
|
@ -81,7 +81,6 @@ export class KuangDongfun {
|
||||
upsert: true
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**获取所有矿洞信息 */
|
||||
|
Loading…
Reference in New Issue
Block a user