|
|
@@ -74,6 +74,7 @@ const HbcpreConstKey = {
|
|
|
drawItemDataGrabEnabled: 'HbcpreDrawItemDataGrabEnabled',
|
|
|
drawActivityData: 'HbcpreDrawActivityData',
|
|
|
drawActivityId: 'HbcpreDrawActivityId',
|
|
|
+ drawActivityName: 'HbcpreDrawActivityName',
|
|
|
drawActivityRunCount: 'HbcpreDrawActivityRunCount',
|
|
|
|
|
|
// 临时
|
|
|
@@ -389,19 +390,20 @@ function checkHandleRequest() {
|
|
|
// "content": "",//可能需要 encodeURIComponent
|
|
|
// }
|
|
|
break;
|
|
|
- case '/api/award/index':
|
|
|
- // 限时抽奖 post= {activity_id:6}
|
|
|
- handleAwardIndex();
|
|
|
+ case '/mall/raffle/info':
|
|
|
+ // 限时抽奖 post= {raffleId:11}
|
|
|
+ handleRaffleData();
|
|
|
break;
|
|
|
- case '/api/award/awardrule':
|
|
|
- // 限时抽奖-规则
|
|
|
+ case '/mall/raffle/seriesList':
|
|
|
+ // 限时抽奖-产品 post= {raffleId:11}
|
|
|
+ handleRaffleSeriesList();
|
|
|
break;
|
|
|
- case '/api/award/awardlogs':
|
|
|
- // 限时抽奖-中奖记录
|
|
|
+ case '/mall/raffle/records':
|
|
|
+ // 限时抽奖-中奖记录 post= {page:1,pageSize:10,raffleId:11}
|
|
|
break;
|
|
|
- case '/api/award/run':
|
|
|
- // 限时抽奖-抽奖 post= {num:1 || 5,type:1,activity_id:6}
|
|
|
- handleAwardRun();
|
|
|
+ case '/mall/raffle/raffle':
|
|
|
+ // 限时抽奖-抽奖 post= {raffleId:11,raffleNum:1,seriesId:3120}
|
|
|
+ handleRaffleRun();
|
|
|
break;
|
|
|
default:
|
|
|
if (path.indexOf('/mall/works/compositeList') > -1) {
|
|
|
@@ -615,7 +617,11 @@ function handlerHomePageInfo(){
|
|
|
item.name = `${item.name}#${params.id}`;
|
|
|
}
|
|
|
}else if(item.name.indexOf('抽奖') > -1){
|
|
|
-
|
|
|
+ if (isDrawItemGrabEnabled()){
|
|
|
+ magicJS.data.write(HbcpreConstKey.drawActivityId, params.id);
|
|
|
+ magicJS.data.write(HbcpreConstKey.drawActivityName, '');
|
|
|
+ item.name = `${item.name}#${params.id}`;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
gRetBody = rspData;
|
|
|
@@ -1183,30 +1189,107 @@ function addCompositeFakeWorksToSeries(ownSeriesList, needData, num){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function handleAwardIndex() {
|
|
|
+function handleRaffleData() {
|
|
|
let rspData = getResponsePlainData();
|
|
|
if (!rspData) {
|
|
|
return;
|
|
|
}
|
|
|
- if (rspData.code != 1000) {
|
|
|
+ rspData = {
|
|
|
+ "code" : 200,
|
|
|
+ "data" : {
|
|
|
+ "personalNumber" : -1,
|
|
|
+ "raffleBonus" : 1,
|
|
|
+ "maxRaffleNumber" : 5,
|
|
|
+ "raffleName" : "华文数交惊喜抽奖活动!!",
|
|
|
+ "raffleType" : 1,
|
|
|
+ "raffleTotalNum" : 4552,
|
|
|
+ "updateTime" : 1716614116000,
|
|
|
+ "background" : "/file/oss/wc/pic/nftg/f173c6cf222d47ec8ff7506a6fc24e29.png",
|
|
|
+ "endTime" : 1716627600000,
|
|
|
+ "destroyType" : 1,
|
|
|
+ "hasWhite" : 1,
|
|
|
+ "id" : 11,
|
|
|
+ "raffleStatus" : 1,
|
|
|
+ "activityStatus" : 1,
|
|
|
+ "remainder" : -95,
|
|
|
+ "resultAddress" : "",
|
|
|
+ "startTime" : 1716616800000,
|
|
|
+ "openingTime" : 1716616270694,
|
|
|
+ "content" : "https://notice.hbcpre.com/oss/static/notify/specifics/n_specifics_6780bf194a4840f3a355d1bf69a07db6.html?v=1716613646241",
|
|
|
+ "raffleModel" : 1
|
|
|
+ },
|
|
|
+ "message" : "操作成功",
|
|
|
+ "success" : true
|
|
|
+ }
|
|
|
+ if (rspData.code != 200) {
|
|
|
return;
|
|
|
}
|
|
|
+ let reqData = getRequestPlainData();
|
|
|
if (isDrawItemGrabEnabled()) {
|
|
|
magicJS.data.write(HbcpreConstKey.drawActivityData, rspData.data);
|
|
|
- magicJS.data.write(HbcpreConstKey.drawActivityId, rspData.data.activity_id);
|
|
|
- magicJS.notification.post(scriptName, "", `🎉限时抽奖活动采集成功!`);
|
|
|
+ magicJS.data.write(HbcpreConstKey.drawActivityName, rspData.data.raffleName);
|
|
|
+ magicJS.data.write(HbcpreConstKey.drawActivityId, reqData.raffleId);
|
|
|
+ magicJS.notification.post(scriptName, "", `🎉[抽奖]<${rspData.data.raffleName}>采集成功!`);
|
|
|
+ }
|
|
|
+ gRetBody = rspData;
|
|
|
+}
|
|
|
+
|
|
|
+function handleRaffleSeriesList(){
|
|
|
+ let rspData = getResponsePlainData();
|
|
|
+ if (!rspData) {
|
|
|
+ return;
|
|
|
}
|
|
|
+ rspData = {
|
|
|
+ "code" : 200,
|
|
|
+ "data" : [
|
|
|
+ {
|
|
|
+ "amount" : 19,
|
|
|
+ "ownedNum" : 12,
|
|
|
+ "raffleTotalNum" : 0,
|
|
|
+ "seriesId" : 3120,
|
|
|
+ "worksPic" : "/file/oss/wc/pic/nftg/6f6b52d986f04c9e8912443e75c02093.png",
|
|
|
+ "raffledNum" : 0,
|
|
|
+ "raffleLimitNum" : 1,
|
|
|
+ "seriesName" : "银卡"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "message" : "操作成功",
|
|
|
+ "success" : true
|
|
|
+ }
|
|
|
+ if (rspData.code != 200) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // ownedNum 拥有的数量
|
|
|
+ // raffleLimitNum 使用数量
|
|
|
+ gRetBody = rspData;
|
|
|
}
|
|
|
|
|
|
-function handleAwardRun() {
|
|
|
+function handleRaffleRun() {
|
|
|
let reqData = getRequestPlainData();
|
|
|
if (!reqData) {
|
|
|
return;
|
|
|
}
|
|
|
let activityId = magicJS.data.read(HbcpreConstKey.drawActivityId, null);
|
|
|
- if (activityId == reqData.activity_id) {
|
|
|
- magicJS.data.write(HbcpreConstKey.drawActivityRunCount, reqData.num);
|
|
|
+ if (activityId == reqData.raffleId) {
|
|
|
+ magicJS.data.write(HbcpreConstKey.drawActivityRunCount, reqData.raffleNum);
|
|
|
}
|
|
|
+ let rspData = getResponsePlainData();
|
|
|
+ if (!rspData) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ rspData = {
|
|
|
+ "code":200,
|
|
|
+ "data":[
|
|
|
+ {
|
|
|
+ "awards":0,
|
|
|
+ "awardsName":"未中奖",
|
|
|
+ "awardsNum":1
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "message":"操作成功",
|
|
|
+ "success":true
|
|
|
+ }
|
|
|
+ gRetBody = rspData;
|
|
|
}
|
|
|
|
|
|
function transformKeys(keyStr) {
|