Skip to content

📋 Cấu Hình Chi Tiết

Dành cho: Kỹ thuật viên hoặc Team Lead cần thêm/sửa khách hàng và loại báo cáo trong hệ thống.


Tổng Quan Các File Cấu Hình

GBS Crawler sử dụng 2 file CSV và 1 file .env để cấu hình toàn bộ hệ thống:

config/
├── customers.example.csv ← File mẫu danh sách khách hàng
├── crawl_jobs.example.csv← File mẫu cấu hình báo cáo
├── customers.csv         ← (Tạo từ file mẫu) Ai là khách hàng?
└── crawl_jobs.csv        ← (Tạo từ file mẫu) Cần tải báo cáo gì?

.env                      ← Thông tin Telegram Bot (cảnh báo lỗi)

⚠️ Bảo mật: Các file customers.csv, crawl_jobs.csv.env đã được chặn không cho push lên GitHub thông qua .gitignore để tránh lộ thông tin. Bạn phải luôn copy từ file .example.csv ra để sử dụng thực tế.


1. File customers.csv — Danh Sách Khách Hàng

Mẫu đầy đủ

csv
customer_id,customer_name,marketplace,seller_url,username,password,extra_params,notes,profile_name
vita_dairy,Vita Dairy,shopee,https://banhang.shopee.vn,,,,,Vita Dairy
vita_dairy,Vita Dairy,lazada,https://sellercenter.lazada.vn,,,,,Vita Dairy
vita_dairy,Vita Dairy,tiktok,https://seller-vn.tiktok.com,,,,,Vita Dairy
dutch_lady,Dutch Lady,shopee,https://banhang.shopee.vn,,,,,Dutch Lady

Quy tắc quan trọng

  1. Mỗi dòng = 1 tài khoản sàn. Nếu Vita Dairy bán trên 3 sàn → cần 3 dòng.

  2. customer_id phải nhất quán giữa customers.csvcrawl_jobs.csv.

    • ✅ Đúng: vita_dairy (viết thường, gạch dưới)
    • ❌ Sai: Vita Dairy, vitadairy, VD
  3. profile_name nên giống nhau cho tất cả sàn của cùng 1 khách hàng. Điều này giúp tổ chức thư mục profiles/ gọn gàng.

  4. Không lưu mật khẩu trong file CSV. Hệ thống sử dụng Cookie từ browser profile, không cần username/password.

URL Seller Center chuẩn

SànURL
Shopee VNhttps://banhang.shopee.vn
Lazada VNhttps://sellercenter.lazada.vn
TikTok Shop VNhttps://seller-vn.tiktok.com

2. File crawl_jobs.csv — Cấu Hình Báo Cáo

Mẫu đầy đủ

csv
customer_id,marketplace,report_type,frequency,priority,enabled,date_range_type,notes
vita_dairy,shopee,income,monthly,high,true,last_month,Thu nhập sàn
vita_dairy,shopee,statement,monthly,high,true,last_month,Sao kê PDF
vita_dairy,shopee,wallet,monthly,high,true,last_month,Số dư ví
vita_dairy,shopee,ads_onsite,daily,medium,true,yesterday,Quảng cáo nội sàn
vita_dairy,shopee,ads_wallet,monthly,high,true,last_month,Lịch sử ví ads
vita_dairy,shopee,affiliate_bill,monthly,medium,true,last_month,Đối soát affiliate
vita_dairy,shopee,affiliate_product,daily,medium,true,yesterday,Affiliate theo SP

Danh Sách Các Loại Báo Cáo Hiện Có

Shopee

report_typeMô tảTần suất phổ biến
incomeThu nhập tổng hợp (trang Tài Chính → Xuất)monthly
statementSao kê thu nhập (PDF/Excel)monthly
walletSố dư ví ShopeePaymonthly
ads_onsiteQuảng cáo nội sàn (CPC) — xuất 2 loạidaily
ads_walletLịch sử giao dịch ví quảng cáomonthly
affiliate_billĐối soát tiếp thị liên kết (quy trình 2 bước)monthly
affiliate_productBáo cáo affiliate theo sản phẩmdaily

TikTok Shop

report_typeMô tảTần suất phổ biến
incomeGiao dịch đã quyết toánmonthly
walletLịch sử rút tiềnmonthly
affiliate_ordersĐơn hàng affiliatedaily
ads_dashboardDashboard quảng cáo shopdaily
ads_costChi phí ads (Business Center)monthly
ads_revenueThanh toán ads (Business Center)monthly
affiliate_invoiceHoá đơn hoa hồng affiliatemonthly

Lazada

report_typeMô tảTần suất phổ biến
incomeChi tiết thu nhậpmonthly
statementSao kê thángmonthly
walletSố dư tài khoảnmonthly
ads_overviewTổng quan ads nội sàndaily
ads_maxTài Trợ Max (theo sản phẩm)daily
ads_displayTài Trợ Hiển Thị (theo sản phẩm)daily
ads_walletLịch sử giao dịch adsmonthly
logisticsChi tiết phí vận chuyểnmonthly

Giá Trị Cho Các Cột

CộtGiá trị có thểMô tả
frequencydaily, monthlyDaily = tải mỗi ngày, Monthly = tải 1 lần/tháng
priorityhigh, medium, lowJob high chạy trước
enabledtrue, falseĐặt false để tạm dừng mà không cần xóa dòng
date_range_typeyesterday, last_month, last_weekKhoảng thời gian dữ liệu

3. Các Thao Tác Phổ Biến

Thêm khách hàng mới hoàn chỉnh

  1. Thêm dòng vào customers.csv:
csv
vinamilk,Vinamilk,shopee,https://banhang.shopee.vn,,,,,Vinamilk
vinamilk,Vinamilk,tiktok,https://seller-vn.tiktok.com,,,,,Vinamilk
  1. Thêm các job vào crawl_jobs.csv:
csv
vinamilk,shopee,income,monthly,high,true,last_month,
vinamilk,shopee,wallet,monthly,high,true,last_month,
vinamilk,tiktok,income,monthly,high,true,last_month,
  1. Tạo profile và đăng nhập:
bash
uv run scripts/gbs_ops.py client add --name "Vinamilk"
gbs login -c vinamilk -m shopee
gbs login -c vinamilk -m tiktok
  1. Test:
bash
gbs crawl -c vinamilk --dry-run
gbs crawl -c vinamilk

Tạm dừng 1 loại báo cáo

Đổi enabled từ truefalse trong crawl_jobs.csv:

csv
vinamilk,shopee,ads_onsite,daily,medium,false,yesterday,Tạm dừng vì KH chưa chạy ads

Tạm dừng toàn bộ của 1 khách hàng

Đổi tất cả dòng enabled thành false, hoặc đơn giản xóa khỏi crawl_jobs.csv.


4. File .env — Biến Môi Trường

env
# === Telegram Bot ===
TELEGRAM_BOT_TOKEN="your_bot_token"
TELEGRAM_CHAT_ID="your_chat_id"

⚠️ File .env đã được thêm vào .gitignore — không bao giờ commit lên Git.


📌 Xem tiếp: Cài đặt & Khởi động | Tham chiếu lệnh CLI

Built with DocKit Premium