728 lines
18 KiB
JavaScript
728 lines
18 KiB
JavaScript
const GuildService = require("../guildService");
|
|
const Code = require("../../../lib/code");
|
|
const { errors } = require("../../../lib/db");
|
|
|
|
module.exports = function (app) {
|
|
return new Handler(app);
|
|
};
|
|
|
|
class Handler {
|
|
constructor(app) {
|
|
this.guildService = new GuildService(app);
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.listGuild listGuild 获取工会列表
|
|
* @apiGroup Guild
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {Object[]} guilds 工会列表
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "guilds": [
|
|
* {
|
|
* "idx": 1,
|
|
* "gname": "guild_1", // 工会名称 (String(48))
|
|
* "logo": "logo_1", // 工会logo (String(32))
|
|
* "gowner": "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", // 工会创建者ID (String(64))
|
|
* "gownername": "owner_1", // 工会创建者名称 (String(32))
|
|
* "gmaxmember": 100, // 工会最大成员数 (Number)
|
|
* "countmember": 1 // 工会成员数 (Number)
|
|
* }
|
|
* ]
|
|
* }
|
|
*/
|
|
async listGuild(msg, session, next) {
|
|
const guilds = (await this.guildService.listGuild()) || [];
|
|
next(null, { code: Code.OK, guilds });
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.searchGuild searchGuild 搜索工会
|
|
* @apiGroup Guild
|
|
*
|
|
* @apiParam {String} guildName 工会名称
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {Object[]} guilds 工会列表
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "guilds": [
|
|
* {
|
|
* "idx": 1,
|
|
* "gname": "guild_1", // 工会名称 (String(48))
|
|
* "logo": "logo_1", // 工会logo (String(32))
|
|
* "gowner": "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", // 工会创建者ID (String(64))
|
|
* "gownername": "owner_1", // 工会创建者名称 (String(32))
|
|
* "gmaxmember": 100, // 工会最大成员数 (Number)
|
|
* "countmember": 1 // 工会成员数 (Number)
|
|
* }
|
|
* ]
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 4001,
|
|
* "msg": "Failed to search guild."
|
|
* }
|
|
*
|
|
*/
|
|
async searchGuild({ guildName }, session, next) {
|
|
try {
|
|
const guilds = (await this.guildService.searchGuild(guildName)) || [];
|
|
next(null, { code: Code.OK, guilds });
|
|
} catch (err) {
|
|
next(null, { code: Code.FAIL, msg: "Failed to search guild." });
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.getGuildInfoByUID getGuildInfoByUID 获取工会信息
|
|
* @apiGroup Guild
|
|
*
|
|
* @apiParam {String} uid 用户ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {Object} guildInfo 工会信息
|
|
*
|
|
* @apiSuccessExample {json} 200:
|
|
* {
|
|
* "code": 200,
|
|
* "guildInfo": {
|
|
* "idx": 1,
|
|
* "gname": "guild_1", // 工会名称 (String(48))
|
|
* "logo": "logo_1", // 工会logo (String(32))
|
|
* "gowner": "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", // 工会创建者ID (String(64))
|
|
* "gownername": "owner_1", // 工会创建者名称 (String(32))
|
|
* "gmaxmember": 100, // 工会最大成员数 (Number)
|
|
* "countmember": 1 // 工会成员数 (Number)
|
|
* }
|
|
* }
|
|
*
|
|
* @apiSuccessExample {json} 200: no guild.
|
|
* {
|
|
* "code": 200,
|
|
* "guildInfo": null,
|
|
* "msg": "You haven't joined any guild yet."
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} 500:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Failed to get guild info."
|
|
* }
|
|
*
|
|
*/
|
|
async getGuildInfoByUID({ uid }, session, next) {
|
|
try {
|
|
const guildInfo = await this.guildService.getGuildInfoByUID(uid);
|
|
if (guildInfo) {
|
|
next(null, { code: Code.OK, guildInfo });
|
|
} else {
|
|
next(null, {
|
|
code: Code.OK,
|
|
guildInfo: null,
|
|
msg: "You haven't joined any guild yet.",
|
|
});
|
|
}
|
|
} catch (err) {
|
|
next(null, { code: Code.FAIL, msg: "Failed to get guild info." });
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.getGuildInfo getGuildInfo 获取工会信息
|
|
* @apiGroup Guild
|
|
*
|
|
* @apiParam {String} guildId 工会ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {Object} guildInfo 工会信息
|
|
*
|
|
* @apiSuccessExample {json} 200:
|
|
* {
|
|
* "code": 200,
|
|
* "guildInfo": {
|
|
* "idx": 1,
|
|
* "gname": "guild_1", // 工会名称 (String(48))
|
|
* "logo": "logo_1", // 工会logo (String(32))
|
|
* "gowner": "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", // 工会创建者ID (String(64))
|
|
* "gownername": "owner_1", // 工会创建者名称 (String(32))
|
|
* "gmaxmember": 100, // 工会最大成员数 (Number)
|
|
* "countmember": 1 // 工会成员数 (Number)
|
|
* }
|
|
*
|
|
* @apiSuccessExample {json} 200: no guild.
|
|
* {
|
|
* "code": 200,
|
|
* "guildInfo": null,
|
|
* "msg": "You haven't joined any guild yet."
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} 500:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Failed to get guild info."
|
|
* }
|
|
*
|
|
*/
|
|
async getGuildInfo({ guildId }, session, next) {
|
|
try {
|
|
const guildInfo = await this.guildService.getGuildInfo(guildId);
|
|
if (guildInfo) {
|
|
next(null, { code: Code.OK, guildInfo });
|
|
} else {
|
|
next(null, {
|
|
code: Code.OK,
|
|
guildInfo: null,
|
|
msg: "You haven't joined any guild yet.",
|
|
});
|
|
}
|
|
} catch (err) {
|
|
next(null, { code: Code.FAIL, msg: "Failed to get guild info." });
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.createGuild createGuild 创建工会
|
|
* @apiGroup Guild
|
|
* @apiParam {String} guildName 工会名称
|
|
* @apiParam {String} logo 工会图标
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {Number} guildId 工会ID
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "guildId": 1
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 4001,
|
|
* "msg": "Create guild failed"
|
|
* }
|
|
*/
|
|
async createGuild(msg, session, next) {
|
|
const uid = session.uid;
|
|
const userInfo = session.get("userInfo");
|
|
const { guildName, logo } = msg;
|
|
try {
|
|
const result = await this.guildService.createGuild(
|
|
guildName,
|
|
logo,
|
|
userInfo.account_id
|
|
);
|
|
if (result) {
|
|
next(null, { code: Code.OK, guildId: result });
|
|
} else {
|
|
next(null, {
|
|
code: Code.GUILD.FA_GUILD_CREATE_FAILED,
|
|
msg: "Create guild failed",
|
|
});
|
|
}
|
|
} catch (err) {
|
|
switch (err.errno) {
|
|
case errors.ER_DUP_ENTRY:
|
|
next(null, {
|
|
code: Code.GUILD.FA_GUILD_CREATE_FAILED,
|
|
msg: "Guild already created",
|
|
});
|
|
break;
|
|
default:
|
|
next(null, err);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.joinGuild joinGuild 加入工会
|
|
* @apiGroup Guild
|
|
* @apiParam {String} guildId 工会ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Join guild done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 4002,
|
|
* "msg": "Join guild failed"
|
|
* }
|
|
*
|
|
*/
|
|
async joinGuild(msg, session, next) {
|
|
try {
|
|
const { guildId } = msg;
|
|
const { uid } = session;
|
|
const result = await this.guildService.joinGuild(uid, guildId);
|
|
const response = result
|
|
? { code: Code.OK, msg: "Join guild done" }
|
|
: { code: Code.GUILD.FA_GUILD_JOIN_FAILED, msg: "Join guild failed" };
|
|
next(null, response);
|
|
} catch (error) {
|
|
next(null, { code: Code.GUILD.FA_GUILD_JOIN_FAILED, msg: error.message });
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.approveGuild approveGuild 审批新成员
|
|
* @apiGroup Guild
|
|
* @apiParam {String} guildId 工会ID
|
|
* @apiParam {String} newuid 新用户ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Approve guild done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 4003,
|
|
* "msg": "Approve guild failed"
|
|
* }
|
|
*
|
|
*/
|
|
async approveGuild(msg, session, next) {
|
|
const { guildId, newuid } = msg;
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.approveGuild(guildId, uid, newuid);
|
|
if (result) {
|
|
next(null, { code: Code.OK, msg: "Approve guild done" });
|
|
} else {
|
|
next(null, {
|
|
code: Code.GUILD.FA_GUILD_APPROVE_FAILED,
|
|
msg: "Approve guild failed",
|
|
});
|
|
}
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.inviteNewMember inviteNewMember 邀请新成员
|
|
* @apiGroup Guild
|
|
* @apiParam {String} guildId 工会ID
|
|
* @apiParam {String} newuid 新用户ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Invite new member done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 4004,
|
|
* "msg": "Invite new member failed"
|
|
* }
|
|
*
|
|
*/
|
|
async inviteNewMember(msg, session, next) {
|
|
const { guildId, newuid } = msg;
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.inviteNewMember(
|
|
uid,
|
|
guildId,
|
|
newuid
|
|
);
|
|
if (result) {
|
|
next(null, { code: Code.OK, msg: "Invite new member done" });
|
|
} else {
|
|
next(null, {
|
|
code: Code.GUILD.FA_GUILD_JOIN_FAILED,
|
|
msg: "Invite new member failed",
|
|
});
|
|
}
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.getInviteList getInviteList 获取邀请列表
|
|
* @apiGroup Guild
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
* @apiSuccess {Object[]} result 结果
|
|
*
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Get invite list done",
|
|
* "guilds": [
|
|
* {
|
|
* "idx": 1,
|
|
* "guild_idx": 1,
|
|
* }
|
|
* ]
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Get invite list failed"
|
|
* }
|
|
*
|
|
*/
|
|
async getInviteList(msg, session, next) {
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.getInviteList(uid);
|
|
if (result) {
|
|
next(null, { code: Code.OK, guilds: result });
|
|
} else {
|
|
next(null, { code: Code.FAIL, msg: "Get invite list failed" });
|
|
}
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/** @api {post} guild.guildHandler.getGuildRequestList getGuildRequestList 获取工会申请列表
|
|
* @apiGroup Guild
|
|
*
|
|
* @apiParam {String} guildId 工会ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
* @apiSuccess {Object[]} members 成员列表
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Get guild request list done",
|
|
* "members": [
|
|
* {
|
|
* "uid": "6513",
|
|
* "name": ""
|
|
* "g_rank": 0,
|
|
* "online": 0,
|
|
* }
|
|
* ]
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Get guild request list failed"
|
|
* }
|
|
*
|
|
*/
|
|
async getGuildRequestList({ guildId }, session, next) {
|
|
try {
|
|
const result = await this.guildService.getMembers(guildId, 0);
|
|
if (result) {
|
|
next(null, { code: Code.OK, members: result });
|
|
} else {
|
|
next(null, { code: Code.FAIL, msg: "Get guild request list failed" });
|
|
}
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/** @api {post} guild.guildHandler.getGuildInviteList getGuildInviteList 获取工会邀请列表
|
|
* @apiGroup Guild
|
|
* @apiParam {String} guildId 工会ID
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
* @apiSuccess {Object[]} members 成员列表
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Get guild invite list done",
|
|
* "members": [
|
|
* {
|
|
* "uid": "6513",
|
|
* "name": ""
|
|
* "g_rank": 0,
|
|
* "online": 1,
|
|
* }
|
|
* ]
|
|
* }
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Get guild invite list failed"
|
|
* }
|
|
*
|
|
*/
|
|
async getGuildInviteList({ guildId }, session, next) {
|
|
try {
|
|
const result = await this.guildService.getMembers(guildId, 1);
|
|
if (result) {
|
|
next(null, { code: Code.OK, members: result });
|
|
} else {
|
|
next(null, { code: Code.FAIL, msg: "Get guild invite list failed" });
|
|
}
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.confirmInvite confirmInvite 确认邀请
|
|
* @apiGroup Guild
|
|
* @apiParam {String} guildId 工会ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Confirm invite done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Confirm invite failed"
|
|
* }
|
|
*/
|
|
async confirmInvite(msg, session, next) {
|
|
const { guildId } = msg;
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.confirmInvite(uid, guildId);
|
|
if (result) {
|
|
next(null, { code: Code.OK, msg: "Confirm invite done" });
|
|
} else {
|
|
next(null, { code: Code.FAIL, msg: "Confirm invite failed" });
|
|
}
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.leaveGuild leaveGuild 离开工会
|
|
* @apiGroup Guild
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Leave guild done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Leave guild failed"
|
|
* }
|
|
*/
|
|
async leaveGuild(msg, session, next) {
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.leaveGuild(uid);
|
|
if (result) {
|
|
next(null, { code: Code.OK, msg: "Leave guild done" });
|
|
} else {
|
|
next(null, { code: Code.FAIL, msg: "Leave guild failed" });
|
|
}
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.kick kick 踢出成员
|
|
* @apiGroup Guild
|
|
* @apiParam {String} muid 成员ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Kick member done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Kick member failed"
|
|
* }
|
|
*/
|
|
async kick(msg, session, next) {
|
|
const { muid } = msg;
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.kick(uid, muid);
|
|
if (result) {
|
|
next(null, { code: Code.OK, msg: "Kick member done" });
|
|
} else {
|
|
next(null, { code: Code.FAIL, msg: "Kick member failed" });
|
|
}
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.getGuildMembers getGuildMembers 获取工会成员列表
|
|
* @apiGroup Guild
|
|
* @apiParam {String} guildId 工会ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Get guild members done",
|
|
* "members": [
|
|
* {
|
|
* "uid": "1",
|
|
* "name": "test",
|
|
* "g_rank": 1,
|
|
* }
|
|
* ]
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Get guild members failed"
|
|
* }
|
|
*
|
|
*/
|
|
async getGuildMembers(msg, session, next) {
|
|
const { guildId } = msg;
|
|
try {
|
|
const result = await this.guildService.getMembers(guildId, 2);
|
|
next(null, {code: Code.OK, members: result, msg: "Get guild members done" });
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.updateMemberRank updateMemberRank 更新成员职位
|
|
* @apiGroup Guild
|
|
* @apiParam {String} memberUid 成员ID
|
|
* @apiParam {String} guildId 工会ID
|
|
* @apiParam {Number} g_rank 职位
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Update member rank done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Update member rank failed"
|
|
* }
|
|
*/
|
|
async updateMemberRank(msg, session, next) {
|
|
const { memberUid, guildId, g_rank } = msg;
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.updateMemberRank(
|
|
uid,
|
|
guildId,
|
|
memberUid,
|
|
g_rank
|
|
);
|
|
next(null, { code: Code.OK, result: result });
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.setAnnounce setAnnounce 设置公告
|
|
* @apiGroup Guild
|
|
* @apiParam {String} gid 工会ID
|
|
* @apiParam {String} announce 公告
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Set announce done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Set announce failed"
|
|
* }
|
|
*/
|
|
async setAnnounce(msg, session, next) {
|
|
const { gid, announce } = msg;
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.setAnnounce(uid, gid, announce);
|
|
next(null, { code: Code.OK, result: result });
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @api {post} guild.guildHandler.disbandGuild disbandGuild 解散工会
|
|
* @apiGroup Guild
|
|
* @apiParam {String} gid 工会ID
|
|
*
|
|
* @apiSuccess {Number} code 状态码
|
|
* @apiSuccess {String} msg 消息
|
|
*
|
|
* @apiSuccessExample {json} Success-Response:
|
|
* {
|
|
* "code": 200,
|
|
* "msg": "Disband guild done"
|
|
* }
|
|
*
|
|
* @apiErrorExample {json} Error-Response:
|
|
* {
|
|
* "code": 500,
|
|
* "msg": "Disband guild failed"
|
|
* }
|
|
*/
|
|
async disbandGuild(msg, session, next) {
|
|
const { uid } = session;
|
|
try {
|
|
const result = await this.guildService.disbandGuild(uid);
|
|
next(null, { code: Code.OK, msg: "Disband guild done" });
|
|
} catch (err) {
|
|
next(null, err);
|
|
}
|
|
}
|
|
}
|