Revert "✨ feat(db): 修改role表数据库操作方式"

This reverts commit e39af3649288cc5802739cfe862c818fe56e194e.
This commit is contained in:
luying
2023-05-22 19:43:21 +08:00
parent 2d45b2c66c
commit 7bc9e1fe49
79 changed files with 423 additions and 423 deletions
@@ -1,6 +1,6 @@
import { ExpeditionPointModel } from '../db/ExpeditionPoint';
import Role from '../db/Role';
import Role, { RoleModel } from '../db/Role';
import { shouldRefresh, getRandSingleEelm } from '../pubUtils/util';
import { EXPEDITION_WAR_RECORD_STATUS, SYSTEM_OPEN_ID } from '../consts';
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
@@ -19,7 +19,7 @@ import { checkSystemIsOpen } from './roleService';
*/
export async function getExpeditionStatus(roleId: string, roleName: string, isEntry = false) {
// 重置次数
let role = await Role.findByRoleId(roleId);
let role = await RoleModel.findByRoleId(roleId);
if(!role.hasInit) return false;
if(isEntry && !checkSystemIsOpen(role, SYSTEM_OPEN_ID.EXPEDITION)) return false
// 获取远征关卡状态
@@ -132,7 +132,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
let min = myCe * scale * (1 - range/100);
let max = myCe * scale * (1 + range/100);
let resultRange = await Role.findByCeScale(min, max);
let resultRange = await RoleModel.findByCeScale(min, max);
resultRange = resultRange.filter(cur => cur.roleId != roleId);
if(resultRange.length > 0) {
let role = resultRange[0];
@@ -217,7 +217,7 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number,
// 远征匹配系数表
export async function getCEScaleAndRange(roleId: string, curDicExpedition: any) {
// 匹配,判断是不是新手期
const role = await Role.findByRoleId(roleId);
const role = await RoleModel.findByRoleId(roleId);
let isNew = (role.expeditionHistoryResetCnt||0) <= 3;
let scale = isNew?curDicExpedition.CEScaleNew:curDicExpedition.CEScale;
@@ -228,7 +228,7 @@ export async function getCEScaleAndRange(roleId: string, curDicExpedition: any)
// 远征累计点数获取
export async function getPointRewardStatus(roleId: string, role?: Role) {
if(!role) {
role = await Role.findByRoleId(roleId);
role = await RoleModel.findByRoleId(roleId);
}
let {expeditionPoint = 0} = role;
let dicExpeditionPoint = gameData.expeditionPoint;
@@ -252,7 +252,7 @@ export async function getPointRewardStatus(roleId: string, role?: Role) {
export async function getResetRemainCnt(curTime: Date, roleId: string, role?: Role, ) {
if(!role) {
role = await Role.findByRoleId(roleId);
role = await RoleModel.findByRoleId(roleId);
}
let { expeditionResetCnt, expeditionResetRefTime } = role;