后台:礼包码区分渠道

This commit is contained in:
luying
2022-04-09 15:20:04 +08:00
parent a23759335e
commit 6b13034c62
9 changed files with 24 additions and 15 deletions
@@ -1,6 +1,6 @@
import { STATUS } from './../../../consts/statusCode';
import { RoleModel, RoleType } from './../../../db/Role';
import { UserModel } from '../../../db/User';
import { UserModel, UserType } from '../../../db/User';
import { GMUserModel } from '../../../db/GMUser';
import { Application, HandlerService, pinus, } from 'pinus';
import { FrontendSession } from 'pinus';
@@ -68,7 +68,7 @@ export class EntryHandler {
}
let serverName = this.app.getServerId();
await roleLogin(role.roleId, user.userCode, serverName, user.pkgName, role.createTime); // 保存在线用户
await this.addSession(role, session);
await this.addSession(user, role, session);
saveLoginAndOutLog(LOG_TYPE.LOGIN, session);
addRoleToSysChannel(role.roleId, self.app.get('serverId'), role.serverId);
@@ -99,7 +99,7 @@ export class EntryHandler {
return resResult(STATUS.SUCCESS, { todayZeroPoint });
}
async addSession(role: RoleType, session: FrontendSession) {
async addSession(user: UserType, role: RoleType, session: FrontendSession) {
const self = this;
let ip = session.remoteAddress.ip.replace('::ffff:', '');
@@ -115,6 +115,7 @@ export class EntryHandler {
session.set('guildCode', role.guildCode);
session.set('ip', ip);
session.set('vipStartTime', role.vipStartTime||0);
session.set('channel', user.channelInfo?.platformAppid||'pc');
session.push('userid', () => { });
session.push('sid', () => { });
session.push('roleId', () => { });
@@ -126,6 +127,7 @@ export class EntryHandler {
session.push('blockType', () => { });
session.push('ip', () => { });
session.push('vipStartTime', () => { });
session.push('channel', () => { });
// console.log(role.guildCode)
// session.push('rid', function (err) {
// if (err) {