|
@@ -4,7 +4,7 @@ declare (strict_types = 1);
|
|
|
namespace app\controller;
|
|
namespace app\controller;
|
|
|
|
|
|
|
|
use app\BaseController;
|
|
use app\BaseController;
|
|
|
-use app\model\MerchantGameModel;
|
|
|
|
|
|
|
+use app\model\GameModel;
|
|
|
use think\facade\Request;
|
|
use think\facade\Request;
|
|
|
|
|
|
|
|
class Game extends BaseController
|
|
class Game extends BaseController
|
|
@@ -48,13 +48,13 @@ class Game extends BaseController
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// 获取游戏列表
|
|
// 获取游戏列表
|
|
|
- $result = MerchantGameModel::getGameList($page, $limit, $filters);
|
|
|
|
|
|
|
+ $result = GameModel::getGameList($page, $limit, $filters);
|
|
|
|
|
|
|
|
// 处理列表数据
|
|
// 处理列表数据
|
|
|
foreach ($result['list'] as &$game) {
|
|
foreach ($result['list'] as &$game) {
|
|
|
- $game['platform_text'] = MerchantGameModel::getPlatformText($game['game_platform']);
|
|
|
|
|
- $game['status_text'] = MerchantGameModel::getStatusText($game['status']);
|
|
|
|
|
- $game['rtp_type_text'] = MerchantGameModel::getRtpTypeText($game['rtp_type']);
|
|
|
|
|
|
|
+ $game['platform_text'] = GameModel::getPlatformText($game['game_platform']);
|
|
|
|
|
+ $game['status_text'] = GameModel::getStatusText($game['status']);
|
|
|
|
|
+ $game['rtp_type_text'] = GameModel::getRtpTypeText($game['rtp_type']);
|
|
|
$game['free_game_status_text'] = $game['free_game_status'] ? '支持' : '不支持';
|
|
$game['free_game_status_text'] = $game['free_game_status'] ? '支持' : '不支持';
|
|
|
$game['terminal_spin_text'] = $game['terminal_spin'] ? '开启' : '关闭';
|
|
$game['terminal_spin_text'] = $game['terminal_spin'] ? '开启' : '关闭';
|
|
|
$game['create_time_text'] = date('Y-m-d H:i:s', $game['create_time']);
|
|
$game['create_time_text'] = date('Y-m-d H:i:s', $game['create_time']);
|
|
@@ -99,15 +99,15 @@ class Game extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $game = MerchantGameModel::getGameDetail($id);
|
|
|
|
|
|
|
+ $game = GameModel::getGameDetail($id);
|
|
|
if (!$game) {
|
|
if (!$game) {
|
|
|
return json_error([], '游戏不存在');
|
|
return json_error([], '游戏不存在');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 添加文本字段
|
|
// 添加文本字段
|
|
|
- $game['platform_text'] = MerchantGameModel::getPlatformText($game['game_platform']);
|
|
|
|
|
- $game['status_text'] = MerchantGameModel::getStatusText($game['status']);
|
|
|
|
|
- $game['rtp_type_text'] = MerchantGameModel::getRtpTypeText($game['rtp_type']);
|
|
|
|
|
|
|
+ $game['platform_text'] = GameModel::getPlatformText($game['game_platform']);
|
|
|
|
|
+ $game['status_text'] = GameModel::getStatusText($game['status']);
|
|
|
|
|
+ $game['rtp_type_text'] = GameModel::getRtpTypeText($game['rtp_type']);
|
|
|
$game['free_game_status_text'] = $game['free_game_status'] ? '支持' : '不支持';
|
|
$game['free_game_status_text'] = $game['free_game_status'] ? '支持' : '不支持';
|
|
|
$game['terminal_spin_text'] = $game['terminal_spin'] ? '开启' : '关闭';
|
|
$game['terminal_spin_text'] = $game['terminal_spin'] ? '开启' : '关闭';
|
|
|
$game['create_time_text'] = date('Y-m-d H:i:s', $game['create_time']);
|
|
$game['create_time_text'] = date('Y-m-d H:i:s', $game['create_time']);
|
|
@@ -154,12 +154,12 @@ class Game extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 检查游戏ID是否已存在
|
|
// 检查游戏ID是否已存在
|
|
|
- if (MerchantGameModel::checkGameIdExists($data['game_id'])) {
|
|
|
|
|
|
|
+ if (GameModel::checkGameIdExists($data['game_id'])) {
|
|
|
return json_error([], '游戏ID已存在');
|
|
return json_error([], '游戏ID已存在');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $game = MerchantGameModel::createGame($data);
|
|
|
|
|
|
|
+ $game = GameModel::createGame($data);
|
|
|
return json_success(['id' => $game->id], '创建游戏成功');
|
|
return json_success(['id' => $game->id], '创建游戏成功');
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
return json_error([], '创建游戏失败:' . $e->getMessage());
|
|
return json_error([], '创建游戏失败:' . $e->getMessage());
|
|
@@ -198,20 +198,20 @@ class Game extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 检查游戏是否存在
|
|
// 检查游戏是否存在
|
|
|
- $game = MerchantGameModel::getGameDetail($id);
|
|
|
|
|
|
|
+ $game = GameModel::getGameDetail($id);
|
|
|
if (!$game) {
|
|
if (!$game) {
|
|
|
return json_error([], '游戏不存在');
|
|
return json_error([], '游戏不存在');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 如果修改了游戏ID,检查是否与其他游戏冲突
|
|
// 如果修改了游戏ID,检查是否与其他游戏冲突
|
|
|
if (isset($data['game_id']) && $data['game_id'] != $game['game_id']) {
|
|
if (isset($data['game_id']) && $data['game_id'] != $game['game_id']) {
|
|
|
- if (MerchantGameModel::checkGameIdExists($data['game_id'], $id)) {
|
|
|
|
|
|
|
+ if (GameModel::checkGameIdExists($data['game_id'], $id)) {
|
|
|
return json_error([], '游戏ID已存在');
|
|
return json_error([], '游戏ID已存在');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- MerchantGameModel::updateGame($id, $data);
|
|
|
|
|
|
|
+ GameModel::updateGame($id, $data);
|
|
|
return json_success([], '更新游戏成功');
|
|
return json_success([], '更新游戏成功');
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
return json_error([], '更新游戏失败:' . $e->getMessage());
|
|
return json_error([], '更新游戏失败:' . $e->getMessage());
|
|
@@ -240,15 +240,15 @@ class Game extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!in_array($status, [
|
|
if (!in_array($status, [
|
|
|
- MerchantGameModel::STATUS_NORMAL,
|
|
|
|
|
- MerchantGameModel::STATUS_MAINTAIN,
|
|
|
|
|
- MerchantGameModel::STATUS_DISABLED
|
|
|
|
|
|
|
+ GameModel::STATUS_NORMAL,
|
|
|
|
|
+ GameModel::STATUS_MAINTAIN,
|
|
|
|
|
+ GameModel::STATUS_DISABLED
|
|
|
])) {
|
|
])) {
|
|
|
return json_error([], '状态值无效');
|
|
return json_error([], '状态值无效');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $result = MerchantGameModel::updateGameStatus($id, $status);
|
|
|
|
|
|
|
+ $result = GameModel::updateGameStatus($id, $status);
|
|
|
if ($result) {
|
|
if ($result) {
|
|
|
return json_success([], '状态更新成功');
|
|
return json_success([], '状态更新成功');
|
|
|
} else {
|
|
} else {
|
|
@@ -281,15 +281,15 @@ class Game extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!in_array($status, [
|
|
if (!in_array($status, [
|
|
|
- MerchantGameModel::STATUS_NORMAL,
|
|
|
|
|
- MerchantGameModel::STATUS_MAINTAIN,
|
|
|
|
|
- MerchantGameModel::STATUS_DISABLED
|
|
|
|
|
|
|
+ GameModel::STATUS_NORMAL,
|
|
|
|
|
+ GameModel::STATUS_MAINTAIN,
|
|
|
|
|
+ GameModel::STATUS_DISABLED
|
|
|
])) {
|
|
])) {
|
|
|
return json_error([], '状态值无效');
|
|
return json_error([], '状态值无效');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $result = MerchantGameModel::batchUpdateStatus($ids, $status);
|
|
|
|
|
|
|
+ $result = GameModel::batchUpdateStatus($ids, $status);
|
|
|
if ($result > 0) {
|
|
if ($result > 0) {
|
|
|
return json_success(['updated' => $result], '批量更新成功');
|
|
return json_success(['updated' => $result], '批量更新成功');
|
|
|
} else {
|
|
} else {
|
|
@@ -315,7 +315,7 @@ class Game extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $statistics = MerchantGameModel::getGameStatistics();
|
|
|
|
|
|
|
+ $statistics = GameModel::getGameStatistics();
|
|
|
return json_success($statistics, '获取成功');
|
|
return json_success($statistics, '获取成功');
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
return json_error([], '获取游戏统计失败:' . $e->getMessage());
|
|
return json_error([], '获取游戏统计失败:' . $e->getMessage());
|
|
@@ -333,7 +333,7 @@ class Game extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $platforms = MerchantGameModel::getAllPlatforms();
|
|
|
|
|
|
|
+ $platforms = GameModel::getAllPlatforms();
|
|
|
return json_success($platforms, '获取成功');
|
|
return json_success($platforms, '获取成功');
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
return json_error([], '获取游戏平台失败:' . $e->getMessage());
|
|
return json_error([], '获取游戏平台失败:' . $e->getMessage());
|
|
@@ -361,13 +361,13 @@ class Game extends BaseController
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// 检查游戏是否存在
|
|
// 检查游戏是否存在
|
|
|
- $game = MerchantGameModel::getGameDetail($id);
|
|
|
|
|
|
|
+ $game = GameModel::getGameDetail($id);
|
|
|
if (!$game) {
|
|
if (!$game) {
|
|
|
return json_error([], '游戏不存在');
|
|
return json_error([], '游戏不存在');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 删除游戏
|
|
// 删除游戏
|
|
|
- MerchantGameModel::where('id', $id)->delete();
|
|
|
|
|
|
|
+ GameModel::where('id', $id)->delete();
|
|
|
|
|
|
|
|
return json_success([], '删除成功');
|
|
return json_success([], '删除成功');
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
@@ -408,7 +408,7 @@ class Game extends BaseController
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// 获取所有数据
|
|
// 获取所有数据
|
|
|
- $result = MerchantGameModel::getGameList(1, 100000, $filters);
|
|
|
|
|
|
|
+ $result = GameModel::getGameList(1, 100000, $filters);
|
|
|
|
|
|
|
|
// 生成CSV数据
|
|
// 生成CSV数据
|
|
|
$csvData = "ID,游戏ID,游戏平台,中文名称,英文名称,RTP,RTP类型,免费游戏,下注线数,最高倍数,默认押注,最低押注,止损止赢,状态,创建时间\n";
|
|
$csvData = "ID,游戏ID,游戏平台,中文名称,英文名称,RTP,RTP类型,免费游戏,下注线数,最高倍数,默认押注,最低押注,止损止赢,状态,创建时间\n";
|
|
@@ -418,18 +418,18 @@ class Game extends BaseController
|
|
|
"%d,%d,%s,%s,%s,%.2f,%s,%s,%d,%d,%.2f,%.2f,%s,%s,%s\n",
|
|
"%d,%d,%s,%s,%s,%.2f,%s,%s,%d,%d,%.2f,%.2f,%s,%s,%s\n",
|
|
|
$game['id'],
|
|
$game['id'],
|
|
|
$game['game_id'],
|
|
$game['game_id'],
|
|
|
- MerchantGameModel::getPlatformText($game['game_platform']),
|
|
|
|
|
|
|
+ GameModel::getPlatformText($game['game_platform']),
|
|
|
$game['title'],
|
|
$game['title'],
|
|
|
$game['title_en'],
|
|
$game['title_en'],
|
|
|
$game['rtp'],
|
|
$game['rtp'],
|
|
|
- MerchantGameModel::getRtpTypeText($game['rtp_type']),
|
|
|
|
|
|
|
+ GameModel::getRtpTypeText($game['rtp_type']),
|
|
|
$game['free_game_status'] ? '支持' : '不支持',
|
|
$game['free_game_status'] ? '支持' : '不支持',
|
|
|
$game['bet_line_count'],
|
|
$game['bet_line_count'],
|
|
|
$game['max_multiple_count'],
|
|
$game['max_multiple_count'],
|
|
|
$game['default_deposit'],
|
|
$game['default_deposit'],
|
|
|
$game['min_deposit'],
|
|
$game['min_deposit'],
|
|
|
$game['terminal_spin'] ? '开启' : '关闭',
|
|
$game['terminal_spin'] ? '开启' : '关闭',
|
|
|
- MerchantGameModel::getStatusText($game['status']),
|
|
|
|
|
|
|
+ GameModel::getStatusText($game['status']),
|
|
|
date('Y-m-d H:i:s', $game['create_time'])
|
|
date('Y-m-d H:i:s', $game['create_time'])
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|