后台:批量编辑
This commit is contained in:
@@ -22,9 +22,9 @@ export default class Activity extends Service {
|
||||
});
|
||||
}
|
||||
|
||||
public async updateActivity(activityId: number, serverId: number, beginTime: number, endTime: number, type: number, data: string) {
|
||||
public async updateActivity(activityId: number|string, serverId: number, beginTime: number, endTime: number, type: number, data: string) {
|
||||
const { ctx } = this;
|
||||
if(serverId == undefined || !beginTime || !endTime || !type || !data) {
|
||||
if(!type || !data) {
|
||||
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
try {
|
||||
@@ -33,7 +33,15 @@ export default class Activity extends Service {
|
||||
} catch(e) {
|
||||
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
const activity = await ActivityModel.addActivity(activityId, serverId, new Date(beginTime), new Date(endTime), type, data);
|
||||
let aids: number[] = [];
|
||||
if(typeof activityId == 'number') {
|
||||
aids.push(activityId);
|
||||
} else {
|
||||
activityId.split(',').forEach(aidStr => {
|
||||
aids.push(parseInt(aidStr));
|
||||
});
|
||||
}
|
||||
const activity = await ActivityModel.addActivity(aids, serverId, beginTime?new Date(beginTime): undefined, endTime?new Date(endTime): undefined, type, data);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
activity
|
||||
})
|
||||
@@ -48,4 +56,5 @@ export default class Activity extends Service {
|
||||
return ctx.service.utils.resResult(STATUS.ACTIVITY_MISSING);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user