Đồ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
| MatchingVietnam | Business OS | Mục đích |
|---|---|---|
mp_stores | business_profiles | Hồ sơ nhà cung cấp/doanh nghiệp |
ec_product_categories | market_access_categories | Nhóm ngành/sản phẩm |
ec_products | market_access_products | Catalog xúc tiến thương mại |
ec_product_category_product | market_access_category_product | Quan hệ sản phẩm - danh mục |
contacts | market_access_leads | Lead từ form liên hệ |
mp_messages | market_access_leads | Inquiry tới nhà cung cấp |
| mọi bảng nguồn | external_source_records | Idempotency, 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.