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 { HuoDongFun } from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay';
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/leijichongzhi/PtlOpen";
import { PublicShared } from '../../../shared/public/public';
import {ApiCall} from "tsrpc";
import {HuoDongFun} from "../../../public/huodongfun";
import {PayFun} from '../../../public/pay';
import {ReqOpen, ResOpen} from "../../../shared/protocols/event/leijichongzhi/PtlOpen";
import {PublicShared} from '../../../shared/public/public';
import {checkNextRound} from "./ApiRec";
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
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 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);
if (!db) {
G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType },
{ $set: { sTime: sTime, recIndex: [] } },
{ upsert: true }
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$set: {sTime: sTime, recIndex: [], round: 0}},
{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({
sTime: sTime,
recIndex: db?.recIndex || [],
payNum: (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10,
hdinfo: _hdinfo
payNum: payNum,
hdinfo: _hdinfo,
round: db?.round || 0
});
}

View File

@ -1,37 +1,49 @@
import { ApiCall } from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay';
import { PlayerFun } from '../../../public/player';
import { ReqRec, ResRec } from "../../../shared/protocols/event/leijichongzhi/PtlRec";
import { HongDianChange } from "../../hongdian/fun";
import {ApiCall} from "tsrpc";
import {HuoDongFun} from "../../../public/huodongfun";
import {PayFun} from '../../../public/pay';
import {PlayerFun} from '../../../public/player';
import {ReqRec, ResRec} from "../../../shared/protocols/event/leijichongzhi/PtlRec";
import {HongDianChange} from "../../hongdian/fun";
export default async function (call: ApiCall<ReqRec, ResRec>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
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 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 });
if (db.recIndex.includes(call.req.index)) return call.error('', { code: -2 });
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});
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);
G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType },
{ $push: { recIndex: call.req.index } }
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$push: {recIndex: call.req.index}}
);
await checkNextRound(call, db, _hdinfo.data.tasks)
HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
call.succ({
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 健壮性处理
return call.errorCode(-4)
}
if (callRes.res.enemy.length)
if (callRes.res?.enemy?.length)
data.enemy = callRes.res.enemy.map(e => {
return {...e, result: null};
});
@ -44,6 +44,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
call.succ({
...data,
enemy: data.enemy || [],
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,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -550,8 +550,8 @@
"mapId": 430,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -589,8 +589,8 @@
"mapId": 460,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -615,8 +615,8 @@
"mapId": 480,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -641,8 +641,8 @@
"mapId": 500,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -680,8 +680,8 @@
"mapId": 530,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -693,8 +693,8 @@
"mapId": 540,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -797,8 +797,8 @@
"mapId": 620,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -810,8 +810,8 @@
"mapId": 630,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -849,8 +849,8 @@
"mapId": 660,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -875,8 +875,8 @@
"mapId": 680,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -901,8 +901,8 @@
"mapId": 700,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -940,8 +940,8 @@
"mapId": 730,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -953,8 +953,8 @@
"mapId": 740,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -1057,8 +1057,8 @@
"mapId": 820,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -1070,8 +1070,8 @@
"mapId": 830,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -1109,8 +1109,8 @@
"mapId": 860,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -1135,8 +1135,8 @@
"mapId": 880,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -1161,8 +1161,8 @@
"mapId": 900,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -1200,8 +1200,8 @@
"mapId": 930,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 5
}
],
@ -1213,8 +1213,8 @@
"mapId": 940,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
@ -1298,5 +1298,109 @@
],
"chapter": 14,
"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;
else if (gud[k] != undefined) val = gud[k];
if (k == 'jjc_rank' && !gud.headFrames[conf.id] && val <= conf.cond[1]) {
gud.headFrames[conf.id] = -1;
change = true;
if (k == 'jjc_rank') {
if (!gud.headFrames[conf.id] && val <= conf.cond[1]) {
gud.headFrames[conf.id] = -1;
change = true;
} else return
} else if (!gud.headFrames[conf.id] && val >= conf.cond[1]) {
gud.headFrames[conf.id] = -1;
change = true;

View File

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

View File

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