审核服:跳过序章
This commit is contained in:
@@ -272,7 +272,6 @@ export class GmRoleHandler {
|
||||
let exp = 0;
|
||||
for(let i = 101; i <= 103; i++) {
|
||||
let dicWar = gameData.war.get(i);
|
||||
await RScriptRecordModel.insertScripts(roleId, insertParams);
|
||||
insertParams.push(dicWar);
|
||||
warStars.push({ id: dicWar.war_id, warType: dicWar.warType, star: 0, stars: [] });
|
||||
exp += dicWar.kingExp;
|
||||
|
||||
@@ -48,12 +48,12 @@ export default class RScriptRecord extends BaseModel {
|
||||
return await RScriptRecordModel.deleteMany({ roleId, battleId: { $in: battleId } });
|
||||
}
|
||||
|
||||
public static async insertScripts(roleId: string, dicWars: DicWar[]) {
|
||||
public static async insertScripts(roleId: string, dicWars: DicWar[], skipScriptAfter = []) {
|
||||
let insertParams = dicWars.map(dicWar => {
|
||||
let doc = new RScriptRecordModel();
|
||||
let param = { ...doc.toJSON(), roleId, battleId: dicWar.war_id, warType: dicWar.warType }
|
||||
if(dicWar.scriptBefore) param.scriptBefore = dicWar.scriptBefore;
|
||||
if(dicWar.scriptAfter) param.scriptAfter = dicWar.scriptAfter;
|
||||
if(dicWar.scriptAfter && skipScriptAfter.indexOf(dicWar.war_id) == -1) param.scriptAfter = dicWar.scriptAfter;
|
||||
return param;
|
||||
});
|
||||
// console.log('&&&&', insertParams
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
|
||||
import { COUNTER, DEFAULT_LV, ADULT_AGE, GUEST_MAX_TIME, BLOCK_TYPE } from '@consts';
|
||||
import { RoleModel } from '@db/Role';
|
||||
import { RoleModel, WarStar } from '@db/Role';
|
||||
import { UserModel, UserType } from '@db/User';
|
||||
import { STATUS, GET_SMS_TYPE, ADDICTION_PREVENTION_CODE } from '@consts';
|
||||
import { smsModel } from '@db/Sms';
|
||||
import { Service } from 'egg';
|
||||
import Counter from '@db/Counter';
|
||||
import { getExpByLv } from '../pubUtils/data';
|
||||
import { gameData, getExpByLv } from '../pubUtils/data';
|
||||
import { isString } from 'underscore';
|
||||
import { getAge, nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { resResult } from '../pubUtils/util';
|
||||
@@ -15,6 +15,8 @@ import { checkTeeanAgerTime } from '../pubUtils/authenticateUtil';
|
||||
import { getChannelId, loginValidata } from '../pubUtils/sdkUtil';
|
||||
import { LoginValidateData37 } from 'app/domain/sdk';
|
||||
import { ServerlistModel } from '@db/Serverlist';
|
||||
import { DicWar } from 'app/pubUtils/dictionary/DicWar';
|
||||
import { RScriptRecordModel } from '@db/RScriptRecord';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -332,11 +334,27 @@ export default class Auth extends Service {
|
||||
const role = await RoleModel.createRole(uid, serverId, { roleId, code, roleName: "默认玩家名", seqId, lv: DEFAULT_LV, exp: (getExpByLv(DEFAULT_LV - 1) || { sum: 0 }).sum || 0 }, distinctId);
|
||||
if (role) {
|
||||
await ServerlistModel.incRoleCnt(serverId);
|
||||
if(server.isReview) { // 审核服跳关卡
|
||||
await this.skipPrologueWhenReview(roleId);
|
||||
}
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, { roleId: role.roleId });
|
||||
}
|
||||
return ctx.service.utils.resResult(STATUS.ROLE_NOT_FOUND);
|
||||
}
|
||||
|
||||
private async skipPrologueWhenReview(roleId: string) {
|
||||
const fromWarId = 101, toWarId = 103;
|
||||
let warStars: WarStar[] = [];
|
||||
let insertParams: DicWar[] = [];
|
||||
for(let i = fromWarId; i <= toWarId; i++) {
|
||||
let dicWar = gameData.war.get(i);
|
||||
insertParams.push(dicWar);
|
||||
if(i < toWarId) warStars.push({ id: dicWar.war_id, warType: dicWar.warType, star: 0, stars: [] });
|
||||
}
|
||||
await RScriptRecordModel.insertScripts(roleId, insertParams, [toWarId]);
|
||||
await RoleModel.updateRoleInfo(roleId, { warStar: warStars, mainWarId: toWarId - 1 })
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定账号
|
||||
* @param tel 手机号
|
||||
|
||||
Reference in New Issue
Block a user