🐞 fix(共鸣): 接口优化
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user