🐞 fix(后台): 修复后台活动积分&大区配置bug

This commit is contained in:
luying
2022-11-01 13:48:14 +08:00
parent eb6f9603cb
commit 4259a0e9a4
4 changed files with 16 additions and 8 deletions

View File

@@ -89,8 +89,8 @@ export default class ActivityController extends Controller {
public async updateActivityTaskPoint() { public async updateActivityTaskPoint() {
const { ctx } = this; const { ctx } = this;
const { taskType, taskId, activityId, point } = ctx.request.body; const { type, taskId, activityId, point, taskType, activityType } = ctx.request.body;
ctx.body = await ctx.service.activity.updateActivityTaskPoint(taskType, taskId, activityId, point); ctx.body = await ctx.service.activity.updateActivityTaskPoint(type, taskId, activityId, activityType, taskType, point);
return return
} }

View File

@@ -177,9 +177,9 @@ export default class Activity extends Service {
return ctx.service.utils.resResult(STATUS.SUCCESS); return ctx.service.utils.resResult(STATUS.SUCCESS);
} }
public async updateActivityTaskPoint(taskType: number, taskId: number, activityId: number, point: number) { public async updateActivityTaskPoint(type: number, taskId: number, activityId: number, activityType: number, taskType: number, point: number) {
const { ctx } = this; const { ctx } = this;
let result = await ActivityTaskPointModel.updateData(taskType, taskId, activityId, point, ctx.user?.uid); let result = await ActivityTaskPointModel.updateData(type, taskId, activityId, activityType, taskType, point, ctx.user?.uid);
if(!result) return ctx.service.utils.resResult(STATUS.WRONG_PARMS); if(!result) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
return ctx.service.utils.resResult(STATUS.SUCCESS); return ctx.service.utils.resResult(STATUS.SUCCESS);
} }

View File

@@ -25,9 +25,9 @@ export default class Activity_Task_Point extends BaseModel {
point: number; // 增加点数 point: number; // 增加点数
//更新活动数据 //更新活动数据
public static async updateData(type: number, taskId: number, activityId: number, point: number, uid = 1) { public static async updateData(type: number, taskId: number, activityId: number, activityType: number, taskType: number, point: number, uid = 1) {
let result: ActivityTaskPointModelType = await ActivityTaskPointModel.findOneAndUpdate( let result: ActivityTaskPointModelType = await ActivityTaskPointModel.findOneAndUpdate(
{ type, taskId, activityId }, { $set: { point, updatedBy: uid }, $setOnInsert: { createdBy: uid } }, { upsert: true, new: true } { type, taskId, activityId }, { $set: { activityType, taskType, point, updatedBy: uid }, $setOnInsert: { createdBy: uid } }, { upsert: true, new: true }
).lean(true); ).lean(true);
return result; return result;
} }

View File

@@ -80,8 +80,16 @@ export default class ServerStategy {
this.timers = stategy.timers; this.timers = stategy.timers;
this.activityGroupId = stategy.activityGroupId; this.activityGroupId = stategy.activityGroupId;
this.stopRegisterTime = stategy.stopRegisterTime; this.stopRegisterTime = stategy.stopRegisterTime;
if(stategy.hasCircleMail) this.circleMail = stategy.circleMail; if(stategy.hasCircleMail) {
if(stategy.hasOpenMail) this.openMail = stategy.openMail; this.circleMail = stategy.circleMail;
} else {
this.circleMail = null;
}
if(stategy.hasOpenMail) {
this.openMail = stategy.openMail;
} else {
this.openMail = null;
}
} }
} }
export interface ServerStategyType extends Pick<DocumentType<ServerStategy>, keyof ServerStategy> { }; export interface ServerStategyType extends Pick<DocumentType<ServerStategy>, keyof ServerStategy> { };