添加漏提交的代码
处理老用户缺 towerLv 字段问题
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { HANG_UP_CONSTS } from './../../../../../shared/consts/consts';
|
||||
// import { HANG_UP_CONSTS } from './../../../consts/consts';
|
||||
import { HangUpRecordModel } from './../../../db/HangUpRecord';
|
||||
import { RoleModel } from './../../../db/Role';
|
||||
import { TowerRecordModel } from './../../../../../shared/db/TowerRecord';
|
||||
import { TowerRecordModel } from './../../../db/TowerRecord';
|
||||
import { Application, BackendSession } from 'pinus';
|
||||
import { getTowerDataByLv } from '../../../util/gamedata';
|
||||
import { decodeArrayStr, decodeIdCntArrayStr } from '../../../util/util';
|
||||
@@ -23,8 +23,14 @@ export class TowerBattleHandler {
|
||||
async getStatus(msg: {}, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let { towerLv } = await RoleModel.findByRoleId(roleId);
|
||||
if (!towerLv) {
|
||||
towerLv = 1;
|
||||
await RoleModel.towerLvUp(roleId);
|
||||
}
|
||||
let towerRec = await TowerRecordModel.getRecordByLv(roleId, towerLv);
|
||||
console.log(roleId, towerLv, towerRec);
|
||||
if (!towerRec) {
|
||||
// await TowerRecordModel.createRecord({roleId, lv: towerLv, warStatus: []});
|
||||
return { code: 201, data: '天梯记录异常' };
|
||||
}
|
||||
const data = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { HangUpRecordModel } from './../../../shared/db/HangUpRecord';
|
||||
import { HangUpRecordModel } from './../db/HangUpRecord';
|
||||
import { ChannelService } from 'pinus';
|
||||
import { HANG_UP_CONSTS } from './../consts/consts';
|
||||
import { BattleRecordModel } from './../../../gm-server/app/db/BattleRecord';
|
||||
import { TowerRecordModel } from './../../../shared/db/TowerRecord';
|
||||
import { BattleRecordModel } from './../db/BattleRecord';
|
||||
import { TowerRecordModel } from './../db/TowerRecord';
|
||||
import { RoleModel } from './../db/Role';
|
||||
import { getTowerDataByLv } from "../util/gamedata"
|
||||
import { decodeArrayStr } from '../util/util';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BATTLE_REWARD_TYPE, GOOD_TYPE } from './../../../shared/consts/consts';
|
||||
import { BATTLE_REWARD_TYPE, GOOD_TYPE } from './../consts/consts';
|
||||
import { EquipModel } from './../db/Equip';
|
||||
import { CounterModel } from './../db/Counter';
|
||||
import { decodeStr } from '../util/util';
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#!/bin/sh
|
||||
#if [ $# != 1 ] ; then
|
||||
# echo "需要1个参数"
|
||||
# echo "pro: 同步代码到 pro 服务器上,作为正式服使用"
|
||||
# echo "dev: 同步代码到 dev 服务器上,作为测试服供服务开发使用"
|
||||
# exit 1;
|
||||
#fi
|
||||
#
|
||||
#if [ ${1} == 'pro' ] ; then
|
||||
# destUrl="root@zyz:/root/zyz/"
|
||||
#elif [ ${1} == 'dev' ] ; then
|
||||
if [ $# != 1 ] ; then
|
||||
echo "需要1个参数"
|
||||
echo "pro: 同步代码到 pro 服务器上,作为正式服使用"
|
||||
echo "dev: 同步代码到 dev 服务器上,作为测试服供服务开发使用"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ ${1} == 'pro' ] ; then
|
||||
destUrl="root@zyz:/root/zyz/"
|
||||
elif [ ${1} == 'dev' ] ; then
|
||||
destUrl="root@zyztest:/root/zyz/"
|
||||
#else
|
||||
# echo "需要一个参数指明服务器"
|
||||
# exit 1;
|
||||
#fi
|
||||
else
|
||||
echo "需要一个参数指明服务器"
|
||||
exit 1;
|
||||
fi
|
||||
rsync -av --include '.babelrc' --include '.eslintrc.js' --exclude '.*' --exclude './game-server/node_modules' --exclude './game-server/node_modules' --exclude 'node_modules' --exclude 'bower_components' --exclude 'dist' --progress --inplace --no-owner --no-group --rsh='ssh -p22' . ${destUrl}
|
||||
|
||||
@@ -133,7 +133,7 @@ export default class Role extends BaseModel {
|
||||
|
||||
|
||||
public static async setEventStatus(roleId: string, eventStatus: number, lean = true) {
|
||||
const role = await RoleModel.findOneAndUpdate({ roleId }, { eventStatus }).lean(lean);
|
||||
await RoleModel.findOneAndUpdate({ roleId }, { eventStatus }).lean(lean);
|
||||
}
|
||||
|
||||
public static async towerLvUp(roleId: string, lean = true) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { RoleModel } from './Role';
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop } from '@typegoose/typegoose';
|
||||
import { stringify } from 'querystring';
|
||||
|
||||
class WarStatus {
|
||||
@prop({ required: true })
|
||||
|
||||
Reference in New Issue
Block a user