Files
wecom_it_smart_desk/split_upload_v8.py
Simon bea288e414 feat: 2026-07-11 全量更新 - 代办集成+会议室预定+知识迭代修复+UI统一+Bug修复
== 已部署上线 (9项) ==
- 代办事项真实数据源集成 (企微审批API 8bug修复链)
- H5/坐席端 Logo样式统一+绿色背景
- 视频引导页修复 (localStorage key v2)
- 坐席端 v9 Vue版本修复 (ElMessage._context)
- 截图按钮 v10 修复 (getDisplayMedia user gesture)
- 扫码样式恢复+H5扫码登录跳转修复
- H5截图快捷键提示

== 代码完成待部署 (3项) ==
- 知识迭代3Bug修复 (#8 POST端点/#7 MERGE幂等/#6 过期检查)
- 会议室预定-小鱼易联终端 (40文件, 40/40测试通过)
- IT资产升级审批推送 (asset_service.py)

== 需求文档 (2项) ==
- 坐席端AI辅助消息框-PRD (4项新功能确认)
- 坐席端布局优化建议 v2.0 (7天计划)

== 新增文档 ==
- 日报-2026-07-11.md
- 知识迭代Bug修复报告-20260711.md
- 会议室预定-部署指南.md
- CHANGELOG.md 更新

== 测试 ==
- test_todo_integration.py: 40/40
- test_meetingroom.py: 40/40
- test_bugfix_ki_suggestions.py: 21/21
2026-07-11 23:13:10 +08:00

68 lines
2.4 KiB
Python

"""Split and upload large file to server via JumpServer base64 chunks."""
import base64
import hashlib
import os
import subprocess
import sys
import time
PYTHON = r"C:\Users\simon\.workbuddy\binaries\python\versions\3.13.12\python.exe"
JMS = r"C:\Users\simon\.workbuddy\skills\jumpserver-ops\scripts\jms_ops.py"
LOCAL_FILE = r"D:\资料\03-项目开发\wecom_it_smart_desk\deploy_agent_v8.tar.gz"
REMOTE_FILE = "/tmp/deploy_agent_v8.tar.gz"
CHUNK_SIZE = 12 * 1024 # 12KB raw -> ~16KB base64, safe for command line
def run_jms(*args, timeout=30):
cmd = [PYTHON, JMS] + list(args)
result = subprocess.run(cmd, capture_output=True, timeout=timeout)
out = result.stdout.decode('utf-8', errors='replace') if result.stdout else ''
err = result.stderr.decode('utf-8', errors='replace') if result.stderr else ''
return out + err
def main():
with open(LOCAL_FILE, "rb") as f:
data = f.read()
md5 = hashlib.md5(data).hexdigest()
total_chunks = (len(data) + CHUNK_SIZE - 1) // CHUNK_SIZE
print(f"File: {LOCAL_FILE}")
print(f"Size: {len(data)} bytes ({len(data)/1024/1024:.2f} MB)")
print(f"MD5: {md5}")
print(f"Chunks: {total_chunks} (chunk size: {CHUNK_SIZE} bytes)")
print()
# Clear remote file
print("Clearing remote file...")
run_jms("exec", "-c", f"rm -f {REMOTE_FILE}", "--cmd-timeout", "10")
# Upload chunks
for i in range(total_chunks):
chunk = data[i * CHUNK_SIZE : (i + 1) * CHUNK_SIZE]
b64 = base64.b64encode(chunk).decode("ascii")
cmd = f'echo -n "{b64}" | base64 -d >> {REMOTE_FILE}'
result = run_jms("exec", "-c", cmd, "--cmd-timeout", "15")
if (i + 1) % 20 == 0 or i == total_chunks - 1:
print(f" Uploaded chunk {i + 1}/{total_chunks} ({(i + 1) * 100 // total_chunks}%)")
# Check for errors
if "error" in result.lower() and "traceback" not in result.lower():
# jms_ops.py always prints some status, check if the command actually failed
pass
# Verify MD5
print("\nVerifying MD5...")
result = run_jms("exec", "-c", f"md5sum {REMOTE_FILE}", "--cmd-timeout", "15")
print(f" Remote MD5: {result.strip()}")
print(f" Local MD5: {md5}")
if md5 in result:
print("\n✅ MD5 verified - upload successful!")
else:
print("\n❌ MD5 mismatch - upload may be corrupted!")
sys.exit(1)
if __name__ == "__main__":
main()