Chuyển tới nội dung chính

Đồng Bộ MatchingVietnam

MatchingVietnam đang là Laravel + Botble CMS và có sẵn dữ liệu supplier, product, category, order và inquiry. Phase 1 không bê nguyên source này vào Business OS; thay vào đó tạo adapter đồng bộ dữ liệu cần thiết sang schema riêng của app.mcv.network.

Mapping Dữ Liệu

MatchingVietnamBusiness OSMục đích
mp_storesbusiness_profilesHồ sơ nhà cung cấp/doanh nghiệp
ec_product_categoriesmarket_access_categoriesNhóm ngành/sản phẩm
ec_productsmarket_access_productsCatalog xúc tiến thương mại
ec_product_category_productmarket_access_category_productQuan hệ sản phẩm - danh mục
contactsmarket_access_leadsLead từ form liên hệ
mp_messagesmarket_access_leadsInquiry tới nhà cung cấp
mọi bảng nguồnexternal_source_recordsIdempotency, checksum, sync status

Luồng Sync

sequenceDiagram
participant Scheduler as Laravel Scheduler
participant Command as market-access:sync-matching
participant MV as MatchingVietnam DB
participant OS as Business OS DB
participant UI as app.mcv.network/market-access

Scheduler->>Command: chạy hourly
Command->>MV: đọc categories, stores, products, inquiries
MV-->>Command: Botble rows
Command->>OS: upsert normalized tables
Command->>OS: ghi external_source_records
UI->>OS: đọc dữ liệu đã đồng bộ

Cấu Hình Env

MATCHING_DB_HOST=127.0.0.1
MATCHING_DB_PORT=3306
MATCHING_DB_DATABASE=
MATCHING_DB_USERNAME=
MATCHING_DB_PASSWORD=
MCV_MARKET_ACCESS_SOURCE_URL=https://matchingvietnam.com

Command Vận Hành

php artisan market-access:sync-matching
php artisan market-access:sync-matching --only=stores
php artisan market-access:sync-matching --only=categories
php artisan market-access:sync-matching --only=products
php artisan market-access:sync-matching --only=inquiries

Nếu chưa cấu hình MATCHING_DB_*, command sẽ cảnh báo và thoát thành công để không làm hỏng scheduler.

Quy Ước Phase 1

  • Business OS chỉ đọc dữ liệu đã đồng bộ, không query trực tiếp source MatchingVietnam trong request web.
  • Dữ liệu tiền tệ từ MatchingVietnam được chuẩn hóa về VND.
  • Ảnh Botble được dựng URL từ MCV_MARKET_ACCESS_SOURCE_URL + /storage/{path}.
  • Translation gốc được lưu trong metadata.translations để Phase 2 có thể bật đa ngôn ngữ theo catalog.

English Summary

The Market Access adapter imports MatchingVietnam supplier, category, product and inquiry records into dedicated Business OS tables. Web pages read only from the normalized local tables, while external_source_records keeps sync state, checksums and idempotency.