How dayzko1/mjh_app works
This repository provides a Mahjong tile-matching game in mini-app and browser forms, a browser-based themed game, and an administrative console backed by cloud-function services. Players launch and log in, play levels, earn ad rewards, and access profile, ranking, invitation, and withdrawal features; operators manage users, ads, games, invitations, withdrawals, and configuration. The mini-app API documents platform-specific cloud/HTTP routing, while sampled backend modules show service implementations. Several page and backend connections are not shown in excerpts, so those links are omitted rather than inferred.
Main entry points: src/App.tsx Admin Router · api.js Cloud API · src/App.tsx Game Shell · platform.js Platform Adapter
Components 34
Mini-app Game
- App Lifecycle
mah-miniapp/app.js - Tile Game
mah-miniapp/pages/game/game.js - Game Engine
mah-miniapp/game.js - Player Pages
mah-miniapp/pages - Cloud API
mah-miniapp/services/api.js
Web Themed Game
- Web Game Entry
mah/src/main.tsx - Game Shell
mah/src/App.tsx - Match Gameplay
mah/src/components/Game.tsx - Theme Builder
mah/src/components/ConfigDialog.tsx - Theme Definitions
mah/src/themes/interface.ts - Score Display
mah/src/components/Score.tsx - Browser Game State
mah/src/utils.ts
Admin Console
- Admin Router
admin/src/App.tsx - Admin Login
admin/src/pages/Login/index.tsx - Dashboard
admin/src/pages/Dashboard/index.tsx - User Management
admin/src/pages/UserManage/index.tsx - Withdrawal Management
admin/src/pages/WithdrawManage/index.tsx - Ad Management
admin/src/pages/AdManage/index.tsx - Game Management
admin/src/pages/GameManage/index.tsx - Invite Management
admin/src/pages/InviteManage/index.tsx - Configuration
admin/src/pages/ConfigManage/index.tsx
Cloud Services
- User Service
backend/cloudfunctions/user/index.js - Game Service
backend/cloudfunctions/game/index.js - Ad Service
backend/cloudfunctions/ad/index.js - Withdrawal Service
backend/cloudfunctions/withdraw/index.js - Admin Service
backend/cloudfunctions/admin/index.js - Cloud Logger
backend/cloudfunctions/shared/logger.js - Douyin Services
backend/douyin-cloud
Platform Runtime
- Ad Rewards
mah-miniapp/utils/ad.js - Audio
mah-miniapp/utils/sound.js - Platform Adapter
mah-miniapp/utils/platform.js - Web Adapter
mah-miniapp/web/platform-web.js
Other components
- Player
- Operator
Connections 37
- Player → App Lifecycle: launches
mah-miniapp/app.js - App Lifecycle → Ad Rewards: initializes
mah-miniapp/app.js - App Lifecycle → Audio: initializes
mah-miniapp/app.js - App Lifecycle → Cloud API: logs in through
mah-miniapp/app.js - Player → Tile Game: plays
mah-miniapp/pages/game/game.js - Tile Game → Cloud API: saves progress
mah-miniapp/pages/game/game.js - Tile Game → Ad Rewards: shows rewards
mah-miniapp/pages/game/game.js - Tile Game → Audio: plays audio
mah-miniapp/pages/game/game.js - Game Engine → Platform Adapter: uses
mah-miniapp/game.js - Cloud API → Platform Adapter: calls through
mah-miniapp/services/api.js - Ad Rewards → Platform Adapter: creates ads through
mah-miniapp/utils/ad.js - Audio → Platform Adapter: creates audio through
mah-miniapp/utils/sound.js - Web Adapter → Platform Adapter: adapts for web
mah-miniapp/web/platform-web.js - Cloud API → User Service: routes user actions
mah-miniapp/services/api.js - Cloud API → Game Service: routes game actions
mah-miniapp/services/api.js - Cloud API → Ad Service: routes ad actions
mah-miniapp/services/api.js - Cloud API → Withdrawal Service: routes withdrawal actions
mah-miniapp/services/api.js - Operator → Admin Router: uses
admin/src/App.tsx - Admin Router → Admin Login: routes to
admin/src/App.tsx - Admin Router → Dashboard: routes to
admin/src/App.tsx - Admin Router → User Management: routes to
admin/src/App.tsx - Admin Router → Withdrawal Management: routes to
admin/src/App.tsx - Admin Router → Ad Management: routes to
admin/src/App.tsx - Admin Router → Game Management: routes to
admin/src/App.tsx - Admin Router → Invite Management: routes to
admin/src/App.tsx - Admin Router → Configuration: routes to
admin/src/App.tsx - Admin Service → Cloud Logger: uses
backend/cloudfunctions/admin/index.js - Game Service → Cloud Logger: uses
backend/cloudfunctions/game/index.js - User Service → Cloud Logger: uses
backend/cloudfunctions/user/index.js - Web Game Entry → Game Shell: renders
mah/src/main.tsx - Web Game Entry → Theme Definitions: loads theme
mah/src/main.tsx - Game Shell → Match Gameplay: renders
mah/src/App.tsx - Game Shell → Theme Builder: opens
mah/src/App.tsx - Game Shell → Theme Definitions: accepts theme
mah/src/App.tsx - Game Shell → Browser Game State: reads and resets
mah/src/App.tsx - Match Gameplay → Score Display: renders
mah/src/components/Game.tsx - Match Gameplay → Browser Game State: stores progress
mah/src/components/Game.tsx