Merge branch 'bugfix' into release
This commit is contained in:
commit
96b71de06d
@ -3,19 +3,56 @@ import { PlayerFun } from '../../public/player';
|
||||
import { ReqRec, ResRec } from "../../shared/protocols/conglinshoulie/PtlRec";
|
||||
import { HongDianChange } from "../hongdian/fun";
|
||||
import { addStar, clslDb } from './ApiOpen';
|
||||
import { EmailFun } from "../../public/email";
|
||||
|
||||
export default async function (call: ApiCall<ReqRec, ResRec>) {
|
||||
let conf = G.gc.clsl_com.fightWinPrize[call.req.index];
|
||||
if (!conf) return call.errorCode(-1);
|
||||
|
||||
let db = await clslDb().findOne({ uid: call.uid, type: 'clsl' });
|
||||
|
||||
let curStar = db?.allStar || 0;
|
||||
let danPrize = db?.danPrize || [];
|
||||
let curMaxStar = db?.curMaxStar || 0;
|
||||
|
||||
if ((db?.fightWinNum || 0) < conf.total || db?.recWinPrize?.includes(call.req.index)) return call.errorCode(-2);
|
||||
|
||||
await PlayerFun.sendPrize(call, conf.prize);
|
||||
|
||||
addStar(call, conf.star);
|
||||
let updata = { $push: { recWinPrize: call.req.index } };
|
||||
|
||||
clslDb().updateOne({ uid: call.uid, type: 'clsl' }, { $push: { recWinPrize: call.req.index } });
|
||||
// 首次达到某个段位
|
||||
if (curStar + conf.star > curMaxStar) {
|
||||
curMaxStar += conf.star;
|
||||
updata["$inc"] = { "curMaxStar": conf.star };
|
||||
}
|
||||
|
||||
// 段位奖励邮件
|
||||
let title = G.gc.clsl_com.email_dan.title;
|
||||
let content = G.gc.clsl_com.email_dan.content;
|
||||
G.gc.clsl_com.danPrize.forEach(conf => {
|
||||
// 段位未达到 或者 奖励已经发放
|
||||
if (conf.star > curMaxStar || danPrize.includes(conf.star)) {
|
||||
return
|
||||
}
|
||||
|
||||
// 发放邮件
|
||||
EmailFun.addEmail({
|
||||
uid: call.uid,
|
||||
type: 'system',
|
||||
title: title,
|
||||
content: content,
|
||||
prize: conf.prize,
|
||||
contentInsertArr:[conf.title]
|
||||
})
|
||||
|
||||
danPrize.push(conf.star);
|
||||
updata["$set"] = { danPrize: danPrize };
|
||||
})
|
||||
|
||||
|
||||
addStar(call, conf.star, undefined, updata);
|
||||
// clslDb().updateOne({ uid: call.uid, type: 'clsl' }, { $push: { recWinPrize: call.req.index } });
|
||||
|
||||
HongDianChange.sendChangeKey(call.uid, ['clslhd'])
|
||||
|
||||
|
@ -46,13 +46,13 @@
|
||||
},
|
||||
{
|
||||
"key":"pata/SaoDang",
|
||||
"limit":5,
|
||||
"tips":"黑暗塔扫荡次数超过5次"
|
||||
"limit":6,
|
||||
"tips":"黑暗塔扫荡次数超过6次"
|
||||
},
|
||||
{
|
||||
"key":"lingzhulaixi/PkBoss",
|
||||
"limit":15,
|
||||
"tips":"讨伐海盗挑战次数超过15次"
|
||||
"limit":16,
|
||||
"tips":"讨伐海盗挑战次数超过16次"
|
||||
},
|
||||
{
|
||||
"key":"gonghui/FbFight",
|
||||
|
Loading…
Reference in New Issue
Block a user