diff --git a/game-server/app/util/routeUtil.ts b/game-server/app/util/routeUtil.ts index e5e99f489..e596d60f3 100644 --- a/game-server/app/util/routeUtil.ts +++ b/game-server/app/util/routeUtil.ts @@ -10,7 +10,7 @@ export function chat(session: Session, msg: any, app: Application, cb: (err: Err return; } - let res = dispatch(session.get('rid'), chatServers); + let res = dispatch(session.get('roleId'), chatServers); cb(null, res.id); } @@ -22,6 +22,6 @@ export function battle(session: Session, msg: any, app: Application, cb: (err: E return; } - let res = dispatch(session.get('rid'), battleServers); + let res = dispatch(session.get('roleId'), battleServers); cb(null, res.id); } \ No newline at end of file diff --git a/shared/db/Sms.ts b/shared/db/Sms.ts index 12afc0c5e..6942c1cb7 100644 --- a/shared/db/Sms.ts +++ b/shared/db/Sms.ts @@ -48,14 +48,15 @@ export default class Sms extends BaseModel { } public async cntLimit(cnt: number) { - console.log('hasSendToday:', this.hasSendToday()); - if (await this.hasSendToday() && this.countToday >= cnt) { + console.log('hasSendToday:', this.hasSendToday(), this.countToday, cnt); + if (this.hasSendToday() && this.countToday >= cnt) { return true; } + this.countToday = 0; return false; } - public async hasSendToday() { + public hasSendToday() { console.log(moment(this.updateTime).format('YYYY-MM-DD'), moment(Date.now()).format('YYYY-MM-DD')); return moment(this.updateTime).format('YYYY-MM-DD') === moment(Date.now()).format('YYYY-MM-DD'); } diff --git a/shared/db/User.ts b/shared/db/User.ts index 028dec31b..a11d7c5e8 100644 --- a/shared/db/User.ts +++ b/shared/db/User.ts @@ -2,7 +2,7 @@ import { COUNTER } from './../consts/consts'; import { CounterModel } from './Counter'; import BaseModel from './BaseModel'; import { index, getModelForClass, prop } from '@typegoose/typegoose'; -import { genCode } from 'app/pubUtils/util'; +import { genCode } from '../pubUtils/util'; /** * 用户字段接口