|
|
@@ -138,6 +138,7 @@ function readItemCntRwDict(){
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return gItemCntRwDict;
|
|
|
}
|
|
|
|
|
|
function getCollectionIndexData(seriesId){
|
|
|
@@ -158,6 +159,14 @@ function getCollectionName(seriesId){
|
|
|
return `${seriesId}`;
|
|
|
}
|
|
|
|
|
|
+function getCollectionPrice(seriesId){
|
|
|
+ let data = getCollectionIndexData(seriesId);
|
|
|
+ if(data){
|
|
|
+ return parseInt(data.amount || 99999.99);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
function checkHandleRequest() {
|
|
|
handleHeaders();
|
|
|
const request = magicJS.request;
|
|
|
@@ -183,6 +192,9 @@ function checkHandleRequest() {
|
|
|
case '/api/user/userinfo':
|
|
|
handleUserInfo();
|
|
|
break;
|
|
|
+ case '':
|
|
|
+ handlerMySeriesList();
|
|
|
+ break;
|
|
|
case '/api/index/getbanner':
|
|
|
// 首页banner轮播图
|
|
|
break
|
|
|
@@ -219,9 +231,9 @@ function checkHandleRequest() {
|
|
|
if (path.indexOf('/api/collection/indexdetail') > -1) {
|
|
|
// 个人资产-单个产品类别详情
|
|
|
// handleCollectionIdxDetail();
|
|
|
- }else if (path.indexOf('/api/collection/index') > -1) {
|
|
|
+ }else if (path.indexOf('/mall/user/series') > -1) {
|
|
|
// 个人资产-所有产品类别列表
|
|
|
- // handleCollectionIndex();
|
|
|
+ handlerMySeriesList();
|
|
|
}else if (path.indexOf('/api/market/packlistdetail') > -1) {
|
|
|
// 产品详情
|
|
|
// handlePacklistDetail();
|
|
|
@@ -230,7 +242,7 @@ function checkHandleRequest() {
|
|
|
handleSeriesInfo();
|
|
|
}else if (path.indexOf('/mall/resale/getSeriesList') > -1) {
|
|
|
// 产品类别
|
|
|
- handleSeriesList();
|
|
|
+ handleMarketSeriesList();
|
|
|
}else if (path.indexOf('/mall/collector/password/login')){
|
|
|
//登录
|
|
|
}
|
|
|
@@ -327,7 +339,7 @@ function handleUserInfo() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function handleSeriesList(){
|
|
|
+function handleMarketSeriesList(){
|
|
|
let rspData = getResponsePlainData();
|
|
|
if (!rspData) {
|
|
|
return;
|
|
|
@@ -376,6 +388,9 @@ function handleSeriesInfo(){
|
|
|
if (reqData) {
|
|
|
magicJS.data.write(HbcpreConstKey.castingId, reqData.seriesId);
|
|
|
let collectionName = getCollectionName(reqData.seriesId);
|
|
|
+ let collectionPrice = getCollectionPrice(reqData.seriesId);
|
|
|
+ magicJS.data.write(HbcpreConstKey.orderLimitPrice, collectionPrice);
|
|
|
+
|
|
|
magicJS.notification.post(scriptName, "", `🎉[${collectionName}]快捷下单采集成功!`);
|
|
|
}
|
|
|
}
|
|
|
@@ -395,17 +410,47 @@ function handleSeriesInfo(){
|
|
|
|
|
|
let seriesId = magicJS.data.read(HbcpreConstKey.castingId, null);
|
|
|
if(seriesId != seriesInfo.seriesId){
|
|
|
+ magicJS.data.write(HbcpreConstKey.castingId, seriesInfo.seriesId);
|
|
|
+ let collectionPrice = getCollectionPrice(seriesId);
|
|
|
+ magicJS.data.write(HbcpreConstKey.orderLimitPrice, collectionPrice);
|
|
|
+
|
|
|
magicJS.notification.post(scriptName, "", `🎉[${seriesInfo.seriesName}]快捷下单采集成功!`);
|
|
|
}
|
|
|
gRetBody = rspData;
|
|
|
}
|
|
|
|
|
|
-function handleCompoundIndex(){
|
|
|
+function handlerMySeriesList(){
|
|
|
let rspData = getResponsePlainData();
|
|
|
if (!rspData) {
|
|
|
return;
|
|
|
}
|
|
|
- if (rspData.code != 1000) {
|
|
|
+ if (rspData.code != 200) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let reqData = getRequestPlainData();
|
|
|
+ // reqData.type 0=数字资产 1=盲盒
|
|
|
+ let itemList = rspData.data.list;
|
|
|
+ let cntDict = readItemCntRwDict();
|
|
|
+ for(let i=0; i < itemList.length; i++){
|
|
|
+ const item = itemList[i];
|
|
|
+ const seriesId = item.seriesId;
|
|
|
+ const seriesName = item.seriesName;
|
|
|
+ if(cntDict[seriesId]){
|
|
|
+ item.total = cntDict[seriesId];
|
|
|
+ }else if(cntDict[seriesName]){
|
|
|
+ item.total = cntDict[seriesName];
|
|
|
+ }
|
|
|
+ item.seriesName = `${seriesName}#¥${parseFloat(item.avgPrice).toFixed(2)}`;
|
|
|
+ item.authorName = `${item.authorName}\n(${item.soldNum}/${item.issueNum})`
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function handlerCompoundData(){
|
|
|
+ let rspData = getResponsePlainData();
|
|
|
+ if (!rspData) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (rspData.code != 200) {
|
|
|
return;
|
|
|
}
|
|
|
let data = rspData.data;
|