|
|
@@ -67,8 +67,8 @@ async function all() {
|
|
|
if(cateItems){
|
|
|
let cateCount = cateItems.length;
|
|
|
let allBuyList = getWillMarketBuyListAll();
|
|
|
- lk.log("#############allBuyList#############");
|
|
|
- lk.log(JSON.stringify(allBuyList));
|
|
|
+ // lk.log("#############allBuyList#############");
|
|
|
+ // lk.log(JSON.stringify(allBuyList));
|
|
|
let allRetList = [];
|
|
|
for (let i = 0; i < cateCount; i++) {
|
|
|
const buyList = allBuyList[i];
|
|
|
@@ -76,21 +76,16 @@ async function all() {
|
|
|
continue;
|
|
|
}
|
|
|
const activityData = cateItems[i];
|
|
|
- lk.log("#############test#############");
|
|
|
- lk.log(JSON.stringify(buyList));
|
|
|
- lk.log("#############test#############");
|
|
|
- lk.log(JSON.stringify(activityData));
|
|
|
- lk.log("#############test#############");
|
|
|
const buyRetList = await checkToBuyAll(buyList, activityData);
|
|
|
allRetList = allRetList.concat(buyRetList);
|
|
|
}
|
|
|
let dismsg = '';
|
|
|
for(let i = 0; i < allRetList.length; i++){
|
|
|
const oneRet = allRetList[i];
|
|
|
- dismsg += `${oneRet.prizeName}${oneRet.prizeDesc}下单成功\n`;
|
|
|
+ dismsg += `${oneRet.prizeName}${oneRet.prizeDesc}#¥${oneRet.price}\n`;
|
|
|
}
|
|
|
if(dismsg.length > 0){
|
|
|
- lk.appendNotifyInfo(`🎉${dismsg}`);
|
|
|
+ lk.appendNotifyInfo(`🎉下单成功:\n${dismsg}`);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -154,14 +149,16 @@ async function checkToBuyOne(subActivityId, itemName, awardList){
|
|
|
for(let i=0; i < awardList.length; i++){
|
|
|
const awardData = awardList[i];
|
|
|
if(awardData.prizeName.indexOf(itemName) > -1){
|
|
|
- oneRet = await itemBuy(subActivityId, awardData);
|
|
|
+ if(awardData.remainStock > 0){
|
|
|
+ oneRet = await itemBuy(subActivityId, awardData, 'choose');
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
return oneRet;
|
|
|
}
|
|
|
|
|
|
-async function itemBuy(subActivityId, awardData){
|
|
|
+async function itemBuy(subActivityId, awardData, cateActType){
|
|
|
const activityId = awardData.activityId;
|
|
|
const prizeName = awardData.prizeName;
|
|
|
let actDataList = await getActivityItems(marketId, activityId, eventVisitorId);
|
|
|
@@ -170,7 +167,7 @@ async function itemBuy(subActivityId, awardData){
|
|
|
const actData = actDataList[i];
|
|
|
// 'choose' 'subChoose' 'subPre' 'subShare'
|
|
|
const actType = actData.type;
|
|
|
- if(actType == 'choose' || actType == 'subChoose'){
|
|
|
+ if(actType == cateActType){
|
|
|
const awardList = actData.awardList;
|
|
|
const newAwardIem = checkPickItem(prizeName, awardList);
|
|
|
if(newAwardIem){
|
|
|
@@ -181,18 +178,14 @@ async function itemBuy(subActivityId, awardData){
|
|
|
}
|
|
|
getDesDecodeInfo(activityId, eventVisitorId);
|
|
|
const gameAccount = lk.getVal(OfPayConstKey.phone);
|
|
|
- lk.log("####0####");
|
|
|
- lk.log(awardData.thirdInfo);
|
|
|
const thirdInfo = JSON.parse(awardData.thirdInfo);
|
|
|
- lk.log("####1####");
|
|
|
const awardId = awardData.awardId;
|
|
|
const awardPrice = parseFloat(awardData.price);
|
|
|
const awardFaceValue = parseFloat(thirdInfo.faceValue);
|
|
|
awardData.faceValue = awardFaceValue;
|
|
|
|
|
|
- lk.log("####2####");
|
|
|
const discountPrice = getAwardExpectedDiscount(awardFaceValue, prizeName);
|
|
|
- lk.log(`商品${prizeName}(面值:${awardFaceValue}),当前售价:${awardPrice}`);
|
|
|
+ lk.log(`商品${prizeName}(面值:${awardFaceValue}),当前售价:${awardPrice}\n#${awardId}`);
|
|
|
if(awardPrice <= discountPrice){
|
|
|
// let payInfo = await getPayInfo(subActivityId, awardId, '', '', gameAccount, eventVisitorId);
|
|
|
// let payRet = await pay(subActivityId, eventVisitorId);
|