|
|
@@ -277,11 +277,13 @@ function setSynthesisAmount(amount) {
|
|
|
}
|
|
|
|
|
|
async function trySynthesize() {
|
|
|
+ magicJS.logger.info(`[0]活动任务开始执行...`);
|
|
|
let activityData = await getWillActivityData();
|
|
|
magicJS.logger.info(`activityData=${JSON.stringify(activityData)}`);
|
|
|
if (!activityData) {
|
|
|
return;
|
|
|
}
|
|
|
+ magicJS.logger.info(`[2]活动任务开始执行...`);
|
|
|
let activityId = activityData.hashId || activityData.activityId;
|
|
|
let retCvtData = null;
|
|
|
if (activityData.type == 0) {
|
|
|
@@ -289,6 +291,7 @@ async function trySynthesize() {
|
|
|
} else if (activityData.type == 1) {
|
|
|
retCvtData = await doGetConvertGoodsList(activityId, checkConvertGoodsListReqForceNeed());
|
|
|
}
|
|
|
+ magicJS.logger.info(`[3]活动任务开始执行...`);
|
|
|
magicJS.logger.info(`retCvtData=${JSON.stringify(retCvtData)}`);
|
|
|
if (!retCvtData) {
|
|
|
return;
|
|
|
@@ -313,11 +316,13 @@ async function trySynthesize() {
|
|
|
setActivityDisabled(activityId, true);
|
|
|
} else {
|
|
|
if (isConcurrentExcute) {
|
|
|
+ magicJS.logger.info(`[4]活动任务开始执行...`);
|
|
|
for (let n = 0; n < nRuns; n++) {
|
|
|
let startTime = Date.now();
|
|
|
for (let i = 0; i < nExcuteCount; i++) {
|
|
|
let oneCombination = combinationLst[i];
|
|
|
let goodsList = getCombinationGoodsList(oneCombination);
|
|
|
+ magicJS.logger.info(`第${n}-${i}趟开始执行...`);
|
|
|
if (activityData.type == 0) {
|
|
|
doCreateCompositeOrder(activityId, goodsList);
|
|
|
} else if (activityData.type == 1) {
|
|
|
@@ -335,6 +340,9 @@ async function trySynthesize() {
|
|
|
if (retData && retData.code == 200) {
|
|
|
nSuccCount += 1;
|
|
|
} else {
|
|
|
+ if (retData.code == 500 && retData.msg && retData.msg.indexOf('库存不足') != -1) {
|
|
|
+ setActivityDisabled(activityId, true);
|
|
|
+ }
|
|
|
nFailCount += 1;
|
|
|
}
|
|
|
}
|
|
|
@@ -384,6 +392,7 @@ async function trySynthesize() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ magicJS.logger.info(`活动任务执行结束`);
|
|
|
magicJS.notification.appendNotifyInfo(tipsText);
|
|
|
}
|
|
|
|