活动:修改计算公式

This commit is contained in:
qiaoxin
2021-06-30 21:15:12 +08:00
parent 1c330fea03
commit 5d7b55fa2a
2 changed files with 7 additions and 2 deletions
@@ -7,6 +7,7 @@ import { ServerlistModel } from '../../../db/Serverlist';
import { getActivity } from '../../../services/activity/activityService'; import { getActivity } from '../../../services/activity/activityService';
import { ActivityModel } from '../../../db/Activity'; import { ActivityModel } from '../../../db/Activity';
import { GTPushSingleCidMessage, GTCreateListMessage, GTPushListCidMessage } from '../../../services/getui/getuiService'; import { GTPushSingleCidMessage, GTCreateListMessage, GTPushListCidMessage } from '../../../services/getui/getuiService';
import moment = require('moment');
export default function (app: Application) { export default function (app: Application) {
return new ActivityHandler(app); return new ActivityHandler(app);
@@ -84,7 +85,11 @@ export class ActivityHandler {
if (lv == 1) { if (lv == 1) {
await GTPushSingleCidMessage('ba64ee9a9d516bbd341267d685baceb4', 259200000, '哈哈哈哈哈', '噢噢噢噢噢噢噢噢'); await GTPushSingleCidMessage('ba64ee9a9d516bbd341267d685baceb4', 259200000, '哈哈哈哈哈', '噢噢噢噢噢噢噢噢');
} }
// let beginTime = 1624050000000;
// let interval = 86400;
// console.log('ddddddbbbbbbbbbbbbbb', moment(new Date).valueOf(), (moment(new Date).valueOf() - beginTime), ((moment(new Date).valueOf() - beginTime) % (interval * 1000)), 24 * 60 * 60 * 1000, ((moment(new Date).valueOf() - beginTime) % (interval * 1000)) / (24 * 60 * 60 * 1000))
// let aaa = Math.ceil(((moment(new Date).valueOf() - beginTime) / (24 * 60 * 60 * 1000)));
// console.log('xxxxxxxxxxxxxxxxxxx', aaa);
return resResult(STATUS.SUCCESS,); return resResult(STATUS.SUCCESS,);
} }
+1 -1
View File
@@ -68,7 +68,7 @@ export abstract class ActivityBase {
if (activityData.interval > 0) { if (activityData.interval > 0) {
this.roundIndex = Math.ceil((moment(new Date).valueOf() - this.beginTime) / (activityData.interval * 1000)); this.roundIndex = Math.ceil((moment(new Date).valueOf() - this.beginTime) / (activityData.interval * 1000));
this.nextRefreshTime = moment(this.beginTime).add(activityData.interval * this.roundIndex, 'second').valueOf(); this.nextRefreshTime = moment(this.beginTime).add(activityData.interval * this.roundIndex, 'second').valueOf();
this.todayIndex = Math.ceil(((moment(new Date).valueOf() - this.beginTime) % (activityData.interval * 1000)) / (24 * 60 * 60 * 1000)); this.todayIndex = Math.ceil(((moment(new Date).valueOf() - this.beginTime) / (24 * 60 * 60 * 1000)));
} }
console.log('活动时间数据...', '活动id:', activityData.activityId, '类型:', activityData.timeType, '开始时间:', this.beginTime, moment(this.beginTime).toDate(), console.log('活动时间数据...', '活动id:', activityData.activityId, '类型:', activityData.timeType, '开始时间:', this.beginTime, moment(this.beginTime).toDate(),
'结束:', this.endTime, moment(this.endTime).toDate(), '结束:', this.endTime, moment(this.endTime).toDate(),