✨ feat(db): 修改hero表数据库操作方式
This commit is contained in:
@@ -7,17 +7,14 @@ import { SCHOOL } from '../pubUtils/dicParam';
|
||||
import { gameData, getHeroInitTalent, getHeroStarByQuality } from '../pubUtils/data';
|
||||
import { SchoolModel } from '../db/School';
|
||||
import { SclResultInter, SclPosInter, RewardInter, ItemInter } from '../pubUtils/interface';
|
||||
import { Connect, HeroModel, HeroSkin, HeroType, HeroUpdate, Talent } from '../db/Hero';
|
||||
import Hero, { Connect, HeroSkin, HeroType, HeroUpdate, Talent } from '../db/Hero';
|
||||
import { SkinUpdate } from '../db/Skin';
|
||||
import { Figure } from '../domain/dbGeneral';
|
||||
import { pick } from 'underscore';
|
||||
import { Reward } from '../domain/battleField/pvp';
|
||||
import { CheckMeterial } from './role/checkMaterial';
|
||||
import IP2Region from "ip2region";
|
||||
import { getServerCreateTime } from './redisService';
|
||||
import { checkWhiteList } from '../pubUtils/sysUtil';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { ServerlistModel } from '../db/Serverlist';
|
||||
|
||||
const query = new IP2Region({ disableIpv6: true });
|
||||
|
||||
|
||||
@@ -290,7 +287,7 @@ function calSchoolPoint(quality: number, star: number, colorStar: number) {
|
||||
export async function getSchoolPoint(roleId: string) {
|
||||
let schools = await SchoolModel.findByRoleId(roleId);
|
||||
let hids = schools.filter(cur => cur.isOpen && cur.hid > 0).map(school => school.hid);
|
||||
let heroes = await HeroModel.findByHidRange(hids, roleId);
|
||||
let heroes = await Hero.findByHidRange(hids, roleId);
|
||||
return heroes.reduce((pre, cur) => {
|
||||
return pre + calSchoolPoint(cur.quality, cur.star, cur.colorStar);
|
||||
}, 0);
|
||||
|
||||
Reference in New Issue
Block a user