| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- declare (strict_types = 1);
- namespace app\controller;
- use app\BaseController;
- use app\model\GameStatisModel;
- use app\common\CommonUtils;
- use app\model\GameModel;
- use think\facade\Request;
- class TrendStatis extends BaseController
- {
- /**
- * 在线走势
- */
- public function Online()
- {
- $userInfo = $this->request->userInfo;
-
- // 获取查询参数
- $page = Request::get('page', 1, 'intval');
- $limit = Request::get('limit', 10, 'intval');
- // 筛选条件
- $filters = [
- // 时间筛选
- 'start_time' => Request::get('start_time', date('Y-m-d', strtotime('-7 days')), 'trim'),
- 'end_time' => Request::get('end_time', date('Y-m-d'), 'trim'),
- 'game_id' => Request::get('game_id', '', 'trim'),
- ];
-
- try {
- // 获取游戏每日数据
- $result = GameStatisModel::getGameDailyList(
- $userInfo['merchant_id'],
- $page,
- $limit,
- $filters,
- );
- // 获取游戏信息信息
- $game_ids = array_unique(array_column($result['list'], 'game_id'));
- $tempGameList = GameModel::where([['merchant_id', '=', $userInfo['merchant_id']], ['game_id', 'in', $game_ids]])->field(['game_id','title','image'])->select()->toArray();
- $gameList = [];
- foreach ($tempGameList as $item) {
- $game_id = $item['game_id'];
- $gameList[$game_id] = $item;
- }
-
- // 格式化数据
- foreach ($result['list'] as &$item) {
- $item['game_profit'] = CommonUtils::convertBalance($item['game_profit'], false);
- $item['bet_amount'] = CommonUtils::convertBalance($item['bet_amount'], false);
- $item['commission_amount'] = CommonUtils::convertBalance($item['game_profit'] * 0.08, false);
- $item['platform_fee'] = CommonUtils::convertBalance($item['bet_amount'] * 0.08, false);
- $item['buy_free_bet'] = 0;
- $item['game_title'] = $gameList[$item['game_id']]['title'] ?? '';
- }
-
- return json_success($result, '获取成功');
- } catch (\Exception $e) {
- return json_error([], '获取游戏每日数据失败:' . $e->getMessage());
- }
- }
-
- /**
- * 游戏走势
- */
- public function Game() {
- }
- /**
- * 输赢走势
- */
- public function Win() {
- }
-
- /**
- * 返奖倍数走势
- */
- public function PrizeMultiple() {
- }
- /**
- *
- */
-
- }
|