✨ feat(gvg): 便捷管理页面
This commit is contained in:
@@ -207,4 +207,6 @@ export const PUSH_ROUTE = {
|
||||
GVG_CITY_RANK_UPDATE: 'onGVGCityRankUpdate', // 城池积分排名
|
||||
GVG_SPINE_ATTACKED: 'onSpinesAttacked', // 4.7 队伍在地图上受到攻击
|
||||
GVG_CONTRIBUTE_UPDATE: 'onGVGContributeUpdate', // 贡献更新
|
||||
GVG_TARGET_CITY_UPDATE: 'onGVGTargetCitiesUpdate', // 目标城池更新
|
||||
GVG_NOTICE_UPDATE: 'onGVGNoticeUpdate', // 管理信息更新
|
||||
}
|
||||
@@ -36,6 +36,8 @@ export enum LEAGUE_MANAGE_TYPE {
|
||||
SEND_MAIL = 10, // 发邮件
|
||||
UNLOCK_TECH = 11, // 解锁科技树
|
||||
ACTIVATE_TECH = 12, // 激活
|
||||
SET_TARGET_CITY = 13, // 设定目标城池
|
||||
SET_NOTICE = 14, // 设置管理通知
|
||||
}
|
||||
|
||||
export enum LEAGUE_JOB {
|
||||
|
||||
@@ -392,6 +392,8 @@ export const STATUS = {
|
||||
GVG_BATTLE_TEAM_LOCK_ENTERY_CITY: { code: 21424, simStr: '正在有玩家挑战您,请稍后切换城池' },
|
||||
GVG_POINT_TYPE_ERR: { code: 21425, simStr: '该积分点不可驻守' },
|
||||
GVG_ROBOT_DEFENSEING: { code: 21426, simStr: '该守卫正在与其他玩家战斗' },
|
||||
GVG_TARGET_CITY_HAS_SET: { code: 21427, simStr: '这个城池已设为目标' },
|
||||
GVG_TARGET_CITY_CNT_MAX: { code: 21428, simStr: '目标城池数量已达上限' },
|
||||
|
||||
// 通用 30000 - 30099
|
||||
DIC_DATA_NOT_FOUND: { code: 30000, simStr: '数据表未找到' },
|
||||
|
||||
@@ -86,6 +86,12 @@ export default class GVGLeaguePrepare extends BaseModel {
|
||||
@prop({ required: true, default: [], type: GuildActive, _id: false })
|
||||
guildActive: GuildActive[]; // 军团活跃
|
||||
|
||||
@prop({ required: true, default: [], type: Number })
|
||||
targetCities: number[]; // 目标城池
|
||||
|
||||
@prop({ required: true, default: '' })
|
||||
notice: string; // 公告
|
||||
|
||||
public static async initData(configId: number, groupKey: string, leagueCode: string, maxMemberCnt: number) {
|
||||
const doc = new GVGLeaguePrepareModel();
|
||||
const update = Object.assign(doc.toJSON(), { maxMemberCnt });
|
||||
@@ -166,6 +172,21 @@ export default class GVGLeaguePrepare extends BaseModel {
|
||||
const result: GVGLeaguePrepareType[] = await GVGLeaguePrepareModel.find({ configId, groupKey }).sort({ lv: -1 }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async setTargetCity(configId: number, leagueCode: string, cityId: number) {
|
||||
const result: GVGLeaguePrepareType = await GVGLeaguePrepareModel.findOneAndUpdate({ configId, leagueCode }, { $push: { targetCities: cityId } }, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async cancelTargetCity(configId: number, leagueCode: string, cityId: number) {
|
||||
const result: GVGLeaguePrepareType = await GVGLeaguePrepareModel.findOneAndUpdate({ configId, leagueCode }, { $pull: { targetCities: cityId } }, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async setNotice(configId: number, leagueCode: string, notice: string) {
|
||||
const result: GVGLeaguePrepareType = await GVGLeaguePrepareModel.findOneAndUpdate({ configId, leagueCode }, { $set: { notice } }, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export const GVGLeaguePrepareModel = getModelForClass(GVGLeaguePrepare);
|
||||
|
||||
Reference in New Issue
Block a user