Merge branch 'master' into feature/backend

# Conflicts:
#	game-server/app/servers/connector/handler/entryHandler.ts
#	game-server/app/servers/role/handler/itemHandler.ts
#	shared/consts/constModules/sysConst.ts
#	shared/pubUtils/util.ts
#	web-server/app.ts
#	web-server/app/service/Auth.ts
This commit is contained in:
luying
2021-12-14 18:08:44 +08:00
98 changed files with 10245 additions and 4858 deletions
+8 -4
View File
@@ -1,5 +1,5 @@
import { COUNTER, DEFAULT_LV, ADULT_AGE, GUEST_MAX_TIME, TASK_TYPE, BLOCK_TYPE } from '@consts';
import { COUNTER, DEFAULT_LV, ADULT_AGE, GUEST_MAX_TIME, TASK_TYPE, BLOCK_TYPE, TA_EVENT } from '@consts';
import { RoleModel } from '@db/Role';
import { UserModel, UserType } from '@db/User';
import { STATUS, GET_SMS_TYPE, ADDICTION_PREVENTION_CODE } from '@consts';
@@ -396,9 +396,9 @@ export default class Auth extends Service {
* @returns
*/
public async channelLogin(params: {
channelType: string, pst: string, clientId: string, deviceId: string, platform: string, platformAppid: string, childGameId: number, pkgName: string, serverType: string, getuiCID: string
channelType: string, pst: string, clientId: string, deviceId: string, platform: string, platformAppid: string, childGameId: number, pkgName: string, serverType: string, getuiCID: string, distinctId: string
}) {
const { channelType, pst, clientId, deviceId, platform, platformAppid, childGameId, pkgName, serverType, getuiCID } = params;
const { channelType, pst, clientId, deviceId, platform, platformAppid, childGameId, pkgName, serverType, getuiCID, distinctId } = params;
const ctx = this.ctx;
@@ -411,9 +411,13 @@ export default class Auth extends Service {
let channelId = getChannelId(channelType, requestResult.data.uid);
const token = ctx.service.utils.generateStr(256);
let user = await UserModel.createOrUpdateChannelUser(channelId, channelType, {
let { isCreate, user} = await UserModel.createOrUpdateChannelUser(channelId, channelType, {
...requestResult.data, childGameId, platformAppid
}, token, platform, pkgName, serverType, deviceId, ctx.clientIp);
if(isCreate) {
ctx.service.sdk.reportTAEventWithDistinctId(distinctId, TA_EVENT.REGISTER, null, ctx.clientIp);
}
if (getuiCID) {//更新个推cid
await UserModel.updateGetuiCIDByChannel(channelId, getuiCID);
}
+25 -1
View File
@@ -242,7 +242,7 @@ export default class Sdk extends Service {
return {
dsid: server.id,
dsname: server.name,
start_time: moment(server.openTime, 'YYYY-MM-DD HH:mm:ss'),
start_time: moment(server.openTime).format('YYYY-MM-DD HH:mm:ss'),
statue
}
})
@@ -253,4 +253,28 @@ export default class Sdk extends Service {
msg: '成功'
}
}
public reportTAEventWithDistinctId(distinctId: string, eventName: string, properties: any, ip: string) {
let ta = this.app.context.ta;
let event = {
// 账号 ID (可选)
accountId: "",
// 访客 ID (可选),账号 ID 和访客 ID 不可以都为空
distinctId: `${distinctId}`,
// 事件名称 (必填)
event: eventName,
// 事件时间 (可选) 如果不填,将以调用接口时的时间作为事件时间
time: new Date(),
// 事件 IP (可选) 当传入 IP 地址时,后台可以解析所在地
ip: ip,
// 事件属性 (可选)
properties,
callback(err) {
console.log('*****测试接入事件', err)
}
};
ta.track(event);
}
}