Show KDocs upload status
This commit is contained in:
@@ -804,6 +804,16 @@ class KDocsUploader:
|
|||||||
status_tracked = False
|
status_tracked = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
try:
|
||||||
|
account = safe_get_account(user_id, account_id)
|
||||||
|
if account and self._should_mark_upload(account):
|
||||||
|
prev_status = getattr(account, "status", None)
|
||||||
|
account.status = "上传截图"
|
||||||
|
self._emit_account_update(user_id, account)
|
||||||
|
status_tracked = True
|
||||||
|
except Exception:
|
||||||
|
prev_status = None
|
||||||
|
|
||||||
if not self._ensure_playwright():
|
if not self._ensure_playwright():
|
||||||
self._notify_admin(unit, name, image_path, self._last_error or "浏览器不可用")
|
self._notify_admin(unit, name, image_path, self._last_error or "浏览器不可用")
|
||||||
return
|
return
|
||||||
@@ -824,16 +834,6 @@ class KDocsUploader:
|
|||||||
self._login_required = False
|
self._login_required = False
|
||||||
self._last_login_ok = True
|
self._last_login_ok = True
|
||||||
|
|
||||||
try:
|
|
||||||
account = safe_get_account(user_id, account_id)
|
|
||||||
if account and not getattr(account, "is_running", False):
|
|
||||||
prev_status = getattr(account, "status", None)
|
|
||||||
account.status = "上传截图"
|
|
||||||
self._emit_account_update(user_id, account)
|
|
||||||
status_tracked = True
|
|
||||||
except Exception:
|
|
||||||
prev_status = None
|
|
||||||
|
|
||||||
sheet_name = (cfg.get("kdocs_sheet_name") or "").strip()
|
sheet_name = (cfg.get("kdocs_sheet_name") or "").strip()
|
||||||
sheet_index = int(cfg.get("kdocs_sheet_index") or 0)
|
sheet_index = int(cfg.get("kdocs_sheet_index") or 0)
|
||||||
unit_col = (cfg.get("kdocs_unit_column") or "A").strip().upper()
|
unit_col = (cfg.get("kdocs_unit_column") or "A").strip().upper()
|
||||||
@@ -1010,6 +1010,15 @@ class KDocsUploader:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _should_mark_upload(self, account: Any) -> bool:
|
||||||
|
if not account:
|
||||||
|
return False
|
||||||
|
status_text = str(getattr(account, "status", "") or "")
|
||||||
|
if status_text:
|
||||||
|
if "运行" in status_text or "排队" in status_text:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def _search_person(self, name: str) -> None:
|
def _search_person(self, name: str) -> None:
|
||||||
self._page.keyboard.press("Control+f")
|
self._page.keyboard.press("Control+f")
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
@@ -1108,6 +1117,7 @@ class KDocsUploader:
|
|||||||
self._page.keyboard.press("Control+f")
|
self._page.keyboard.press("Control+f")
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
self._find_next()
|
self._find_next()
|
||||||
|
self._close_search()
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def _upload_image_to_cell(self, row_num: int, image_path: str, image_col: str) -> bool:
|
def _upload_image_to_cell(self, row_num: int, image_path: str, image_col: str) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user