|
|
@@ -28,7 +28,7 @@ const HbcpreConstKey = {
|
|
|
myOwnSeriesListDict: 'HbcpreMyOwnSeriesList',
|
|
|
myOwnSeriesDetail: 'HbcpreMyOwnSeriesDetail',
|
|
|
|
|
|
- // 下单相关的
|
|
|
+ // 下单相关
|
|
|
marketSeriesDataGrabEnabled: 'HbcpreOrderItemDataGrabEnabled',
|
|
|
marketItemWatchLocked: 'HbcpreCollectionWatchLocked',
|
|
|
marketFastModeEnabled: 'HbcpreOrderFastModeEnabled',
|
|
|
@@ -38,7 +38,7 @@ const HbcpreConstKey = {
|
|
|
marketOrderLimitPrice: 'HbcpreOrderLimitPrice',
|
|
|
marketOrderPriceInterval: 'HbcpreFloatPriceIntaval',
|
|
|
|
|
|
- // 首发相关的
|
|
|
+ // 首发相关
|
|
|
homeSeriesDataGrabEnabled: 'HbcpreHomeSeriesDataGrabEnabled',
|
|
|
homeSeriesCacheModeEnabled: 'HbcpreHomeSeriesCacheModeEnabled',
|
|
|
homeSeriesOpenTimeOffset: 'HbcpreOpeningTimeOffset',
|
|
|
@@ -48,20 +48,23 @@ const HbcpreConstKey = {
|
|
|
homeSeriesName: 'HbcpreHomeSeriesName',
|
|
|
homeSeriesLimitBuy: 'HbcpreHomeSeriesLimitBuy',
|
|
|
|
|
|
- drawItemDataGrabEnabled: 'HbcpreDrawItemDataGrabEnabled',
|
|
|
- compoundItemDataGrabEnabled: 'HbcpreCompoundItemDataGrabEnabled',
|
|
|
+ // 合成相关
|
|
|
+ compositeItemDataGrabEnabled: 'HbcpreCompoundItemDataGrabEnabled',
|
|
|
+ compositeActivityData: 'HbcpreCompoundActivityData',
|
|
|
+ compositeActivityId: 'HbcpreCompoundActivityId',
|
|
|
+ compositeActivityName: 'HbcpreCompoundActivityName',
|
|
|
+
|
|
|
+ // 兑换
|
|
|
exchangeItemDataGrabEnabled: 'HbcpreExchangeItemDataGrabEnabled',
|
|
|
+ exchangeActivityData: 'HbcpreExchangeActivityData',
|
|
|
+ exchangeActivityId: 'HbcpreExchangeActivityId',
|
|
|
+ exchangeActivityName: 'HbcpreExchangeActivityName',
|
|
|
|
|
|
+ drawItemDataGrabEnabled: 'HbcpreDrawItemDataGrabEnabled',
|
|
|
drawActivityData: 'HbcpreDrawActivityData',
|
|
|
drawActivityId: 'HbcpreDrawActivityId',
|
|
|
drawActivityRunCount: 'HbcpreDrawActivityRunCount',
|
|
|
|
|
|
- compoundActivityData: 'HbcpreCompoundActivityData',
|
|
|
- compoundActivityId: 'HbcpreCompoundActivityId',
|
|
|
-
|
|
|
- exchangeActivityData: 'HbcpreExchangeActivityData',
|
|
|
- exchangeActivityId: 'HbcpreExchangeActivityId',
|
|
|
-
|
|
|
// 临时
|
|
|
tmpContractData: 'HbcpreTmpContractData',
|
|
|
};
|
|
|
@@ -153,8 +156,8 @@ function isHomeSeriesDataGrabEnabled() {
|
|
|
return JSON.parse(flag);
|
|
|
}
|
|
|
|
|
|
-function isCompoundItemGrabEnabled() {
|
|
|
- let flag = magicJS.data.read(HbcpreConstKey.compoundItemDataGrabEnabled, null);
|
|
|
+function isCompositeItemGrabEnabled() {
|
|
|
+ let flag = magicJS.data.read(HbcpreConstKey.compositeItemDataGrabEnabled, null);
|
|
|
if (flag == null) {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -315,7 +318,7 @@ function checkHandleRequest() {
|
|
|
break;
|
|
|
default:
|
|
|
if (path.indexOf('/mall/works/compositeList') > -1) {
|
|
|
- handlerCompoundData();
|
|
|
+ handlerCompositeList();
|
|
|
} else if (path.indexOf('/mall/order/detail') > -1) {
|
|
|
// 订单详情
|
|
|
handleOrderDetail();
|
|
|
@@ -509,10 +512,19 @@ function handlerHomePageInfo(){
|
|
|
continue;
|
|
|
}
|
|
|
const params = magicJS.parseQueryStr(item.url);
|
|
|
+ params.createTime = item.createTime;
|
|
|
+ params.updateTime = item.createTime;
|
|
|
+ params.url = item.url;
|
|
|
if(item.name.indexOf('合成') > -1){
|
|
|
-
|
|
|
+ if (isCompositeItemGrabEnabled()) {
|
|
|
+ magicJS.data.write(HbcpreConstKey.compositeActivityId, data.eventsId);
|
|
|
+ magicJS.data.write(HbcpreConstKey.compositeActivityName, '');
|
|
|
+ }
|
|
|
}else if(item.name.indexOf('兑换') > -1){
|
|
|
-
|
|
|
+ if (isExchangeItemGrabEnabled()){
|
|
|
+ magicJS.data.write(HbcpreConstKey.exchangeActivityId, data.eventsId);
|
|
|
+ magicJS.data.write(HbcpreConstKey.exchangeActivityName, '');
|
|
|
+ }
|
|
|
}else if(item.name.indexOf('抽奖') > -1){
|
|
|
|
|
|
}
|
|
|
@@ -711,10 +723,13 @@ function handlerMySeriesList() {
|
|
|
if (reqData.type == 0 || reqData.type == 1) {
|
|
|
let itemList = rspData.data.list;
|
|
|
let cntDict = readMySeriesOwnCntFakeData();
|
|
|
+
|
|
|
+ let existsIds = {};
|
|
|
for (let i = 0; i < itemList.length; i++) {
|
|
|
const item = itemList[i];
|
|
|
const seriesId = item.seriesId;
|
|
|
mySeriesData[seriesId] = item;
|
|
|
+ existsIds[seriesId] = 1;
|
|
|
|
|
|
const seriesName = item.seriesName;
|
|
|
if (cntDict[seriesId]) {
|
|
|
@@ -725,6 +740,12 @@ function handlerMySeriesList() {
|
|
|
item.seriesName = `${seriesName}#¥${parseFloat(item.avgPrice).toFixed(2)}`;
|
|
|
item.authorName = `存量(${formatNumberWithKAndW(item.soldNum)}/${formatNumberWithKAndW(item.issueNum)})`;
|
|
|
}
|
|
|
+ // 拥有数量=0
|
|
|
+ for (let sId in cntDict){
|
|
|
+ if(!existsIds[sId]){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
magicJS.data.write(HbcpreConstKey.myOwnSeriesListDict, mySeriesData);
|
|
|
gRetBody = rspData;
|
|
|
}
|
|
|
@@ -831,7 +852,7 @@ function handlerFocus(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function handlerCompoundData() {
|
|
|
+function handlerCompositeList() {
|
|
|
let rspData = getResponsePlainData();
|
|
|
if (!rspData) {
|
|
|
return;
|
|
|
@@ -849,15 +870,17 @@ function handlerCompoundData() {
|
|
|
// 1=合成 3=兑换
|
|
|
let eventsType = data.eventsType;
|
|
|
if(eventsType == 1){
|
|
|
- if (isCompoundItemGrabEnabled()) {
|
|
|
- magicJS.data.write(HbcpreConstKey.compoundActivityData, data);
|
|
|
- magicJS.data.write(HbcpreConstKey.compoundActivityId, data.eventsId);
|
|
|
+ if (isCompositeItemGrabEnabled()) {
|
|
|
+ magicJS.data.write(HbcpreConstKey.compositeActivityData, data);
|
|
|
+ magicJS.data.write(HbcpreConstKey.compositeActivityId, data.eventsId);
|
|
|
+ magicJS.data.write(HbcpreConstKey.compositeActivityName, data.eventsName);
|
|
|
magicJS.notification.post(scriptName, "", `🎉[合成]<${data.eventsName}>采集成功!`);
|
|
|
}
|
|
|
} else if(eventsType == 3){
|
|
|
if (isExchangeItemGrabEnabled()){
|
|
|
magicJS.data.write(HbcpreConstKey.exchangeActivityData, data);
|
|
|
magicJS.data.write(HbcpreConstKey.exchangeActivityId, data.eventsId);
|
|
|
+ magicJS.data.write(HbcpreConstKey.exchangeActivityName, data.eventsName);
|
|
|
magicJS.notification.post(scriptName, "", `🎉[兑换]<${data.eventsName}>采集成功!`);
|
|
|
}
|
|
|
}
|
|
|
@@ -892,7 +915,7 @@ function handlerCompoundData() {
|
|
|
let iData = ownList[i];
|
|
|
// iData = {
|
|
|
// "bonusRuleList": [],
|
|
|
- // "groupId": 23,
|
|
|
+ // "groupId": 30,
|
|
|
// "num": 4,
|
|
|
// "seriesList": [
|
|
|
// {
|
|
|
@@ -908,10 +931,54 @@ function handlerCompoundData() {
|
|
|
// }
|
|
|
// ]
|
|
|
// }
|
|
|
+ let ownSeriesList = iData.seriesList;
|
|
|
+ if(iData.num > ownSeriesList.length){
|
|
|
+ addCompositeFakeWorksToSeries(ownSeriesList, needList[i], iData.num - ownList.length);
|
|
|
+ }
|
|
|
}
|
|
|
gRetBody = rspData;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+function getNRandomDigits(n) {
|
|
|
+ const min = Math.pow(10, n-1);
|
|
|
+ const max = Math.pow(10, n) - 1;
|
|
|
+ return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
|
+}
|
|
|
+
|
|
|
+function getRandomInt(min, max) {
|
|
|
+ return Math.floor(Math.random() * (max - min + 1) + min);
|
|
|
+}
|
|
|
+
|
|
|
+function getRandomFakeWorksData(seriesId, ctrlValue){
|
|
|
+ return {
|
|
|
+ worksId: ctrlValue*100000000+getRandomInt(10000000,100000000),
|
|
|
+ worksNo: ctrlValue*100000+getNRandomDigits(6),
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+function addCompositeFakeWorksToSeries(ownSeriesList, needData, num){
|
|
|
+ let needSeriesList = needData.seriesList;
|
|
|
+ for(let i=0; i < needSeriesList.length; i++){
|
|
|
+ const nedSeries = needSeriesList[i];
|
|
|
+ const ownSeries = ownSeriesList[i];
|
|
|
+ if(!ownSeries){
|
|
|
+ ownSeries = shallowClone(nedSeries);
|
|
|
+ ownSeries.worksList = [];
|
|
|
+ ownSeriesList[i] = ownSeries;
|
|
|
+ }
|
|
|
+ while(num > 0){
|
|
|
+ const fkWorksData = getRandomFakeWorksData(ownSeries.seriesId, num);
|
|
|
+ ownSeries.worksList.push({
|
|
|
+ worksId: fkWorksData.worksId,
|
|
|
+ worksNo: fkWorksData.worksNo,
|
|
|
+ });
|
|
|
+ num -= 1;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function handleAwardIndex() {
|
|
|
let rspData = getResponsePlainData();
|
|
|
if (!rspData) {
|