|
@@ -84,7 +84,7 @@ class GameRecord extends BaseController
|
|
|
foreach ($result['list'] as $item) {
|
|
foreach ($result['list'] as $item) {
|
|
|
$thirdGid = $item['third_gid'];
|
|
$thirdGid = $item['third_gid'];
|
|
|
$game_id = $item['game_id'];
|
|
$game_id = $item['game_id'];
|
|
|
- $gameInfo = $gameInfoMap[$item['game_id']] ?? [];
|
|
|
|
|
|
|
+ $gameInfo = $gameList[$game_id] ?? [];
|
|
|
if (!empty($gameInfo))
|
|
if (!empty($gameInfo))
|
|
|
{
|
|
{
|
|
|
$gameImages = CommonUtils::getGameDefaultImage($gameInfo);
|
|
$gameImages = CommonUtils::getGameDefaultImage($gameInfo);
|
|
@@ -93,7 +93,7 @@ class GameRecord extends BaseController
|
|
|
$item['game_title'] = $gameInfo['title'] ?? '';
|
|
$item['game_title'] = $gameInfo['title'] ?? '';
|
|
|
$item['game_type_text'] = CommonUtils::getGameTypeConfig($item['game_type']);
|
|
$item['game_type_text'] = CommonUtils::getGameTypeConfig($item['game_type']);
|
|
|
$item['c_count'] = count($childOrderList[$thirdGid] ?? []);
|
|
$item['c_count'] = count($childOrderList[$thirdGid] ?? []);
|
|
|
- $item['view_layout_url'] = "/history/{$game_id}.html?sid={$thirdGid}&pf=1&lang=zh&api=".Request::host()."%2Fweb-api%2Fgame-proxy%2Fv2%2FBetDetails%2FGet";
|
|
|
|
|
|
|
+ $item['view_layout_url'] = $GLOBALS['gameGameLayoutDomain'] . "/{$game_id}.html?sid={$thirdGid}&pf=1&lang=zh&api=".Request::host()."%2Fweb-api%2Fgame-proxy%2Fv2%2FBetDetails%2FGet";
|
|
|
|
|
|
|
|
$children = [];
|
|
$children = [];
|
|
|
if (isset($childOrderList[$thirdGid])) {
|
|
if (isset($childOrderList[$thirdGid])) {
|
|
@@ -128,136 +128,121 @@ class GameRecord extends BaseController
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 导出游戏记录
|
|
|
|
|
- */
|
|
|
|
|
- public function export()
|
|
|
|
|
|
|
+ public function layout()
|
|
|
{
|
|
{
|
|
|
- $userInfo = $this->request->userInfo;
|
|
|
|
|
-
|
|
|
|
|
- // 筛选条件
|
|
|
|
|
- $filters = [
|
|
|
|
|
- 'start_time' => Request::get('start_time', '', 'trim'),
|
|
|
|
|
- 'end_time' => Request::get('end_time', '', 'trim'),
|
|
|
|
|
- 'platform_id' => Request::get('platform_id', '', 'trim'),
|
|
|
|
|
- 'game_id' => Request::get('game_id', '', 'trim'),
|
|
|
|
|
- 'play_status' => Request::get('play_status', ''),
|
|
|
|
|
- 'play_method' => Request::get('play_method', '', 'trim'),
|
|
|
|
|
- 'trigger_method' => Request::get('trigger_method', '', 'trim'),
|
|
|
|
|
- 'round_number' => Request::get('round_number', '', 'trim'),
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
- // 获取所有符合条件的数据(不分页)
|
|
|
|
|
- $result = GameBetGameModel::getGameRecords($userInfo['merchant_id'], 1, 100000, $filters);
|
|
|
|
|
-
|
|
|
|
|
- // 获取游戏信息映射
|
|
|
|
|
- $gameIds = array_unique(array_column($result['list'], 'game_id'));
|
|
|
|
|
- $gameInfoMap = $this->getGameInfoMap($gameIds, $userInfo['merchant_id']);
|
|
|
|
|
-
|
|
|
|
|
- // 生成CSV数据
|
|
|
|
|
- $csvData = "序号,父局号,牌局ID,创建时间,牌局编号,平台昵称,玩家ID,所属商户," .
|
|
|
|
|
- "平台ID,游戏名称,游戏玩法,调控状态,免费触发,RTP,下注金额," .
|
|
|
|
|
- "应下注,应返奖,玩家输赢,下注前,结算后,总输赢,最后结算金额,操作\n";
|
|
|
|
|
-
|
|
|
|
|
- foreach ($result['list'] as $index => $record) {
|
|
|
|
|
- $gameInfo = $gameInfoMap[$record['game_id']] ?? null;
|
|
|
|
|
- $gameName = $gameInfo ? $gameInfo['title'] : $this->getGameName($record['game_id']);
|
|
|
|
|
-
|
|
|
|
|
- $csvData .= sprintf(
|
|
|
|
|
- "%d,%s,%s,%s,%s,%s,%d,%s,%d,%s,%s,%s,%s,%s,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%s\n",
|
|
|
|
|
- $index + 1, // 序号
|
|
|
|
|
- $record['third_gid'], // 父局号
|
|
|
|
|
- $record['id'], // 牌局ID
|
|
|
|
|
- $record['create_time_text'], // 创建时间
|
|
|
|
|
- $record['third_round_id'], // 牌局编号
|
|
|
|
|
- $record['nickname'], // 平台昵称
|
|
|
|
|
- $record['uname'], // 玩家ID
|
|
|
|
|
- $userInfo['merchant_id'], // 所属商户
|
|
|
|
|
- $record['user_id'], // 平台ID
|
|
|
|
|
- $gameName, // 游戏名称
|
|
|
|
|
- $this->getPlayMethodName($record['bet_game_play_type']), // 游戏玩法
|
|
|
|
|
- $record['status_text'], // 调控状态
|
|
|
|
|
- '', // 免费触发(暂时为空)
|
|
|
|
|
- '', // RTP(暂时为空)
|
|
|
|
|
- $record['bet_amount_yuan'], // 下注金额
|
|
|
|
|
- 0.00, // 应下注
|
|
|
|
|
- 0.00, // 应返奖
|
|
|
|
|
- $record['amount_yuan'], // 玩家输赢
|
|
|
|
|
- $record['prev_amount_yuan'], // 下注前
|
|
|
|
|
- $record['next_amount_yuan'], // 结算后
|
|
|
|
|
- $record['amount_yuan'], // 总输赢
|
|
|
|
|
- $record['balance_amount_yuan'], // 最后结算金额
|
|
|
|
|
- $record['action_type_text'] // 操作
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 返回CSV数据
|
|
|
|
|
- return response($csvData)
|
|
|
|
|
- ->header(['Content-Type' => 'text/csv; charset=utf-8'])
|
|
|
|
|
- ->header(['Content-Disposition' => 'attachment; filename="game_records_' . date('YmdHis') . '.csv"'])
|
|
|
|
|
- ->header(['Cache-Control' => 'no-cache, must-revalidate']);
|
|
|
|
|
-
|
|
|
|
|
- } catch (\Exception $e) {
|
|
|
|
|
- return json_error([], '导出游戏记录失败:' . $e->getMessage());
|
|
|
|
|
|
|
+ $game_id = Request::param('gid', '');
|
|
|
|
|
+ $sid = Request::param('sid', '');
|
|
|
|
|
+ if (empty($game_id) || empty($sid)) {
|
|
|
|
|
+ return CommonUtils::gameJsonError();
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取游戏名称
|
|
|
|
|
- */
|
|
|
|
|
- private function getGameName($gameId)
|
|
|
|
|
- {
|
|
|
|
|
- // 这里可以根据实际情况配置游戏ID对应的名称
|
|
|
|
|
- $gameNames = [
|
|
|
|
|
- 'tiger' => '老虎机',
|
|
|
|
|
- 'fortue_tiger' => '财富老虎',
|
|
|
|
|
- // 可以继续添加其他游戏
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $model = new GameBetGameModel();
|
|
|
|
|
+ $wheres = [
|
|
|
|
|
+ ['game_id', '=', $game_id],
|
|
|
|
|
+ ['third_round_id', '=', $sid],
|
|
|
|
|
+ ['action_type', '=', 1],
|
|
|
];
|
|
];
|
|
|
-
|
|
|
|
|
- return $gameNames[$gameId] ?? $gameId;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取玩法名称
|
|
|
|
|
- */
|
|
|
|
|
- private function getPlayMethodName($methodId)
|
|
|
|
|
- {
|
|
|
|
|
- // 这里可以根据实际情况配置玩法ID对应的名称
|
|
|
|
|
- $methodNames = [
|
|
|
|
|
- 1 => '普通模式',
|
|
|
|
|
- 2 => '免费模式',
|
|
|
|
|
- 3 => '特殊模式',
|
|
|
|
|
- // 可以继续添加其他玩法
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $bet_game_info = $model->where($wheres)->find();
|
|
|
|
|
+ if (empty($bet_game_info)) {
|
|
|
|
|
+ return CommonUtils::gameJsonError();
|
|
|
|
|
+ }
|
|
|
|
|
+ $bet_game_info = $bet_game_info->toArray();
|
|
|
|
|
+ $dataList = [$bet_game_info];
|
|
|
|
|
+
|
|
|
|
|
+ $result = json_decode($bet_game_info['result'],true);
|
|
|
|
|
+ $ge = [];
|
|
|
|
|
+ foreach ($result as $key => $res) {
|
|
|
|
|
+ $ge = array_merge($ge, $res['ge']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $ge = array_values(array_unique($ge));
|
|
|
|
|
+ array_map(function ($value) {
|
|
|
|
|
+ return $value * 1;
|
|
|
|
|
+ }, $ge);
|
|
|
|
|
+
|
|
|
|
|
+ $thirdGidList = array_column($dataList, 'third_gid');
|
|
|
|
|
+ $newFilter = [
|
|
|
|
|
+ ['third_gid', 'in', $thirdGidList],
|
|
|
|
|
+ ['action_type','=', 2],
|
|
|
];
|
|
];
|
|
|
-
|
|
|
|
|
- return $methodNames[$methodId] ?? '未知玩法';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取游戏信息映射
|
|
|
|
|
- */
|
|
|
|
|
- private function getGameInfoMap($gameIds, $merchantId)
|
|
|
|
|
- {
|
|
|
|
|
- if (empty($gameIds)) {
|
|
|
|
|
- return [];
|
|
|
|
|
|
|
+ $tempDataList = $model->where($newFilter)->select()->toArray();
|
|
|
|
|
+ $childDataConfig = [];
|
|
|
|
|
+ foreach ($tempDataList as $item) {
|
|
|
|
|
+ $third_gid = $item['third_gid'];
|
|
|
|
|
+ if(!isset($childDataConfig[$third_gid])) {
|
|
|
|
|
+ $childDataConfig[$third_gid]= [];
|
|
|
|
|
+ }
|
|
|
|
|
+ $childDataConfig[$third_gid][] = $item;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- $gameInfos = GameModel::whereIn('game_id', $gameIds)
|
|
|
|
|
- ->where('merchant_id', $merchantId)
|
|
|
|
|
- ->field(['game_id', 'title', 'title_en', 'image', 'image_en'])
|
|
|
|
|
- ->select()
|
|
|
|
|
- ->toArray();
|
|
|
|
|
-
|
|
|
|
|
- $map = [];
|
|
|
|
|
- foreach ($gameInfos as $gameInfo) {
|
|
|
|
|
- $map[$gameInfo['game_id']] = $gameInfo;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $newDataList = [];
|
|
|
|
|
+ foreach ($dataList as $item) {
|
|
|
|
|
+ $third_gid = $item['third_gid'];
|
|
|
|
|
+ $result = json_decode($item['result'], true);
|
|
|
|
|
+ $ge = [];
|
|
|
|
|
+ foreach ($result as $key => $res) {
|
|
|
|
|
+ $ge = array_merge($ge, $res['ge']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $ge = array_values( array_unique($ge));
|
|
|
|
|
+ array_map(function ($value) {
|
|
|
|
|
+ return $value * 1;
|
|
|
|
|
+ }, $ge);
|
|
|
|
|
+
|
|
|
|
|
+ $childData = $childDataConfig[$third_gid] ?? [];
|
|
|
|
|
+ if (!empty($result) && count($result) > 0){
|
|
|
|
|
+ $firstResult = $result[0];
|
|
|
|
|
+ $tempItem = array_merge($item, [
|
|
|
|
|
+ 'result' => json_encode($firstResult),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ array_unshift($childData, $tempItem);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $mgcc = 0;
|
|
|
|
|
+ $bd = [];
|
|
|
|
|
+ foreach ($childData as $index => $citem) {
|
|
|
|
|
+ $result = json_decode($citem['result'], true);
|
|
|
|
|
+ $result['cs'] *= 1;
|
|
|
|
|
+ $result['ml'] *= 1;
|
|
|
|
|
+
|
|
|
|
|
+ if($result['nst'] == 4) {
|
|
|
|
|
+ $mgcc += 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $bd[] = [
|
|
|
|
|
+ 'bl' => CommonUtils::convertBalance( $citem['balance_amount'], false),
|
|
|
|
|
+ 'bt' => strtotime($citem['create_time']) * 1000,
|
|
|
|
|
+ 'tba' => CommonUtils::convertBalance( $citem['bet'], false),
|
|
|
|
|
+ 'twla' => CommonUtils::convertBalance( $citem['win_amount'], false),
|
|
|
|
|
+ 'tid' => $citem['third_round_id'],
|
|
|
|
|
+ 'gd' => array_merge(CommonUtils::formatResultData($result, false), [
|
|
|
|
|
+ 'bl' => CommonUtils::convertBalance( $item['balance_amount'], false),
|
|
|
|
|
+ 'blb' => CommonUtils::convertBalance( $item['prev_amount'], false),
|
|
|
|
|
+ 'blab' => CommonUtils::convertBalance( $item['next_amount'], false),
|
|
|
|
|
+ 'irs' => $result['irs'] ?? null,
|
|
|
|
|
+ 'sid' => $citem['third_round_id'],
|
|
|
|
|
+ 'psid' => $item['third_round_id'],
|
|
|
|
|
+ ])
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $newDataList[] = [
|
|
|
|
|
+ 'bd' => $bd,
|
|
|
|
|
+ 'bt' => strtotime($item['create_time']) * 1000,
|
|
|
|
|
+ 'cc' => '',
|
|
|
|
|
+ 'fscc' => 0,
|
|
|
|
|
+ 'ge' => $ge,
|
|
|
|
|
+ 'gid' => $item['game_id'],
|
|
|
|
|
+ 'gtba' => CommonUtils::convertBalance( $item['bet'], false),
|
|
|
|
|
+ 'gtwla' => CommonUtils::convertBalance( $item['total_win_amount'], false),
|
|
|
|
|
+ 'mgcc' => $mgcc,
|
|
|
|
|
+ 'tid' => $third_gid
|
|
|
|
|
+ ];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return $map;
|
|
|
|
|
|
|
+ return CommonUtils::gameJsonSuccess([
|
|
|
|
|
+ 'bh' => $newDataList[0]
|
|
|
|
|
+ ]);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 格式化信息
|
|
// 格式化信息
|
|
|
private function formatItemDataText($item = [])
|
|
private function formatItemDataText($item = [])
|
|
|
{
|
|
{
|