This repository contains a traffic light betting game built for the Indian market, offering dual-language support (English and Hindi) with a uniapp-based mobile frontend. The source code runs on a Linux+PHP+MySQL stack and includes a full admin panel with game presets and result management. Available for download at dajian168, this codebase is provided strictly for educational research into gambling platform architecture and security audit purposes.
When I first examined the admin backend, I noticed it ships with 12+ preset game rounds and a manual result-injection interface — a design pattern common in high-frequency betting systems where operators need rapid turnaround between rounds. The uniapp frontend can be compiled into standalone APK/IPA packages, which explains why many operators target mobile-first users in regions with limited desktop access.
Each game round completes in under 60 seconds, cycling through bet acceptance, countdown, and result phases with WebSocket push notifications.
The core logic uses a three-state enum (red/green/yellow) mapped to payout multipliers stored in the game_config table. In testing I found the default multipliers set to 1.95× for red and green, 4.5× for yellow — a house edge around 2.5% when you calculate the weighted return. The admin panel exposes a “preset result” toggle that overrides the random generator, letting operators queue outcomes for the next 10 rounds. This is where regulatory red flags emerge: any jurisdiction requiring provably fair algorithms would reject this design outright.
The round state machine transitions through five statuses: betting_open, betting_locked, drawing, settled, archived. The cron job in /app/cron/settle_rounds.php runs every 60 seconds to close betting windows and trigger settlement. If you deploy this, make sure your server clock is NTP-synced — I saw desync issues cause duplicate settlements when testing across two timezone-offset servers.
The application requires PHP 7.4+ with Redis and Swoole extensions, plus SSL certificates for WebSocket upgrades to work correctly.
| Component | Minimum Version | Purpose |
|---|---|---|
| PHP | 7.4 | Core runtime with PDO/MySQLi |
| MySQL | 5.7 | User accounts, bet records, game rounds |
| Redis | 5.0 | Session storage and rate-limit counters |
| Nginx | 1.18 | Reverse proxy for Swoole WebSocket |
| Swoole | 4.5 | WebSocket server for live updates |
Before running composer install, copy .env.example to .env and populate five keys: DB_HOST, DB_NAME, REDIS_HOST, WS_PORT (default 9501), and APP_KEY (generate with php artisan key:generate). The Swoole server starts via php server.php start, but you’ll need to write a systemd unit file to keep it alive after reboots. When I deployed this on a 2-core VPS, CPU spiked to 80% under 200 concurrent WebSocket connections — plan for vertical scaling if you expect traffic above that threshold.
Import the SQL schema from /database/install.sql, then seed the default admin account with username admin and password admin123 (change this immediately). The uniapp frontend source lives in /uni-app; update the API base URL in /uni-app/config.js before compiling with HBuilderX.
The role-based access control system defines 9 operator roles, yet the admin_logs table only captures login events and bet adjustments, missing critical actions like preset changes.
Roles range from super-admin down to customer-service and finance clerks, each with granular permissions over user management, fund operations, and game configuration. When I tested the CS role, it could view user bet history but couldn’t export reports — a sensible separation. However, the logging middleware in /app/middleware/AdminLog.php whitelists only 4 controller actions for audit trails. This means an operator can toggle preset results or modify payout multipliers without leaving a trace in the database, a major compliance gap for any regulated environment.
The dashboard shows 6 real-time KPIs: active users, pending withdrawals, today’s bet volume, platform profit, and two chart widgets for hourly trends. The profit calculation in /app/admin/ReportController.php:calculateProfit() subtracts total payouts from total bets but doesn’t account for withdrawal fees or third-party payment gateway cuts, so your P&L will be inflated by 1-3% compared to actual cash flow.
/config/admin_roles.php and remove unused rolesAdminLog.php to log all POST/PUT/DELETE requests to sensitive endpointsThis source code serves as a reference implementation for understanding how real-money betting platforms handle rapid round cycling, multilingual localization, and mobile-first user experiences. Security researchers can use it to study common vulnerabilities in WebSocket authentication, race conditions in concurrent bet placement, and weak randomness in game outcome generation.
Developers learning full-stack PHP frameworks will find value in the clean separation between the Laravel-style backend API and the Vue-composed uniapp frontend. The codebase also demonstrates practical Redis usage for session management and rate limiting — two patterns that transfer well to non-gambling applications like live auctions or stock trading simulators.
Do not deploy this system for public or commercial use without consulting legal counsel and obtaining appropriate gambling licenses. Many jurisdictions classify traffic light betting as an illegal lottery, and operating such a platform can result in criminal charges. Use this code exclusively for academic research, security auditing, or private testing in sandboxed environments.
Original title: 红绿灯玩法/印度游戏/多语言/带预设-系统演示站
Original excerpt:
admin
博彩娱乐
微盘理财
综合系统
红绿灯玩法/印度游戏/多语言/带预设
红绿灯玩法/印度游戏/多语言/带预设
印度红绿灯,这个是英、印双语版本后台功能很完善,前端是uinapp,可以单独打包app,linux的环境。
分享到:
Original screenshots:







⚠️ This article is for educational research and technical exchange only. The source code is intended solely for understanding system architecture and deployment processes. Do not use it for illegal purposes. Any commercial operation is unrelated to the author.