数数:埋点

This commit is contained in:
luying
2021-12-14 18:04:00 +08:00
parent b6501ee4a2
commit dd7cf449d6
23 changed files with 357 additions and 72 deletions
+8 -4
View File
@@ -1,5 +1,5 @@
import { COUNTER, DEFAULT_LV, ADULT_AGE, GUEST_MAX_TIME, TASK_TYPE } from '@consts';
import { COUNTER, DEFAULT_LV, ADULT_AGE, GUEST_MAX_TIME, TASK_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';
@@ -389,9 +389,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;
const ip = ctx.request.ip;
@@ -405,9 +405,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, ip);
if(isCreate) {
ctx.service.sdk.reportTAEventWithDistinctId(distinctId, TA_EVENT.REGISTER, null, ip);
}
if (getuiCID) {//更新个推cid
await UserModel.updateGetuiCIDByChannel(channelId, getuiCID);
}