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

This reverts commit e39af3649288cc5802739cfe862c818fe56e194e.
This commit is contained in:
luying
2023-05-08 10:01:05 +08:00
parent 2d45b2c66c
commit 7bc9e1fe49
79 changed files with 423 additions and 423 deletions

View File

@@ -4,10 +4,10 @@ import { difference, pick } from 'underscore';
* @Author: 梁桐川
* @Date: 2020-11-30 15:05:48
* @Last Modified by: 梁桐川
* @Last Modified time: 2023-05-06 15:26:55
* @Last Modified time: 2021-08-27 17:47:56
*/
import { IT_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, COM_TEAM_STATUS, COM_BTL_CONST, CONSUME_TYPE, MSG_SOURCE, ROLE_SELECT, TASK_TYPE, KING_EXP_RATIO_TYPE, ITEM_CHANGE_REASON, getChannelType, CHANNEL_PREFIX, DEBUG_MAGIC_WORD, PUSH_ROUTE, POPULATE_TYPE } from '../../../consts';
import Role from '../../../db/Role';
import Role, { RoleModel } from '../../../db/Role';
import { STATUS } from '../../../consts/statusCode';
import { Application, BackendSession } from 'pinus';
import { resResult, getRandSingleEelm, cal } from '../../../pubUtils/util';
@@ -59,7 +59,7 @@ export class ComBattleHandler {
const enoughBlueprt = await hasEnoughBlueprt(roleId, sid, blueprtId);
if (!enoughBlueprt) return resResult(STATUS.COM_BATTLE_BLUEPRT_NOT_ENOUGH);
const roleInfo = await Role.findByRoleId(roleId, null, true);
const roleInfo = await RoleModel.findByRoleId(roleId, null, true);
const { lv, topLineupCe } = roleInfo;
if (lv < COM_BTL_CONST.ENABLE_LV) return resResult(STATUS.COM_BATTLE_LV_NOT_ENOUGH);
if(ceLimit && ceLimit > topLineupCe * (1 + COM_BTL_CONST.ROBOT_CE_RATIO)) {
@@ -102,7 +102,7 @@ export class ComBattleHandler {
let roleId = session.get('roleId');
let sid = session.get('sid');
const { lv: lvs = [], magicWord } = msg;
const roleInfo = await Role.findByRoleId(roleId, null, true);
const roleInfo = await RoleModel.findByRoleId(roleId, null, true);
const { lv: playerLv } = roleInfo;
let { topLineupCe = 1000 } = roleInfo;
@@ -717,7 +717,7 @@ export class ComBattleHandler {
let teamStatus = getComTeamByCode(teamCode);
if(!teamStatus) return resResult(STATUS.WRONG_PARMS);
let role = await Role.findByRoleId(targetRoleId, 'lv');
let role = await RoleModel.findByRoleId(targetRoleId, 'lv');
if(comBtlLvInvalid(role.lv, [teamStatus.lv])) {
return resResult(STATUS.COM_BATTLE_INVITE_LV_NOT_ENOUGH);
}
@@ -754,7 +754,7 @@ export class ComBattleHandler {
if(r != roleId) roleIdList.push(r);
}
}
const roles = await Role.findByRoleIds(roleIdList, ROLE_SELECT.SHOW_SIMPLE, true);
const roles = await RoleModel.findByRoleIds(roleIdList, ROLE_SELECT.SHOW_SIMPLE, true);
let result = new Array<FriendParams>();
for(let role of roles) {
if(role.quitTime == role.loginTime) {
@@ -769,14 +769,14 @@ export class ComBattleHandler {
async getTeamInvitation(msg: { }, session: BackendSession) {
let roleId = session.get('roleId');
let guildCode = session.get('guildCode');
let role = await Role.findByRoleId(roleId, 'lv topLineupCe');
let role = await RoleModel.findByRoleId(roleId, 'lv topLineupCe');
const assistCnt = await getAllAssistCnt(roleId);
let { minLv, maxLv } = getComBtlLvByPlayerLv(role.lv);
let refreshTime = nowSeconds() - INFO_WINDOW.TEAM_INFORMATION_TIME;
const invitations = await ComBattleTeamModel.findInvitations(roleId, guildCode, minLv, maxLv, role.topLineupCe, refreshTime, INFO_WINDOW.TEAM_VIEW);
let roleIds = invitations.map(cur => cur.capId);
let roles = await Role.findByRoleIds(roleIds);
let roles = await RoleModel.findByRoleIds(roleIds);
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
const teams: ComBattleInvitation[] = [];
for(let invitation of invitations) {
@@ -810,7 +810,7 @@ export class ComBattleHandler {
if (magicWord !== DEBUG_MAGIC_WORD) {
return resResult(STATUS.TOKEN_ERR);
}
let role = await Role.updateRoleInfo(roleId, { lv: targetLv });
let role = await RoleModel.updateRoleInfo(roleId, { lv: targetLv });
return resResult(STATUS.SUCCESS, { lv: role.lv, roleId });
}