Revert "✨ feat(db): 修改role表数据库操作方式"
This reverts commit e39af3649288cc5802739cfe862c818fe56e194e.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import { resResult, shouldRefresh, } from '../pubUtils/util';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import Role, { RoleType, WarStar } from '../db/Role';
|
||||
import { RoleModel, RoleType, WarStar } from '../db/Role';
|
||||
import * as dicParam from '../pubUtils/dicParam';
|
||||
import { RankParam } from '../domain/rank';
|
||||
import { BattleRecordType } from '../db/BattleRecord';
|
||||
@@ -41,7 +41,7 @@ function isFirstPass(warStar: WarStar[], warId: number) {
|
||||
|
||||
// 检查秘境本次数checkBattle使用
|
||||
export async function checkDungeonNum(roleId: string, inc: number, warId: number) {
|
||||
let { dungeonCnt = 0, dungeonBuyCnt = 0, dungeonRefTime, vipStartTime, warStar } = await Role.findByRoleId(roleId);
|
||||
let { dungeonCnt = 0, dungeonBuyCnt = 0, dungeonRefTime, vipStartTime, warStar } = await RoleModel.findByRoleId(roleId);
|
||||
if(isFirstPass(warStar, warId)) inc = 0;
|
||||
|
||||
let curTime = new Date();
|
||||
@@ -53,7 +53,7 @@ export async function checkDungeonNum(roleId: string, inc: number, warId: number
|
||||
if(dungeonCnt + inc > freeCount + dungeonBuyCnt) {
|
||||
return {status: -1, resResult: resResult(STATUS.DUNGEON_TIMES_LACK)}
|
||||
}
|
||||
await Role.increaseDungeonCnt(roleId, needRefresh, 0, curTime);
|
||||
await RoleModel.increaseDungeonCnt(roleId, needRefresh, 0, curTime);
|
||||
|
||||
return { status: 0, data: {
|
||||
battleCount: freeCount + dungeonBuyCnt - dungeonCnt,
|
||||
@@ -70,7 +70,7 @@ export async function checkDungeonNum(roleId: string, inc: number, warId: number
|
||||
|
||||
export async function checkDungeonAndIncrease(roleId: string, inc: number, isRef: boolean, warId: number) {
|
||||
|
||||
let { dungeonCnt = 0, dungeonBuyCnt = 0, dungeonRefTime, vipStartTime, warStar } = await Role.findByRoleId(roleId);
|
||||
let { dungeonCnt = 0, dungeonBuyCnt = 0, dungeonRefTime, vipStartTime, warStar } = await RoleModel.findByRoleId(roleId);
|
||||
if(isFirstPass(warStar, warId)) inc = 0;
|
||||
let curTime = new Date();
|
||||
|
||||
@@ -84,7 +84,7 @@ export async function checkDungeonAndIncrease(roleId: string, inc: number, isRef
|
||||
return { status: -1, resResult: resResult(STATUS.DUNGEON_TIMES_LACK) }
|
||||
}
|
||||
// console.log('needRefresh', needRefresh);
|
||||
await Role.increaseDungeonCnt(roleId, needRefresh, inc, curTime);
|
||||
await RoleModel.increaseDungeonCnt(roleId, needRefresh, inc, curTime);
|
||||
return {status: 1, data: {
|
||||
battleCount: freeCount + dungeonBuyCnt - dungeonCnt - inc,
|
||||
buyCount: dicParam.DUNGEON_CONST.DUNGEON_CONST_BUY - dungeonBuyCnt
|
||||
|
||||
Reference in New Issue
Block a user