活动:清理数据

This commit is contained in:
陆莹
2022-03-21 19:50:46 +08:00
parent 1c3d1c209c
commit 4f5edb7386
60 changed files with 1447 additions and 1076 deletions
@@ -4,7 +4,7 @@
import { ActionPointModel, ActionPointType } from '../db/ActionPoint';
import { TASK_TYPE, STATUS, TA_EVENT, ITEM_CHANGE_REASON } from '../consts';
import { checkActivityTask, checkTask } from './task/taskService';
import { checkTask } from './task/taskService';
import { getDicApByLv } from '../pubUtils/data';
import { pinus } from 'pinus';
import { resResult, shouldRefresh } from '../pubUtils/util';
@@ -68,7 +68,7 @@ function getApWithDataAp(roleId: string, ip: string, lv: number, dataAp: ActionP
* @param changeAp 体力变化,正是加,负是减
* @param sid
*/
export async function setAp(roleId: string, ip: string, lv: number, changeAp: number, sid: string, reason: ITEM_CHANGE_REASON) {
export async function setAp(serverId: number, roleId: string, ip: string, lv: number, changeAp: number, sid: string, reason: ITEM_CHANGE_REASON) {
// console.log('***** setAp', roleId, ip, lv, changeAp)
const now = Date.now();
const dicAp = getDicApByLv(lv);
@@ -89,9 +89,7 @@ export async function setAp(roleId: string, ip: string, lv: number, changeAp: nu
}
if (changeAp < 0) {
await checkTask(roleId, sid, TASK_TYPE.BATTLE_COST_AP, -1 * changeAp, true, {});
let { serverId } = await RoleModel.findByRoleId(roleId);
await checkActivityTask(serverId, sid, roleId, TASK_TYPE.BATTLE_COST_AP, -1 * changeAp,);
await checkTask(serverId, roleId, sid, TASK_TYPE.BATTLE_COST_AP, { count: -changeAp });
// reportTAEvent(roleId, TA_EVENT.AP_CONSUME, { change_count: -1 * changeAp, change_after: ap, change_reason: reason }, ip)
} else {
reportTAEvent(roleId, TA_EVENT.AP_GET, { change_count: changeAp, change_after: ap, change_reason: reason }, ip)