Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix

This commit is contained in:
ciniao 2024-01-02 09:45:51 +08:00
commit fc7c7ceaad
11 changed files with 23913 additions and 14675 deletions

View File

@ -1,32 +1,38 @@
import { ApiCall } from "tsrpc"; import {ApiCall} from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun"; import {HuoDongFun} from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay'; import {PayFun} from '../../../public/pay';
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/leijichongzhi/PtlOpen"; import {ReqOpen, ResOpen} from "../../../shared/protocols/event/leijichongzhi/PtlOpen";
import { PublicShared } from '../../../shared/public/public'; import {PublicShared} from '../../../shared/public/public';
import {checkNextRound} from "./ApiRec";
export default async function (call: ApiCall<ReqOpen, ResOpen>) { export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid) let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
if (!_hdinfo || Object.keys(_hdinfo).length <= 0) { if (!_hdinfo || Object.keys(_hdinfo).length <= 0) {
// 无此活动 // 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) return call.error('', {code: -1, message: globalThis.lng.huodong_open_1})
} }
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}` let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
let db = await G.mongodb.cEvent(_dbType).findOne({ uid: call.uid, type: _dbType }); let db = await G.mongodb.cEvent(_dbType).findOne({uid: call.uid, type: _dbType});
let sTime = db?.sTime || PublicShared.getToDayZeroTime(G.time); let sTime = db?.sTime || PublicShared.getToDayZeroTime(G.time);
if (!db) { if (!db) {
G.mongodb.cEvent(_dbType).updateOne( await G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType }, {uid: call.uid, type: _dbType},
{ $set: { sTime: sTime, recIndex: [] } }, {$set: {sTime: sTime, recIndex: [], round: 0}},
{ upsert: true } {upsert: true}
); );
} }
db = await checkNextRound(call, db, _hdinfo.data.tasks)
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10
payNum = payNum - (db.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
call.succ({ call.succ({
sTime: sTime, sTime: sTime,
recIndex: db?.recIndex || [], recIndex: db?.recIndex || [],
payNum: (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10, payNum: payNum,
hdinfo: _hdinfo hdinfo: _hdinfo,
round: db?.round || 0
}); });
} }

View File

@ -1,37 +1,49 @@
import { ApiCall } from "tsrpc"; import {ApiCall} from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun"; import {HuoDongFun} from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay'; import {PayFun} from '../../../public/pay';
import { PlayerFun } from '../../../public/player'; import {PlayerFun} from '../../../public/player';
import { ReqRec, ResRec } from "../../../shared/protocols/event/leijichongzhi/PtlRec"; import {ReqRec, ResRec} from "../../../shared/protocols/event/leijichongzhi/PtlRec";
import { HongDianChange } from "../../hongdian/fun"; import {HongDianChange} from "../../hongdian/fun";
export default async function (call: ApiCall<ReqRec, ResRec>) { export default async function (call: ApiCall<ReqRec, ResRec>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid) let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
if (!_hdinfo || Object.keys(_hdinfo).length <= 0) { if (!_hdinfo || Object.keys(_hdinfo).length <= 0) {
// 无此活动 // 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) return call.error('', {code: -1, message: globalThis.lng.huodong_open_1})
} }
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}` let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
let conf = _hdinfo.data.tasks[call.req.index]; let conf = _hdinfo.data.tasks[call.req.index];
if (!conf) return call.error('', { code: -1 }); if (!conf) return call.error('', {code: -1});
let db = await G.mongodb.cEvent(_dbType).findOne({ uid: call.uid, type: _dbType }); let db = await G.mongodb.cEvent(_dbType).findOne({uid: call.uid, type: _dbType});
if (db.recIndex.includes(call.req.index)) return call.error('', { code: -2 }); if (db.recIndex.includes(call.req.index)) return call.error('', {code: -2});
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10; let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10;
if (payNum < conf.total) return call.error('', { code: -3 }); payNum = payNum - (db.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
if (payNum < conf.total) return call.error('', {code: -3});
await PlayerFun.sendPrize(call, conf.prize); await PlayerFun.sendPrize(call, conf.prize);
G.mongodb.cEvent(_dbType).updateOne( await G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType }, {uid: call.uid, type: _dbType},
{ $push: { recIndex: call.req.index } } {$push: {recIndex: call.req.index}}
); );
await checkNextRound(call, db, _hdinfo.data.tasks)
HongDianChange.sendChangeKey(call.uid, ['huodonghd']) HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
call.succ({ call.succ({
prize: conf.prize prize: conf.prize
}); });
}
export async function checkNextRound(call: ApiCall, event, tasks) {
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
if ((event?.recIndex?.length || 0) < tasks.length) return event
return (await G.mongodb.cEvent(_dbType).findOneAndUpdate(
{uid: call.uid, type: _dbType},
{$set: {recIndex: []}, $inc: {round: 1}}, {returnDocument: 'after'}
)).value;
} }

View File

@ -29,7 +29,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
//todo 健壮性处理 //todo 健壮性处理
return call.errorCode(-4) return call.errorCode(-4)
} }
if (callRes.res.enemy.length) if (callRes.res?.enemy?.length)
data.enemy = callRes.res.enemy.map(e => { data.enemy = callRes.res.enemy.map(e => {
return {...e, result: null}; return {...e, result: null};
}); });
@ -44,6 +44,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
call.succ({ call.succ({
...data, ...data,
enemy: data.enemy || [],
rank: await getMyRank(call.uid) rank: await getMyRank(call.uid)
}); });
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -537,8 +537,8 @@
"mapId": 420, "mapId": 420,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -550,8 +550,8 @@
"mapId": 430, "mapId": 430,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -589,8 +589,8 @@
"mapId": 460, "mapId": 460,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -615,8 +615,8 @@
"mapId": 480, "mapId": 480,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -641,8 +641,8 @@
"mapId": 500, "mapId": 500,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -680,8 +680,8 @@
"mapId": 530, "mapId": 530,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -693,8 +693,8 @@
"mapId": 540, "mapId": 540,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -797,8 +797,8 @@
"mapId": 620, "mapId": 620,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -810,8 +810,8 @@
"mapId": 630, "mapId": 630,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -849,8 +849,8 @@
"mapId": 660, "mapId": 660,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -875,8 +875,8 @@
"mapId": 680, "mapId": 680,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -901,8 +901,8 @@
"mapId": 700, "mapId": 700,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -940,8 +940,8 @@
"mapId": 730, "mapId": 730,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -953,8 +953,8 @@
"mapId": 740, "mapId": 740,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1057,8 +1057,8 @@
"mapId": 820, "mapId": 820,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1070,8 +1070,8 @@
"mapId": 830, "mapId": 830,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -1109,8 +1109,8 @@
"mapId": 860, "mapId": 860,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1135,8 +1135,8 @@
"mapId": 880, "mapId": 880,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -1161,8 +1161,8 @@
"mapId": 900, "mapId": 900,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1200,8 +1200,8 @@
"mapId": 930, "mapId": 930,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -1213,8 +1213,8 @@
"mapId": 940, "mapId": 940,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1298,5 +1298,109 @@
], ],
"chapter": 14, "chapter": 14,
"des": "intr_guanqia_des_1" "des": "intr_guanqia_des_1"
},
"101": {
"id": 101,
"mapId": 1010,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"102": {
"id": 102,
"mapId": 1020,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"103": {
"id": 103,
"mapId": 1030,
"prize": [
{
"a": "item",
"t": "4",
"n": 5
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"104": {
"id": 104,
"mapId": 1040,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"105": {
"id": 105,
"mapId": 1050,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"106": {
"id": 106,
"mapId": 1060,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"107": {
"id": 107,
"mapId": 1070,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"108": {
"id": 108,
"mapId": 1080,
"prize": [
{
"a": "item",
"t": "4",
"n": 5
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -279,9 +279,11 @@ export class UserFun {
if (k == 'wxcLv') val = gud.wxcLv.lv; if (k == 'wxcLv') val = gud.wxcLv.lv;
else if (gud[k] != undefined) val = gud[k]; else if (gud[k] != undefined) val = gud[k];
if (k == 'jjc_rank' && !gud.headFrames[conf.id] && val <= conf.cond[1]) { if (k == 'jjc_rank') {
gud.headFrames[conf.id] = -1; if (!gud.headFrames[conf.id] && val <= conf.cond[1]) {
change = true; gud.headFrames[conf.id] = -1;
change = true;
} else return
} else if (!gud.headFrames[conf.id] && val >= conf.cond[1]) { } else if (!gud.headFrames[conf.id] && val >= conf.cond[1]) {
gud.headFrames[conf.id] = -1; gud.headFrames[conf.id] = -1;
change = true; change = true;

View File

@ -16,4 +16,6 @@ export type ResOpen = {
payNum: number; payNum: number;
/**活动信息 */ /**活动信息 */
hdinfo: ReqAddHuoDong; hdinfo: ReqAddHuoDong;
/** 当前领取轮次 */
round: number
}; };

View File

@ -10263,6 +10263,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
"type": "Reference", "type": "Reference",
"target": "../../monopoly/protocols/PtlAddHuoDong/ReqAddHuoDong" "target": "../../monopoly/protocols/PtlAddHuoDong/ReqAddHuoDong"
} }
},
{
"id": 4,
"name": "round",
"type": {
"type": "Number"
}
} }
] ]
}, },