🐞 fix(共鸣): 接口优化

This commit is contained in:
zhangxk
2023-10-20 20:24:14 +08:00
parent 9644ea69c3
commit 4ef6e558d2
4 changed files with 109 additions and 134 deletions

View File

@@ -22,24 +22,33 @@ export class HeroHandler {
constructor(private app: Application) {
}
/**
* 获取最新数据(会刷新)
* @param msg
* @param session
* @returns
*/
async getData(msg: {}, session: BackendSession) {
const roleId: string = session.get('roleId');
const sid: string = session.get('sid');
const serverId: number = session.get('serverId');
// if (!await getStartLimt(roleId)) return resResult(STATUS.RESONANCE_NO_START);
const resonances = await refreshResonanceData(roleId, serverId, sid);
return resResult(STATUS.SUCCESS, resonances)
}
/**
* 解锁阵位
* @param msg
* @param session
* @returns
*/
async unlockPosition(msg: { position: number }, session: BackendSession) {
const { position } = msg;
const roleId: string = session.get('roleId');
const sid: string = session.get('sid');
// if (!await getStartLimt(roleId)) return resResult(STATUS.RESONANCE_NO_START);
let dbResonance = await ResonanceModel.findByPosition(roleId, position);
if (dbResonance) return resResult(STATUS.RESONANCE_POSITION_LOCK);
@@ -59,6 +68,12 @@ export class HeroHandler {
return resResult(STATUS.SUCCESS, { position: result.position });
}
/**
* 武将上阵
* @param msg
* @param session
* @returns
*/
async heroPutPosition(msg: { position: number, hid: number }, session: BackendSession) {
const { position, hid } = msg;
const roleId: string = session.get('roleId');
@@ -108,6 +123,12 @@ export class HeroHandler {
return resResult(STATUS.SUCCESS, resonances)
}
/**
* 武将下阵
* @param msg
* @param session
* @returns
*/
async heroOffPosition(msg: { position: number, hid: number }, session: BackendSession) {
const { position, hid } = msg;
const roleId: string = session.get('roleId');