|
|
@@ -181,6 +181,19 @@ function handleTradingMarket() {
|
|
|
lk.msg('');
|
|
|
}
|
|
|
|
|
|
+function checkFixLimitPrice(castingId, info, lastCastingId) {
|
|
|
+ // 检查预设价格
|
|
|
+ if (lastCastingId == castingId) {
|
|
|
+ let floatInterval = lk.getVal(GandartConstKey.FloatPriceIntaval, 5);
|
|
|
+ let price = Number(lk.getVal(GandartConstKey.LimitPrice, 0));
|
|
|
+ if (price - floatInterval > Number(info.resalePrice)) {
|
|
|
+ lk.setVal(GandartConstKey.LimitPrice, info.resalePrice);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ lk.setVal(GandartConstKey.LimitPrice, info.resalePrice);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function handleCollectionDetailsByCastingId() {
|
|
|
try {
|
|
|
let data = lk.getResponseBody();
|
|
|
@@ -193,63 +206,40 @@ function handleCollectionDetailsByCastingId() {
|
|
|
let obj = data.obj;
|
|
|
let castingId = String(obj.castingId);
|
|
|
let floatInterval = lk.getVal(GandartConstKey.FloatPriceIntaval, 5);
|
|
|
+ let lastCastingId = lk.getVal(GandartConstKey.CastingId);
|
|
|
if (castingId != "") {
|
|
|
- lk.setVal(GandartConstKey.CastingId, castingId);
|
|
|
+ checkFixLimitPrice(castingId, obj, lastCastingId);
|
|
|
let collectionName = obj.collectionName;
|
|
|
+ lk.setVal(GandartConstKey.CastingId, castingId);
|
|
|
lk.setVal(GandartConstKey.CollectionName, collectionName);
|
|
|
- lk.write(`CollectionDetails#${castingId}`, JSON.stringify(obj));
|
|
|
|
|
|
- // 检查预设价格
|
|
|
- let price = Number(lk.getVal(GandartConstKey.LimitPrice, 0));
|
|
|
- if (price - floatInterval > Number(obj.resalePrice)) {
|
|
|
- lk.setVal(obj.resalePrice);
|
|
|
- }
|
|
|
+ lk.write(`CollectionDetails#${castingId}`, JSON.stringify(obj));
|
|
|
lk.log(collectionName + " castingId=" + obj.castingId);
|
|
|
lk.appendNotifyInfo(`🎉成功获取[${collectionName}]信息`);
|
|
|
} else {
|
|
|
let reqBody = lk.getRequestBody();
|
|
|
if (reqBody) {
|
|
|
let params = lk.parseQueryStr(reqBody);
|
|
|
- let lastCastingId = lk.getVal(GandartConstKey.CastingId);
|
|
|
castingId = params.castingId;
|
|
|
- lk.setVal(GandartConstKey.CastingId, castingId);
|
|
|
|
|
|
let jsonStr = lk.read(`CollectionDetails#${castingId}`);
|
|
|
- let collectionName = `[${castingId}]`;
|
|
|
+ let collectionName = `产品${castingId}`;
|
|
|
if (jsonStr) {
|
|
|
obj = JSON.parse(jsonStr);
|
|
|
collectionName = obj.collectionName;
|
|
|
- lk.setVal(GandartConstKey.CollectionName, collectionName);
|
|
|
-
|
|
|
- // 检查预设价格
|
|
|
- if (lastCastingId == castingId) {
|
|
|
- let price = Number(lk.getVal(GandartConstKey.LimitPrice, 0));
|
|
|
- if (price - floatInterval > Number(obj.resalePrice)) {
|
|
|
- lk.setVal(obj.resalePrice);
|
|
|
- }
|
|
|
- } else {
|
|
|
- lk.setVal(obj.resalePrice);
|
|
|
- }
|
|
|
- lk.log(collectionName + " castingId=" + obj.castingId);
|
|
|
+ checkFixLimitPrice(castingId, obj, lastCastingId);
|
|
|
} else {
|
|
|
let info = getCollectionMInfoById(castingId);
|
|
|
if (info) {
|
|
|
collectionName = info.collectionName;
|
|
|
- lk.setVal(GandartConstKey.CollectionName, collectionName);
|
|
|
- // 检查预设价格
|
|
|
- if (lastCastingId == castingId) {
|
|
|
- let price = Number(lk.getVal(GandartConstKey.LimitPrice, 0));
|
|
|
- if (price - floatInterval > Number(info.resalePrice)) {
|
|
|
- lk.setVal(info.resalePrice);
|
|
|
- }
|
|
|
- } else {
|
|
|
- lk.setVal(info.resalePrice);
|
|
|
- }
|
|
|
+ checkFixLimitPrice(castingId, info, lastCastingId);
|
|
|
} else {
|
|
|
- lk.setVal(GandartConstKey.CollectionName, collectionName);
|
|
|
- lk.setVal('0');
|
|
|
+ lk.setVal(GandartConstKey.LimitPrice, '0');
|
|
|
}
|
|
|
}
|
|
|
+ lk.log(collectionName + " castingId=" + obj.castingId);
|
|
|
+ lk.setVal(GandartConstKey.CastingId, castingId);
|
|
|
+ lk.setVal(GandartConstKey.CollectionName, collectionName);
|
|
|
lk.appendNotifyInfo(`🎉成功获取[${collectionName}]信息`);
|
|
|
}
|
|
|
if (castingId == "") {
|