后台:活动添加字段
This commit is contained in:
@@ -136,8 +136,8 @@ export class GmHandler {
|
||||
});
|
||||
}
|
||||
|
||||
async updateActivity(msg: { activityId: number|string, groupId: number, beginTime: number, endTime: number, type: number, data: string }, session: BackendSession) {
|
||||
const { activityId, groupId, beginTime, endTime, type, data } = msg;
|
||||
async updateActivity(msg: { activityId: number|string, groupId: number, beginTime: number, endTime: number, type: number, data: string, timeType: number, days: number, delayDay: number, interval: number }, session: BackendSession) {
|
||||
const { activityId, groupId, beginTime, endTime, type, data, timeType = 3, days = 0, delayDay = 0, interval = 0 } = msg;
|
||||
const uid = session.get('uid');
|
||||
if (!type || !data) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
@@ -156,7 +156,7 @@ export class GmHandler {
|
||||
let checkGroup = await checkActivityGroupTypeWithId(groupId, activities);
|
||||
if(!checkGroup) return resResult(STATUS.GM_ACTIVITY_NOT_FIT_GROUP_TYPE);
|
||||
|
||||
activities = await ActivityModel.addActivity(aids, groupId, beginTime ? new Date(beginTime) : undefined, endTime ? new Date(endTime) : undefined, type, data, uid);
|
||||
activities = await ActivityModel.addActivity(aids, groupId, beginTime ? new Date(beginTime) : undefined, endTime ? new Date(endTime) : undefined, type, data, timeType, days, delayDay, interval, uid);
|
||||
|
||||
let activityServers = pinus.app.getServersByType('activity');
|
||||
for(let server of activityServers) {
|
||||
|
||||
@@ -75,11 +75,13 @@ export default class Activity extends BaseModel {
|
||||
}
|
||||
|
||||
//新增活动
|
||||
public static async addActivity(aids: number[], groupId: number, beginTime: Date, endTime: Date, type: number, data: string, uid = 1) {
|
||||
public static async addActivity(aids: number[], groupId: number, beginTime: Date, endTime: Date, type: number, data: string, timeType: number, days: number, delayDay: number, interval: number, uid = 1) {
|
||||
let result: ActivityModelType[] = [];
|
||||
let newAids = [];
|
||||
for (let activityId of aids) {
|
||||
if (!activityId) activityId = await CounterModel.getNewCounter(COUNTER.ACTIVITY);
|
||||
let update = { type, data }
|
||||
newAids.push(activityId);
|
||||
let update = { type, data, timeType, days, delayDay, interval }
|
||||
if (beginTime != undefined) {
|
||||
update["beginTime"] = beginTime;
|
||||
}
|
||||
@@ -95,7 +97,7 @@ export default class Activity extends BaseModel {
|
||||
let newGroup = await ActivityGroupModel.createGroup(uid);
|
||||
groupId = newGroup.groupId;
|
||||
}
|
||||
await ActivityGroupModel.addActivitiesToGroupData(groupId, aids, uid);
|
||||
await ActivityGroupModel.addActivitiesToGroupData(groupId, newAids, uid);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1000",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1000",
|
||||
"damageReward": "40005&1000",
|
||||
"basicReward": "17052&2",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "21013&80|21016&80|21031&80|21054&80|21055&80|21062&80|21063&80|21008&60|21010&60|42124&1|42128&1|42132&1|42136&1|42140&1|42144&1"
|
||||
@@ -30,7 +30,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1200",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1200",
|
||||
"damageReward": "40005&1200",
|
||||
"basicReward": "17052&4",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "21013&80|21016&80|21031&80|21054&80|21055&80|21062&80|21063&80|21008&60|21010&60|42124&1|42128&1|42132&1|42136&1|42140&1|42144&1"
|
||||
@@ -48,7 +48,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1300",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1300",
|
||||
"damageReward": "40005&1300",
|
||||
"basicReward": "17052&6",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "21013&80|21016&80|21031&80|21054&80|21055&80|21062&80|21063&80|21008&60|21010&60|42124&1|42128&1|42132&1|42136&1|42140&1|42144&1"
|
||||
@@ -66,7 +66,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1400",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1400",
|
||||
"damageReward": "40005&1400",
|
||||
"basicReward": "17052&8",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "42136&1|42140&1|42144&1|33123&1|33127&1|33131&1|33135&1|33139&1|33143&1"
|
||||
@@ -84,7 +84,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1500",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1500",
|
||||
"damageReward": "40005&1500",
|
||||
"basicReward": "17052&10",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "42136&1|42140&1|42144&1|33123&1|33127&1|33131&1|33135&1|33139&1|33143&1"
|
||||
@@ -102,7 +102,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1600",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1600",
|
||||
"damageReward": "40005&1600",
|
||||
"basicReward": "17052&12",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "42136&1|42140&1|42144&1|33123&1|33127&1|33131&1|33135&1|33139&1|33143&1"
|
||||
@@ -120,7 +120,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1700",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1700",
|
||||
"damageReward": "40005&1700",
|
||||
"basicReward": "17052&14",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "33131&1|33135&1|33139&1|33143&1|50169&1|50170&1|50171&1"
|
||||
@@ -138,7 +138,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1800",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1800",
|
||||
"damageReward": "40005&1800",
|
||||
"basicReward": "17052&16",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "33131&1|33135&1|33139&1|33143&1|50169&1|50170&1|50171&1"
|
||||
@@ -156,7 +156,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&1900",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&1900",
|
||||
"damageReward": "40005&1900",
|
||||
"basicReward": "17052&18",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "33131&1|33135&1|33139&1|33143&1|50169&1|50170&1|50171&1"
|
||||
@@ -174,7 +174,7 @@
|
||||
"imageName": "jttubiao_3",
|
||||
"killReward": "40005&2000",
|
||||
"ratio": 1,
|
||||
"damageRewardTotal": "40005&2000",
|
||||
"damageReward": "40005&2000",
|
||||
"basicReward": "17052&20",
|
||||
"encourageSum": 300,
|
||||
"rewardsPreview": "33131&1|33135&1|33139&1|33143&1|50169&1|50170&1|50171&1"
|
||||
|
||||
Reference in New Issue
Block a user