后台添加添加元宝功能
This commit is contained in:
@@ -30,18 +30,21 @@ export default class UserController extends Controller {
|
|||||||
|
|
||||||
public async createRoleData() {
|
public async createRoleData() {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
const { hid, hlv, eid, elv, ecount, ehid, itemid, itemcount, selectedRowKeys: uids, optType } = ctx.request.body;
|
const { hid, hlv, eid, elv, ecount, ehid, itemid, itemcount, count, selectedRowKeys: uids, optType } = ctx.request.body;
|
||||||
if(optType == 'hero') {
|
if(optType == 'hero') {
|
||||||
ctx.body = await ctx.service.users.createHero(uids, hid, hlv);
|
ctx.body = await ctx.service.users.createHero(uids, hid, hlv);
|
||||||
} else if(optType == 'equip') {
|
} else if(optType == 'equip') {
|
||||||
ctx.body = await ctx.service.users.createEquip(uids, eid, elv, ecount, ehid);
|
ctx.body = await ctx.service.users.createEquip(uids, eid, elv, ecount, ehid);
|
||||||
} else if (optType == 'item') {
|
} else if (optType == 'item') {
|
||||||
ctx.body = await ctx.service.users.createItem(uids, itemid, itemcount);
|
ctx.body = await ctx.service.users.createItem(uids, itemid, itemcount);
|
||||||
|
} else if (optType == 'gold') {
|
||||||
|
ctx.body = await ctx.service.users.addGold(uids, count);
|
||||||
} else {
|
} else {
|
||||||
ctx.body = ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
ctx.body = ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async getPveDefense() {
|
public async getPveDefense() {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
const { roleId } = ctx.request.body;
|
const { roleId } = ctx.request.body;
|
||||||
|
|||||||
@@ -290,6 +290,18 @@ export default class GMUsers extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async addGold(uids: Array<string>, _count: string) {
|
||||||
|
const {ctx} = this;
|
||||||
|
console.log('gm addGold', uids, _count);
|
||||||
|
let count = parseInt(_count);
|
||||||
|
if(isNaN(count)) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||||
|
for(let roleId of uids) {
|
||||||
|
await RoleModel.addGoldFree(roleId, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx.service.utils.resResult(STATUS.SUCCESS, { uids });
|
||||||
|
}
|
||||||
|
|
||||||
public async getPvpDefense(roleId: string) {
|
public async getPvpDefense(roleId: string) {
|
||||||
const {ctx} = this;
|
const {ctx} = this;
|
||||||
let result = await PvpDefenseModel.findByRoleId(roleId);
|
let result = await PvpDefenseModel.findByRoleId(roleId);
|
||||||
|
|||||||
Reference in New Issue
Block a user