|
@@ -103,17 +103,19 @@ class GameOrder 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']);
|
|
|
|
|
|
|
|
- if(isset($childOrderList[$thirdGid])) {
|
|
|
|
|
|
|
+ $children = [];
|
|
|
|
|
+ if (isset($childOrderList[$thirdGid])) {
|
|
|
$item['children'] = [];
|
|
$item['children'] = [];
|
|
|
$childList = $childOrderList[$thirdGid];
|
|
$childList = $childOrderList[$thirdGid];
|
|
|
foreach ($childList as $citem) {
|
|
foreach ($childList as $citem) {
|
|
|
$citem['game_type_text'] = $item['game_type_text'];
|
|
$citem['game_type_text'] = $item['game_type_text'];
|
|
|
$citem['game_image_url'] = $item['game_image_url'];
|
|
$citem['game_image_url'] = $item['game_image_url'];
|
|
|
$citem['game_title'] = $item['game_title'];
|
|
$citem['game_title'] = $item['game_title'];
|
|
|
- $item['children'][] = $citem;
|
|
|
|
|
|
|
+ $children[] = $citem;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$newDataList[] = $item;
|
|
$newDataList[] = $item;
|
|
|
|
|
+ $newDataList = array_merge($newDataList, $children);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$result['list'] = $newDataList;
|
|
$result['list'] = $newDataList;
|
|
@@ -123,72 +125,7 @@ class GameOrder extends BaseController
|
|
|
return json_error([], '获取订单记录失败:' . $e->getMessage());
|
|
return json_error([], '获取订单记录失败:' . $e->getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 导出订单记录
|
|
|
|
|
- */
|
|
|
|
|
- public function export()
|
|
|
|
|
- {
|
|
|
|
|
- $userInfo = $this->request->userInfo;
|
|
|
|
|
-
|
|
|
|
|
- // 筛选条件
|
|
|
|
|
- $filters = [
|
|
|
|
|
- 'start_time' => Request::get('start_time', '', 'trim'),
|
|
|
|
|
- 'end_time' => Request::get('end_time', '', 'trim'),
|
|
|
|
|
- 'game_id' => Request::get('game_id', '', 'trim'),
|
|
|
|
|
- 'order_reason' => Request::get('order_reason', '', 'trim'),
|
|
|
|
|
- 'platform_id' => Request::get('platform_id', '', 'trim'),
|
|
|
|
|
- 'order_status' => Request::get('order_status', ''),
|
|
|
|
|
- 'order_number' => Request::get('order_number', '', 'trim'),
|
|
|
|
|
- 'parent_order' => Request::get('parent_order', '', 'trim'),
|
|
|
|
|
- 'round_number' => Request::get('round_number', '', 'trim'),
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
- // 获取所有符合条件的数据(不分页)
|
|
|
|
|
- $result = GameBetOrderModel::getOrderRecords($userInfo['merchant_id'], 1, 100000, $filters);
|
|
|
|
|
-
|
|
|
|
|
- // 生成CSV数据
|
|
|
|
|
- $csvData = "序号,母单号,子单号,牌局编号,平台昵称,玩家ID,所属商户,平台ID," .
|
|
|
|
|
- "游戏名称,变动金额,变更前,变更后,下注金额,总变动金额," .
|
|
|
|
|
- "总变动金额,最后结算金额,状态,原因,创建时间\n";
|
|
|
|
|
-
|
|
|
|
|
- foreach ($result['list'] as $index => $order) {
|
|
|
|
|
- $csvData .= sprintf(
|
|
|
|
|
- "%d,%s,%s,%s,%s,%d,%s,%d,%s,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%s,%s,%s\n",
|
|
|
|
|
- $index + 1, // 序号
|
|
|
|
|
- $order['third_gid'], // 母单号
|
|
|
|
|
- $order['third_order_id'], // 子单号
|
|
|
|
|
- $order['third_round_id'], // 牌局编号
|
|
|
|
|
- $order['nickname'], // 平台昵称
|
|
|
|
|
- $order['uname'], // 玩家ID
|
|
|
|
|
- $userInfo['merchant_id'], // 所属商户
|
|
|
|
|
- $order['user_id'], // 平台ID
|
|
|
|
|
- $order['game_name'], // 游戏名称
|
|
|
|
|
- $order['amount'], // 变动金额
|
|
|
|
|
- $order['prev_amount'], // 变更前
|
|
|
|
|
- $order['next_amount'], // 变更后
|
|
|
|
|
- $order['bet'], // 下注金额
|
|
|
|
|
- $order['total_win_amount'], // 总变动金额
|
|
|
|
|
- $order['total_amount'], // 总变动金额
|
|
|
|
|
- $order['next_amount'], // 最后结算金额
|
|
|
|
|
- $order['status_text'], // 状态
|
|
|
|
|
- $order['action_type_text'], // 原因
|
|
|
|
|
- $order['create_time'], // 创建时间
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 返回CSV数据
|
|
|
|
|
- return response($csvData)
|
|
|
|
|
- ->header(['Content-Type' => 'text/csv; charset=utf-8'])
|
|
|
|
|
- ->header(['Content-Disposition' => 'attachment; filename="game_orders_' . date('YmdHis') . '.csv"'])
|
|
|
|
|
- ->header(['Cache-Control' => 'no-cache, must-revalidate']);
|
|
|
|
|
-
|
|
|
|
|
- } catch (\Exception $e) {
|
|
|
|
|
- return json_error([], '导出订单记录失败:' . $e->getMessage());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 格式化信息
|
|
// 格式化信息
|
|
|
private function formatItemDataText($item = [])
|
|
private function formatItemDataText($item = [])
|
|
|
{
|
|
{
|