|
|
@@ -46,33 +46,30 @@ class GameModel extends Model
|
|
|
];
|
|
|
|
|
|
// 状态常量
|
|
|
- const STATUS_NORMAL = 0; // 正常
|
|
|
- const STATUS_MAINTAIN = 1; // 维护
|
|
|
- const STATUS_DISABLED = 2; // 停用
|
|
|
-
|
|
|
- // RTP类型常量
|
|
|
- const RTP_TYPE_AI = 1; // AI数值
|
|
|
- const RTP_TYPE_IMITATE = 2; // 仿正版
|
|
|
+ const STATUS = [
|
|
|
+ 0 => "初始",
|
|
|
+ 1 => "正常",
|
|
|
+ 2 => "维护",
|
|
|
+ ];
|
|
|
|
|
|
- // 免费游戏状态
|
|
|
- const FREE_GAME_DISABLED = 0; // 不支持购买免费游戏
|
|
|
- const FREE_GAME_ENABLED = 1; // 支持购买免费游戏
|
|
|
+ // 止损止赢功能开关状态
|
|
|
+ const FREE_STATUS = [
|
|
|
+ 0 => '关闭',
|
|
|
+ 1 => '开启',
|
|
|
+ ];
|
|
|
|
|
|
- // 止损止赢功能
|
|
|
- const TERMINAL_SPIN_DISABLED = 0; // 关闭止损止赢
|
|
|
- const TERMINAL_SPIN_ENABLED = 1; // 开启止损止赢
|
|
|
+ // 购买免费游戏功能开关状态
|
|
|
+ const TERMINAL_SPIN_STATUS = [
|
|
|
+ 0 => '关闭',
|
|
|
+ 1 => '开启',
|
|
|
+ ];
|
|
|
|
|
|
/**
|
|
|
* 获取状态文本
|
|
|
*/
|
|
|
public static function getStatusText($status): string
|
|
|
{
|
|
|
- $statusMap = [
|
|
|
- self::STATUS_NORMAL => '正常',
|
|
|
- self::STATUS_MAINTAIN => '维护',
|
|
|
- self::STATUS_DISABLED => '停用',
|
|
|
- ];
|
|
|
- return $statusMap[$status] ?? '未知';
|
|
|
+ return self::STATUS[$status] ?? '未知';
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -80,11 +77,17 @@ class GameModel extends Model
|
|
|
*/
|
|
|
public static function getRtpTypeText($rtpType): string
|
|
|
{
|
|
|
- $rtpTypeMap = [
|
|
|
- self::RTP_TYPE_AI => 'AI数值',
|
|
|
- self::RTP_TYPE_IMITATE => '仿正版',
|
|
|
- ];
|
|
|
- return $rtpTypeMap[$rtpType] ?? '未知';
|
|
|
+ $rtpTypeMap = $GLOBALS['gamePgGameConfig']['rtp_type_config'];
|
|
|
+ return $rtpTypeMap[$rtpType]['name'] ?? '未知';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取游戏平台文本
|
|
|
+ */
|
|
|
+ public static function getPlatFormText($platform): string
|
|
|
+ {
|
|
|
+ $platforms = self::getAllPlatforms();
|
|
|
+ return $platforms[$platform] ?? '未知';
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -228,60 +231,12 @@ class GameModel extends Model
|
|
|
->update($data);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 更新游戏状态
|
|
|
- */
|
|
|
- public static function updateGameStatus($merchantId, $ids, $status)
|
|
|
- {
|
|
|
- return self::whereIn('id', $ids)
|
|
|
- ->where('merchant_id', $merchantId)
|
|
|
- ->update(['status' => $status]);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取游戏统计信息
|
|
|
- */
|
|
|
- public static function getGameStatistics($merchantId)
|
|
|
- {
|
|
|
- $query = self::where('merchant_id', $merchantId);
|
|
|
-
|
|
|
- $totalGames = (clone $query)->count();
|
|
|
- $normalGames = (clone $query)->where('status', self::STATUS_NORMAL)->count();
|
|
|
- $maintainGames = (clone $query)->where('status', self::STATUS_MAINTAIN)->count();
|
|
|
- $disabledGames = (clone $query)->where('status', self::STATUS_DISABLED)->count();
|
|
|
-
|
|
|
- // 按平台统计
|
|
|
- $platformStats = [];
|
|
|
- $platforms = self::getAllPlatforms();
|
|
|
-
|
|
|
- foreach ($platforms as $platform) {
|
|
|
- $platformStats[$platform['platform_name']] = self::where('game_platform', $platform['id'])
|
|
|
- ->where('merchant_id', $merchantId)
|
|
|
- ->count();
|
|
|
- }
|
|
|
-
|
|
|
- return [
|
|
|
- 'total_games' => $totalGames,
|
|
|
- 'normal_games' => $normalGames,
|
|
|
- 'maintain_games' => $maintainGames,
|
|
|
- 'disabled_games' => $disabledGames,
|
|
|
- 'platform_stats' => $platformStats,
|
|
|
- 'avg_rtp' => (clone $query)->avg('rtp'),
|
|
|
- 'free_game_enabled' => (clone $query)->where('free_game_status', self::FREE_GAME_ENABLED)->count(),
|
|
|
- 'terminal_spin_enabled' => (clone $query)->where('terminal_spin', self::TERMINAL_SPIN_ENABLED)->count(),
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取所有游戏平台
|
|
|
*/
|
|
|
public static function getAllPlatforms(): array
|
|
|
{
|
|
|
- return self::table('merchant_game_platform')
|
|
|
- ->field(['id', 'platform_name'])
|
|
|
- ->order('id', 'asc')
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
+ return $GLOBALS['gameGameTypeConfig'];
|
|
|
}
|
|
|
|
|
|
/**
|