From 7eadcc67f1a2a78da9051802beb1affa27cd4238 Mon Sep 17 00:00:00 2001 From: Victor Phan Date: Tue, 21 Jul 2026 09:28:04 +0700 Subject: [PATCH] feat: add deployment documentation and Shopee API test script --- serverPython/deploy_armbian.md | 3 +++ serverPython/test_shopee.py | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 serverPython/test_shopee.py diff --git a/serverPython/deploy_armbian.md b/serverPython/deploy_armbian.md index 8757b21..ac07d68 100644 --- a/serverPython/deploy_armbian.md +++ b/serverPython/deploy_armbian.md @@ -62,3 +62,6 @@ sudo systemctl start bot_shopee Để xem log xem có lỗi không, bạn dùng lệnh: `sudo journalctl -u bot_shopee -f` Bây giờ từ n8n, bạn chỉ cần tạo Webhook/HTTP Request bắn tới địa chỉ `http://:8000/get_commission` là xong! + +Kích hoạt môi trường ảosource venv/bin/activate +source venv/bin/activate \ No newline at end of file diff --git a/serverPython/test_shopee.py b/serverPython/test_shopee.py new file mode 100644 index 0000000..5ccbf78 --- /dev/null +++ b/serverPython/test_shopee.py @@ -0,0 +1,35 @@ +import uiautomator2 as u2 +import time + +# Kết nối điện thoại +d = u2.connect('10.160.138.2:5555') +link = "https://vn.shp.ee/tZVnqovi" + +print("🚀 Đang bắn lệnh ép Shopee mở thẳng sản phẩm...") +# Lệnh ADB này ép Android mở link trực tiếp bằng app Shopee +d.shell(f'am start -a android.intent.action.VIEW -d "{link}" com.shopee.vn') + +# Chờ 8 giây để app load xong hình ảnh và thông tin (mạng chậm thì tăng lên) +print("⏳ Đang đợi Shopee tải trang...") +time.sleep(8) + +print("🔍 Đang quét cấu trúc màn hình hiện tại...") +xml_dump = d.dump_hierarchy() + +# Xuất toàn bộ giao diện màn hình ra một file XML để chúng ta "soi" +with open("ui_dump.xml", "w", encoding="utf-8") as f: + f.write(xml_dump) + +print("✅ Đã xuất giao diện ra file 'ui_dump.xml'.") + +# THỬ TÌM NHANH TỰ ĐỘNG +# (Shopee thường để chữ "Hoa hồng" hoặc "%" ở một nút nào đó) +try: + commission_btn = d(textContains="Hoa hồng") + if commission_btn.exists: + print(f"🎉 TÌM THẤY: {commission_btn.get_text()}") + else: + print("⚠️ Không thấy chữ 'Hoa hồng' hiển thị ngay trên màn hình chính.") + print("👉 Vui lòng mở file 'ui_dump.xml' lên, tìm kiếm (Ctrl+F) dấu '%' để xem Shopee đang đặt tên biến hoa hồng là gì!") +except Exception as e: + print("Lỗi:", e)