feat: add deployment documentation and Shopee API test script

This commit is contained in:
Victor Phan
2026-07-21 09:28:04 +07:00
parent 58b1dcd170
commit 7eadcc67f1
2 changed files with 38 additions and 0 deletions
+3
View File
@@ -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://<IP_Armbian>:8000/get_commission` là xong!
Kích hoạt môi trường ảosource venv/bin/activate
source venv/bin/activate
+35
View File
@@ -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)