数数:埋点

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
@@ -4,7 +4,7 @@ import Role, { RoleModel, RoleType } from '../db/Role'
import { getLvByExp, getExpByLv, gameData, getDicApByLv } from '../pubUtils/data';
import { updateUserInfo } from './redisService';
// import { switchOnFunc } from './funcSwitchService';
import { FUNC_OPT_TYPE, TASK_TYPE, WAR_TYPE, STATUS, KING_EXP_RATIO_TYPE } from '../consts';
import { FUNC_OPT_TYPE, TASK_TYPE, WAR_TYPE, STATUS, KING_EXP_RATIO_TYPE, ITEM_CHANGE_REASON } from '../consts';
import { BackendSession, pinus } from 'pinus';
import { REDIS_KEY } from '../consts';
import { Rank } from './rankService';
@@ -20,6 +20,7 @@ import { uniq } from 'underscore';
export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kingExp: number = 0, session: BackendSession) {
const serverId = session.get('serverId');
const sid = session.get('sid');
const ip = session.get('ip');
let role = await RoleModel.findByRoleId(roleId);
let { lv = 1, exp = 0 } = role;
@@ -67,7 +68,7 @@ export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kin
});
if(i != lv) { // 升级加体力
let dicAp = getDicApByLv(i);
await setAp(roleId, i, dicAp.restoreAp, sid);
await setAp(roleId, ip, i, dicAp.restoreAp, sid, ITEM_CHANGE_REASON.LV_UP);
}
}
// 推送