1. Architecture
Sport FE (Bongdalu, Bongdako,..)
  • Bongdalu
    • Tổng quan về Bongdalu
    • Architecture
      • System
      • Database
      • Source Code
    • Development
      • Production
  • Bongdako
    • Tổng quan về Bongdako
    • Architecture
      • System
      • Database
      • Source Code
    • Development
      • Local
      • DEV
      • Production
  • ADMIN-BANNER
    • Tổng quan
    • Logic
      • Logic tổng thể
    • Projects
      • Architecture
        • System
        • Source Code
      • Development
        • Develop
        • Production
      • Public API
        • API
      • Database
        • Cấu trúc Database
      • Admin FE
        • Hướng dẫn Đăng nhập
        • QUẢN LÝ SITE (SITE MANAGEMENT)
        • QUẢN LÝ GIẢI ĐẤU (LEAGUE MANAGEMENT)
        • QUẢN LÝ NHÀ CUNG CẤP (SUPPLIER MANAGEMENT)
        • TIP & CHUYÊN GIA - TAB QUẢN LÝ TIPS (TIPS MANAGEMENT)
        • WHITELIST
        • QUẢN LÝ MINIGAME (MINIGAME MANAGEMENT)
        • TRAFFIC REPORT
        • TOOLS - RAPID DATA
        • TOOLS - LIVE SITES
        • TOOLS - SUPPLIERS
        • THEME / PLUGIN
        • NGƯỜI DÙNG - PHÂN QUYỀN VÀ HIỂN THỊ (PERMISSION & DISPLAY MANAGEMENT)
        • QUẢN LÝ NGƯỜI DÙNG (USER MANAGEMENT)
        • NGƯỜI DÙNG - QUẢN LÝ NHÓM QUYỀN (ROLE GROUP MANAGEMENT)
  1. Architecture

Source Code

WinAdsSoccer/
├── 📁 .docker/                        # 🐳 Môi trường Docker
├── 📁 app/                            # 🧠 Backend Laravel (Core Logic)
│   ├── 📁 ApiDefine/                  # 📜 Định nghĩa cấu trúc dữ liệu API ngoài
│   ├── 📁 Console/                    # ⏰ Lệnh CLI & Cronjob tự động
│   │   └── 📁 Commands/               # Các lệnh Artisan (11 nhóm sport)
│   ├── 📁 Enums/                      # 🔤 Hằng số & Enum (ApiPathEnum...)
│   ├── 📁 Exceptions/                 # ⚠️ Xử lý ngoại lệ toàn cục
│   ├── 📁 Helpers/                    # 🛠️ Hàm tiện ích toàn cục
│   │   ├── Helper.php                 # Helper chính (ads, SEO, domain, cache...)
│   │   └── Util.php                   # Tiện ích nhỏ
│   ├── 📁 Http/                       # 🌐 Lớp HTTP
│   │   ├── 📁 Controllers/            # 🎮 Điều hướng yêu cầu
│   │   │   ├── 📁 Football/           # ⚽ Controllers bóng đá (legacy)
│   │   │   │   ├── 📁 Web/            # 15 controllers trang web (Home, Match, Team...)
│   │   │   │   └── 📁 Api/            # ApiClientController (proxy API ngoài)
│   │   │   ├── 📁 Frontend/           # 🆕 Controllers mới (26 file)
│   │   │   │   ├── HomeController     # Trang chủ
│   │   │   │   ├── MatchController    # Chi tiết trận đấu
│   │   │   │   ├── LeagueController   # Giải đấu / bảng xếp hạng
│   │   │   │   ├── TeamController     # Thông tin đội bóng
│   │   │   │   ├── OddsDetailController # Tỷ lệ kèo chi tiết
│   │   │   │   ├── ContentSeoController # Quản lý nội dung SEO
│   │   │   │   └── ...               # GameRate, Tips, Player, SubLeague...
│   │   │   ├── 📁 Api/                # 🔌 REST API nội bộ
│   │   │   │   ├── MatchController    # Dữ liệu trận đấu
│   │   │   │   ├── OddsController     # Dữ liệu kèo
│   │   │   │   └── CacheController    # Quản lý cache
│   │   │   ├── 📁 Baseball/           # ⚾ Controllers bóng chày
│   │   │   ├── 📁 Basketball/         # 🏀 Controllers bóng rổ
│   │   │   ├── 📁 Tennis/             # 🎾 Controllers tennis
│   │   │   ├── 📁 Iframe/             # 🖼️ LiveController (iframe nhúng)
│   │   │   └── 📁 Cronjobs/           # ⏱️ Tác vụ định kỳ
│   │   ├── 📁 Middleware/             # 🔒 Auth, locale, phân quyền...
│   │   └── 📁 Repositories/           # Data Access Layer
│   ├── 📁 Jobs/                       # 📬 Queue jobs (LoadImagesSaveLocal)
│   ├── 📁 Libraries/                  # 📚 Thư viện tùy chỉnh
│   │   ├── BaseSport.php              # Class cơ sở
│   │   └── Soccer.php                 # Logic soccer nâng cao (~42KB)
│   ├── 📁 Models/                     # 🗄️ Eloquent Models (34 file)
│   │   ├── Schedule.php               # Lịch thi đấu
│   │   ├── Score.php                  # Kết quả / tỷ số
│   │   ├── Team.php                   # Đội bóng
│   │   ├── Player.php                 # Cầu thủ
│   │   ├── Sclass.php / SubSclass.php # Giải đấu / giải phụ
│   │   ├── EuropeOdds.php             # Kèo châu Âu
│   │   ├── MultiLetGoal.php           # Kèo chấp
│   │   ├── MultiTotalScore.php        # Kèo tài xỉu
│   │   ├── Standard.php               # Bảng xếp hạng
│   │   └── Company.php                # Nhà cái
│   ├── 📁 Providers/                  # ⚙️ Service Providers (7 file)
│   │   └── AppServiceProvider.php     # Đăng ký cấu hình (domain, ads URL...)
│   ├── 📁 Repositories/               # 📂 Repository Pattern
│   ├── 📁 Scraper/                    # 🕷️ Web Scraper (WebScraper.php)
│   └── 📁 Services/                   # 🏗️ Business Logic (26 file + thư mục)
│       ├── ApiClientService.php       # Gọi API ngoài ~27KB
│       ├── ApiService.php             # Xử lý dữ liệu API ~26KB
│       ├── AdService.php              # Quản lý quảng cáo ~27KB
│       ├── ScheduleService.php        # Lịch thi đấu ~12KB
│       ├── TeamService.php            # Đội bóng ~8KB
│       ├── SEOService.php             # SEO tự động
│       ├── 📁 Frontend/               # Services tầng frontend mới
│       │   ├── MatchService.php       # Logic trận đấu ~69KB (lớn nhất)
│       │   ├── LeagueService.php      # Logic giải đấu ~36KB
│       │   ├── TeamService.php        # Logic đội bóng ~22KB
│       │   └── FrontendService.php    # Service tổng hợp ~18KB
│       ├── 📁 Odds/                   # Kèo chấp / tài xỉu
│       ├── 📁 EuropeOdds/             # Kèo châu Âu
│       ├── 📁 Score/                  # Tỷ số trực tiếp
│       ├── 📁 League/                 # Bảng xếp hạng
│       ├── 📁 Bot/                    # Bot tự động
│       ├── 📁 Database/               # Đồng bộ database
│       └── 📁 SixInOne/               # Màn hình 6in1
│
├── 📁 config/                         # ⚙️ Cấu hình hệ thống (18 file)
│   ├── app.php                        # App config, domain, URL prefix
│   ├── database.php                   # MySQL, SQL Server connections
│   ├── cache.php                      # Redis cache
│   └── broadcasting.php               # WebSocket / Laravel Echo
│
├── 📁 database/                       # 🐘 CSDL
│   ├── 📁 migrations/                 # Schema bảng
│   ├── 📁 seeders/                    # Dữ liệu mẫu
│   └── 📁 factories/                  # Factory testing
│
├── 📁 docs/                           # 📖 Tài liệu dự án
│   ├── architecture.md                # Kiến trúc tổng thể
│   ├── prd.md                         # Product Requirements
│   └── 📁 stories/ / 📁 prd/          # User stories & PRD chi tiết
│
├── 📁 public/                         # 🌐 Web root
│   ├── 📁 assets/                     # CSS/JS tĩnh (banner.js, css.css...)
│   ├── 📁 build/                      # Output Vite build
│   ├── 📁 images/                     # Ảnh tĩnh
│   ├── 📁 soccer/                     # Icon, âm thanh livescore
│   ├── 📁 football/                   # Ảnh đội bóng (webpc)
│   ├── 📁 *_iframe/                   # Bundle Vue.js cho từng iframe
│   ├── firebase-messaging-sw.js       # Firebase push notification
│   └── sitemap.xml                    # SEO sitemap
│
├── 📁 resources/                      # 🎨 Frontend Resources
│   ├── 📁 views/                      # Blade Templates
│   │   ├── 📁 football/               # ⚽ Trang bóng đá (layouts + pages)
│   │   │   └── 📁 pages/              # home, detail, fixture, results,
│   │   │                              #   team, match-detail, odds-detail...
│   │   ├── 📁 frontend/               # 🆕 Views frontend mới
│   │   ├── 📁 basketball/             # 🏀 Bóng rổ
│   │   ├── 📁 tennis/                 # 🎾 Tennis
│   │   ├── 📁 baseball/               # ⚾ Bóng chày
│   │   └── 📁 components/             # Blade components dùng chung
│   ├── 📁 js/                         # 🟨 Vue.js 3 source
│   │   ├── *_iframe.js                # Entry points cho từng iframe
│   │   ├── 📁 views/                  # Vue SFC pages (home, league, gamerate...)
│   │   ├── 📁 components/             # Vue components
│   │   ├── 📁 services/               # Axios API calls
│   │   ├── 📁 store/                  # Pinia state management
│   │   ├── 📁 routes/                 # Vue Router
│   │   └── 📁 i18n/                   # Internationalization
│   └── 📁 lang/                       # 🌍 Đa ngôn ngữ PHP
│       ├── 📁 en/                     # Tiếng Anh
│       ├── 📁 vn/                     # Tiếng Việt
│       └── 📁 th/                     # Tiếng Thái
│
├── 📁 routes/                         # 🗺️ Routing
│   ├── football.php                   # Routes bóng đá ~26KB
│   ├── football_thai.php              # Routes tiếng Thái ~31KB
│   ├── basketball.php                 # Routes bóng rổ
│   ├── api.php                        # REST API routes
│   └── 📁 baseball/ tennis/ frontend/ # Routes từng môn
│
├── 📄 vite.config.*.js                # Build config cho từng iframe
├── 📄 docker-compose.yml              # Docker production
├── 📄 .gitlab-ci.yml                  # CI/CD pipeline
├── 📄 .env / .env.*                   # 🔑 Biến môi trường (từng domain)
└── 📄 artisan                         # 🚀 Laravel CLI

🔍 Giải thích Chi tiết#

🧠 Backend Architecture (Layered)#

TầngThư mụcVai trò
Routeroutes/URL → Controller
Controllerapp/Http/Controllers/Nhận request, trả response
Serviceapp/Services/Business logic thuần túy
Repositoryapp/Repositories/Truy xuất dữ liệu (ẩn chi tiết DB)
Modelapp/Models/Eloquent ORM
Helperapp/Helpers/Helper.phpHàm global (ads, domain, cache...)
Có 2 lớp Controllers song song: Football/Web/ (legacy cũ) và Frontend/ (refactored mới, sạch hơn)

🟨 Frontend: Hybrid Blade + Vue.js Iframe#

Dự án dùng kiến trúc "Iframe Hybrid" độc đáo:
Blade → render HTML chính cho SEO
Vue.js SPA → nhúng vào trang qua <iframe>, có build riêng
IframeEntryOutput
Trang chủhome_iframe.jspublic/home_iframe/
Lịch thi đấufixture_iframe.jspublic/fixture_iframe/
Bảng XHrank_iframe.jspublic/rank_iframe/
Tỷ lệ kèorate_iframe.jspublic/rate_iframe/
Kết quảresult_iframe.jspublic/result_iframe/
6-in-16in1_iframe.jspublic/6in1_iframe/

🎯 Hệ thống Quảng Cáo#

AppServiceProvider  →  đăng ký ad_banner_url theo domain
Helper.php          →  is_ads_enable(), get_domain_detail()
AdService.php       →  business logic hiển thị ads (~27KB)
public/assets/banner.js  →  inject banner phía client (Revive Adserver)
Mỗi domain có cấu hình ads riêng lưu trong DB, đọc qua cache Redis.

🌍 Đa Ngôn Ngữ#

Ngôn ngữPHPVueRoute riêng
🇻🇳 Việtlang/vn/js/lang/football.php
🇬🇧 Anhlang/en/js/lang/football.php
🇹🇭 Tháilang/th/js/lang/football_thai.php

📊 Các Môn Thể Thao#

MônControllersRoutesViews
⚽ Bóng đáFootball/ + Frontend/football.php (route nhiều nhất)views/football/
🏀 Bóng rổBasketball/basketball.phpviews/basketball/
🎾 TennisTennis/routes/tennis/views/tennis/
⚾ Bóng chàyBaseball/routes/baseball/views/baseball/
Bóng đá là môn chính — route file lớn nhất (~31KB bản Thai), service phức tạp nhất (MatchService.php ~69KB).
Modified at 2026-03-25 08:58:10
Previous
Database
Next
Local
Built with