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:
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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user