后台:修复修改活动字段后的报错
This commit is contained in:
@@ -3,7 +3,7 @@ import { STATUS, ACTIVITY_TYPE } from '@consts';
|
||||
import { ActivityModel } from '@db/Activity';
|
||||
import { ActivityGroupModel } from '@db/ActivityGroup';
|
||||
import { ServerlistModel } from '@db/Serverlist';
|
||||
import { GMUserType } from '@db/GMUser';
|
||||
// import { GMUserType } from '@db/GMUser';
|
||||
import { SignInData } from '@domain/activityField/signInField';
|
||||
import { ActivityGroupTypeModel } from '@db/ActivityGroupType';
|
||||
import { ActivityTaskPointModel } from '@db/ActivityTaskPoint';
|
||||
@@ -94,36 +94,36 @@ export default class Activity extends Service {
|
||||
return 0
|
||||
}
|
||||
|
||||
public async updateActivity(activityId: number | string, groupId: number, beginTime: number, endTime: number, type: number, data: string) {
|
||||
const { ctx } = this;
|
||||
let gmuser: GMUserType = ctx.user;
|
||||
if (!type || !data) {
|
||||
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
try {
|
||||
let result = JSON.parse(data);
|
||||
ctx.service.utils.checkActivityData(result, type);
|
||||
let aids: number[] = [];
|
||||
if (typeof activityId == 'number') {
|
||||
aids.push(activityId);
|
||||
} else {
|
||||
activityId.split(',').forEach(aidStr => {
|
||||
aids.push(parseInt(aidStr));
|
||||
});
|
||||
}
|
||||
// public async updateActivity(activityId: number | string, groupId: number, beginTime: number, endTime: number, type: number, data: string) {
|
||||
// const { ctx } = this;
|
||||
// let gmuser: GMUserType = ctx.user;
|
||||
// if (!type || !data) {
|
||||
// return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
// }
|
||||
// try {
|
||||
// let result = JSON.parse(data);
|
||||
// ctx.service.utils.checkActivityData(result, type);
|
||||
// let aids: number[] = [];
|
||||
// if (typeof activityId == 'number') {
|
||||
// aids.push(activityId);
|
||||
// } else {
|
||||
// activityId.split(',').forEach(aidStr => {
|
||||
// aids.push(parseInt(aidStr));
|
||||
// });
|
||||
// }
|
||||
|
||||
let checkResult = await this.checkActivityGroupType(groupId, aids, ctx);
|
||||
if(checkResult) return checkResult;
|
||||
// let checkResult = await this.checkActivityGroupType(groupId, aids, ctx);
|
||||
// if(checkResult) return checkResult;
|
||||
|
||||
let activities = await ActivityModel.addActivity(aids, groupId, beginTime ? new Date(beginTime) : undefined, endTime ? new Date(endTime) : undefined, type, data, gmuser.uid);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
activity: activities
|
||||
})
|
||||
// let activities = await ActivityModel.addActivity(aids, groupId, beginTime ? new Date(beginTime) : undefined, endTime ? new Date(endTime) : undefined, type, data, gmuser.uid);
|
||||
// return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
// activity: activities
|
||||
// })
|
||||
|
||||
} catch (e) {
|
||||
return ctx.service.utils.resResult(STATUS.INTERNAL_ERR, null, (<Error>e).stack);
|
||||
}
|
||||
}
|
||||
// } catch (e) {
|
||||
// return ctx.service.utils.resResult(STATUS.INTERNAL_ERR, null, (<Error>e).stack);
|
||||
// }
|
||||
// }
|
||||
|
||||
public async deleteActivity(activityId: number) {
|
||||
const { ctx } = this;
|
||||
|
||||
Reference in New Issue
Block a user