modified: amazon/__pycache__/detail_spider.cpython-39.pyc
modified: amazon/__pycache__/price_match.cpython-39.pyc modified: amazon/detail_spider.py modified: amazon/price_match.py modified: blueprints/__pycache__/admin.cpython-39.pyc modified: blueprints/__pycache__/brand.cpython-39.pyc modified: blueprints/__pycache__/main.cpython-39.pyc modified: brand_spider/__pycache__/main.cpython-39.pyc modified: main.py modified: web_source/brand.html
This commit is contained in:
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -625,7 +625,7 @@ class AmzonePriceMatch(AmamzonBase):
|
||||
if len(page_pamel) > 0:
|
||||
current_page = page_pamel[0].sr('xpath:.//ul[@class="pages"]//li[@aria-current="true"]').text
|
||||
#测试=====
|
||||
# if int(current_page) > 3:
|
||||
# if int(current_page) > 3:c
|
||||
# break
|
||||
# 测试===========
|
||||
|
||||
@@ -790,7 +790,7 @@ class AmzonePriceMatch(AmamzonBase):
|
||||
"cartShopName" : cartShopName,
|
||||
"shippingFee" : f"{shipping_fee}",
|
||||
"priceChangeStatus" : f"{adjust_prices}",
|
||||
"modifyCount" : "1",
|
||||
"priceChangeStatus" : "改价成功",
|
||||
})
|
||||
else:
|
||||
recommendedPrice = recommend_price + shipping_fee
|
||||
@@ -808,8 +808,7 @@ class AmzonePriceMatch(AmamzonBase):
|
||||
"secondPlace": price_2,
|
||||
"cartShopName": cartShopName,
|
||||
"shippingFee": f"{shipping_fee}",
|
||||
"priceChangeStatus": "",
|
||||
"modifyCount": "0",
|
||||
"priceChangeStatus": "跳过,无需改价",
|
||||
})
|
||||
|
||||
already_asin.add(asin)
|
||||
@@ -1333,36 +1332,34 @@ class PriceTask:
|
||||
"""
|
||||
|
||||
url = f"{DELETE_BRAND_API_BASE}/api/price-track/tasks/{task_id}/result"
|
||||
|
||||
country_aliases = {name: code for code, name in self.country_info.items()}
|
||||
country_key = country_aliases.get(str(country_code).strip(), str(country_code).strip())
|
||||
|
||||
countries = {}
|
||||
if asin or status:
|
||||
countries[country_key] = [
|
||||
{
|
||||
"shopMallName": shopMallName,
|
||||
"asin": asin,
|
||||
"price": status.get("currentPrice") if status.get("currentPrice") else "",
|
||||
"recommendedPrice": status.get("recommendedPrice") if status.get("recommendedPrice") else "",
|
||||
"minimumPrice": status.get("minimumPrice") if status.get("minimumPrice") else "",
|
||||
"firstPlace": status.get("firstPlace") if status.get("firstPlace") else "",
|
||||
"secondPlace": status.get("secondPlace") if status.get("secondPlace") else "",
|
||||
"cartShopName": status.get("cartShopName") if status.get("cartShopName") else "",
|
||||
"priceChangeStatus": status.get("priceChangeStatus") if status.get("priceChangeStatus") else "",
|
||||
"deleteSkipAsin": status.get("deleteSkipAsin", False),
|
||||
"removeAsin": status.get("removeAsin") if status.get("removeAsin") else "",
|
||||
"modifyCount": status.get("modifyCount") if status.get("modifyCount") else "",
|
||||
"shippingFee": status.get("shippingFee") if status.get("shippingFee") else "",
|
||||
"status": status.get("statu")
|
||||
}
|
||||
]
|
||||
|
||||
payload = {
|
||||
"shops": [
|
||||
{
|
||||
"shopName": shop_name,
|
||||
"countries": countries,
|
||||
"countries": {
|
||||
country_key : [
|
||||
{
|
||||
"shopMallName": shopMallName,
|
||||
"asin": asin,
|
||||
"price": status.get("currentPrice") if status.get("currentPrice") else "",
|
||||
"recommendedPrice": status.get("recommendedPrice") if status.get("recommendedPrice") else "",
|
||||
"minimumPrice": status.get("minimumPrice") if status.get("minimumPrice") else "",
|
||||
"firstPlace": status.get("firstPlace") if status.get("firstPlace") else "",
|
||||
"secondPlace": status.get("secondPlace") if status.get("secondPlace") else "",
|
||||
"cartShopName": status.get("cartShopName") if status.get("cartShopName") else "",
|
||||
"priceChangeStatus": "UPDATED",
|
||||
"deleteSkipAsin": status.get("deleteSkipAsin",False),
|
||||
"removeAsin": status.get("removeAsin") if status.get("removeAsin") else "",
|
||||
"modifyCount": "1",
|
||||
"shippingFee" : status.get("shippingFee") if status.get("shippingFee") else "",
|
||||
"status": status.get("statu"),
|
||||
"priceChangeStatus" : status.get("priceChangeStatus") if status.get("priceChangeStatus") else "",
|
||||
}
|
||||
]
|
||||
},
|
||||
"error": ""
|
||||
}
|
||||
]
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15
app/main.py
15
app/main.py
@@ -21,6 +21,9 @@ import requests
|
||||
import subprocess
|
||||
|
||||
from amazon.del_brand import kill_process
|
||||
|
||||
|
||||
|
||||
with open("version.txt","w",encoding="utf-8") as file:
|
||||
file.write(json.dumps({"version":version}))
|
||||
|
||||
@@ -50,8 +53,8 @@ class WindowAPI:
|
||||
def __init__(self, window):
|
||||
self._window = window
|
||||
self._is_maximized = False
|
||||
window.events.maximized += lambda *args: setattr(self, '_is_maximized', True)
|
||||
window.events.restored += lambda *args: setattr(self, '_is_maximized', False)
|
||||
window.events.maximized += lambda _: setattr(self, '_is_maximized', True)
|
||||
window.events.restored += lambda _: setattr(self, '_is_maximized', False)
|
||||
|
||||
def close(self):
|
||||
"""关闭窗口,异步执行清理逻辑"""
|
||||
@@ -334,10 +337,14 @@ class WindowAPI:
|
||||
# if payload.get("type") == "delete-brand-run" and payload.get("data").get("taskId") in runing_task:
|
||||
# return {'success': False, 'error': '已存在正在执行的删除品牌任务'}
|
||||
# 判断当前店铺是否正在运行中
|
||||
if payload.get("data",{}).get("shop_name"):
|
||||
shop_name = payload.get("data",{}).get("shop_name")
|
||||
if shop_name in runing_shop:
|
||||
return {'success': False, 'error': f'当前店铺 {shop_name} 正在执行中,请等待店铺完成之后重试'}
|
||||
if payload.get("data").get("items"):
|
||||
shop_name = payload["data"]["items"][0]["shopName"]
|
||||
if shop_name in runing_shop:
|
||||
return {'success': False, 'error': '当前店铺正在执行中,请等待店铺完成之后重试'}
|
||||
return {'success': False, 'error': f'当前店铺 {shop_name} 正在执行中,请等待店铺完成之后重试'}
|
||||
JSON_TASK_QUEUE.put(payload)
|
||||
return {'success': True, 'queue_size': JSON_TASK_QUEUE.qsize()}
|
||||
except Exception as e:
|
||||
@@ -431,7 +438,7 @@ def main():
|
||||
window.expose(api.close, api.minimize, api.maximize, api.toggle_maximize, generate_images, api.save_image, api.save_image_to_folder, api.select_folder, api.select_brand_xlsx_files, api.select_brand_folder,
|
||||
api.save_file_from_url, api.save_template_xlsx,api.save_template_zip,api.upload_file_to_java,api.open_external_url,api.enqueue_json,api.get_detail_del,api.save_file_from_url_new)
|
||||
webview.start(
|
||||
debug=True,
|
||||
debug=False,
|
||||
storage_path=cache_path,
|
||||
private_mode=False
|
||||
)
|
||||
|
||||
@@ -414,7 +414,7 @@
|
||||
<a class="nav-item" href="/new_web_source/product-risk.html">商品风险解决</a>
|
||||
<a class="nav-item" href="/new_web_source/shop-match.html">定时匹配</a>
|
||||
<a class="nav-item" href="/new_web_source/price-track.html">跟价</a>
|
||||
<a class="nav-item" href="/new_web_source/patrol-delete.html"巡店删除</a>
|
||||
<a class="nav-item" href="/new_web_source/patrol-delete.html">巡店删除</a>
|
||||
<a class="nav-item" href="/new_web_source/query-asin.html">查询ASIN</a>
|
||||
<span class="nav-item disabled">取款</span>
|
||||
<span class="nav-item disabled">店铺状态查询</span>
|
||||
@@ -785,23 +785,6 @@
|
||||
else if (status === 'cancelled') showToast('已取消');
|
||||
}
|
||||
|
||||
function verifyTerminalTaskStatus(taskId, expectedStatus) {
|
||||
return fetch('/api/brand/tasks/' + taskId, {
|
||||
credentials: 'include',
|
||||
headers: withUidHeaders({ 'X-Requested-With': 'XMLHttpRequest' })
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(res) {
|
||||
if (!res.success || !res.task) return null;
|
||||
var actualStatus = (res.task.status || '').toLowerCase();
|
||||
if (actualStatus === 'success' || actualStatus === 'failed' || actualStatus === 'cancelled') {
|
||||
return actualStatus;
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.catch(function() { return null; });
|
||||
}
|
||||
|
||||
function pollRunTask(taskId) {
|
||||
pollTaskId = taskId;
|
||||
var runProgressFill = document.getElementById('runProgressFill');
|
||||
@@ -868,13 +851,10 @@
|
||||
}
|
||||
|
||||
if (terminalStatus) {
|
||||
var verifiedStatus = await verifyTerminalTaskStatus(taskId, terminalStatus);
|
||||
if (verifiedStatus) {
|
||||
try { runTaskEventAbortController.abort(); } catch (e2) {}
|
||||
runTaskEventAbortController = null;
|
||||
onRunTaskFinished(verifiedStatus);
|
||||
return;
|
||||
}
|
||||
try { runTaskEventAbortController.abort(); } catch (e2) {}
|
||||
runTaskEventAbortController = null;
|
||||
onRunTaskFinished(terminalStatus);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (err) {}
|
||||
@@ -938,7 +918,7 @@
|
||||
});
|
||||
}
|
||||
tick();
|
||||
pollTimer = setInterval(tick, 3000);
|
||||
pollTimer = setInterval(tick, 10000);
|
||||
}
|
||||
|
||||
document.getElementById('btnRun').onclick = function() {
|
||||
@@ -1148,11 +1128,7 @@
|
||||
});
|
||||
|
||||
loadTasks();
|
||||
setInterval(function() {
|
||||
if (cachedTasks.some(function(t) { return (t.status || '').toLowerCase() === 'running'; })) {
|
||||
loadTasks();
|
||||
}
|
||||
}, 3000);
|
||||
// setInterval(loadTasks, 10000);
|
||||
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener('pywebviewready', function() {
|
||||
|
||||
Reference in New Issue
Block a user