ith5 6 місяців тому
батько
коміт
65634e0221

+ 0 - 51
app/v1/controller/gameLog/RoleDataController.php

@@ -1,51 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\controller\gameLog;
-
-use plugin\saiadmin\basic\BaseController;
-use app\v1\logic\gameLog\RoleDataLogic;
-use app\v1\validate\gameLog\RoleDataValidate;
-use support\Request;
-use support\Response;
-
-/**
- * 角色数据控制器
- */
-class RoleDataController extends BaseController
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->logic = new RoleDataLogic();
-        $this->validate = new RoleDataValidate;
-        parent::__construct();
-    }
-
-    /**
-     * 数据列表
-     * @param Request $request
-     * @return Response
-     */
-    public function index(Request $request): Response
-    {
-        $where = $request->more([
-            ['game_id', ''],
-            ['media_id', ''],
-            ['site_id', ''],
-            ['auth_id', ''],
-            ['user_name', ''],
-            ['reg_time', ''],
-        ]);
-        // $query = $this->logic->search($where);
-        $data = $this->logic->getList($where);
-        // $data['data'] = $this->logic->trandformListColumn($data['data'], ['game', 'ip', 'auth', 'agent']);
-        return $this->success($data);
-    }
-
-}

+ 0 - 56
app/v1/controller/gameLog/SdkLoginLogController.php

@@ -1,56 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\controller\gameLog;
-
-use plugin\saiadmin\basic\BaseController;
-use app\v1\logic\gameLog\SdkLoginLogLogic;
-use app\v1\validate\gameLog\SdkLoginLogValidate;
-use support\Request;
-use support\Response;
-
-/**
- * 登录日志控制器
- */
-class SdkLoginLogController extends BaseController
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->logic = new SdkLoginLogLogic();
-        $this->validate = new SdkLoginLogValidate;
-        parent::__construct();
-    }
-
-    /**
-     * 数据列表
-     * @param Request $request
-     * @return Response
-     */
-    public function index(Request $request): Response
-    {
-        $where = $request->more([
-            ['user_name', ''],
-            ['game_id', ''],
-            ['media_id', ''],
-            ['agent_id', ''],
-            ['site_id', ''],
-            ['auth_id', ''],
-            ['login_time', ''],
-            ['reg_time', ''],
-        ]);
-        // 传入的是多选game_id, 转换成字符串
-        // $where['game_id'] = is_array($where['game_id']) ? implode(',', $where['game_id']) : $where['game_id'];
-        
-        $query = $this->logic->searchByAuth($where);
-        $data = $this->logic->getList($query);
-        $data['data'] = $this->logic->trandformListColumn($data['data'], ['game', 'ip', 'agent']);
-        return $this->success($data);
-    }
-
-}

+ 0 - 59
app/v1/controller/gameLog/SdkOrderRankController.php

@@ -1,59 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\controller\gameLog;
-
-use plugin\saiadmin\basic\BaseController;
-use app\v1\logic\gameLog\SdkOrderRankLogic;
-use app\v1\validate\gameLog\SdkOrderRankValidate;
-use support\Request;
-use support\Response;
-
-/**
- * 充值排行控制器
- */
-class SdkOrderRankController extends BaseController
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->logic = new SdkOrderRankLogic();
-        $this->validate = new SdkOrderRankValidate;
-        parent::__construct();
-    }
-
-    /**
-     * 数据列表
-     * @param Request $request
-     * @return Response
-     */
-    public function index(Request $request): Response
-    {
-        $where = $request->more([
-            ['game_id', ''],
-            ['media_id', ''],
-            ['auth_id', ''],
-            ['agent_id', ''],
-            ['site_id', ''],
-            ['user_name', ''],
-            ['server_id', ''],
-            ['server_name', ''],
-            ['reg_date', ''],
-            ['pay_date', ''],
-        ]);
-        // 传入的是多选game_id, 转换成字符串
-        //$where['game_id'] = is_array($where['game_id']) ? implode(',', $where['game_id']) : $where['game_id'];
-
-        $query = $this->logic->searchByAuth($where);
-
-        $data = $this->logic->getList($query);
-        return $this->success($data);
-       
-    }
-
-}

+ 0 - 81
app/v1/controller/gameLog/SdkOrderSuccessController.php

@@ -1,81 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\controller\gameLog;
-
-use plugin\saiadmin\basic\BaseController;
-use app\v1\logic\gameLog\SdkOrderSuccessLogic;
-use app\v1\validate\gameLog\SdkOrderSuccessValidate;
-use support\Request;
-use support\Response;
-
-/**
- * 订单记录表(支付成功)控制器
- */
-class SdkOrderSuccessController extends BaseController
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->logic = new SdkOrderSuccessLogic();
-        $this->validate = new SdkOrderSuccessValidate;
-        parent::__construct();
-    }
-
-    /**
-     * 数据列表
-     * @param Request $request
-     * @return Response
-     */
-    public function index(Request $request): Response
-    {
-        $where = $request->more([
-            ['game_id', ''],
-            ['media_id', ''],
-            ['auth_id', ''],
-            ['agent_id', ''],
-            ['site_id', ''],
-            ['user_name', ''],
-            ['server_id', ''],
-            ['server_name', ''],
-            ['reg_date', ''],
-            ['pay_date', ''],
-        ]);
-        // 传入的是多选game_id, 转换成字符串
-        // $where['game_id'] = is_array($where['game_id']) ? implode(',', $where['game_id']) : $where['game_id'];
-        $query = $this->logic->searchByAuth($where);
-        $data = $this->logic->getList($query);
-        $data['data'] = $this->logic->trandformListColumn($data['data'], ['game', 'ip', 'agent','auth', 'pay_channel']);
-        return $this->success($data);
-    }
-
-    /**
-     * 导出数据
-     * @param Request $request
-     * @return Response
-     */
-    public function export(Request $request) : Response
-    {
-        $where = $request->more([
-            ['game_id', ''],
-            ['media_id', ''],
-            ['auth_id', ''],
-            ['agent_id', ''],
-            ['site_id', ''],
-            ['user_name', ''],
-            ['server_id', ''],
-            ['server_name', ''],
-            ['reg_date', ''],
-            ['pay_date', ''],
-        ]);
-        return $this->logic->export($where);
-    }
-
-    
-
-}

+ 0 - 129
app/v1/logic/gameLog/RoleDataLogic.php

@@ -1,129 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\logic\gameLog;
-
-use plugin\saiadmin\basic\BaseLogic;
-use plugin\saiadmin\exception\ApiException;
-use plugin\saiadmin\utils\Helper;
-use app\v1\model\gameLog\RoleData;
-use support\think\Db;
-
-/**
- * 角色数据逻辑层
- */
-class RoleDataLogic extends BaseLogic
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->model = new RoleData();
-    }
-
-     public function getList($query): mixed
-    {
-        $saiType = request()->input('saiType', 'list');
-        $page = request()->input('page', 1);
-        $limit = request()->input('limit', 10);
-        $orderBy = request()->input('orderBy', '');
-        $orderType = request()->input('orderType', $this->orderType);
-        $regTime = request()->input('reg_time', '');
-        $gameId = request()->input('game_id', '');
-        $mediaId = request()->input('media_id', '');
-        $siteId = request()->input('site_id', '');
-        $authId = request()->input('auth_id', '');
-        $userName = request()->input('user_name', '');
-       
-       
-        $egTableName = 'sdk_reg_log_' . date('Ym', strtotime($regTime));
-
-
-
-        $userData = Db::connect('db_game_log')->table($egTableName)->where('reg_time', '>=', strtotime($regTime . ' 00:00:00'))->where('reg_time', '<=', strtotime($regTime . ' 23:59:59'))->select()->toArray();
-
-
-        print_r('$userdata===>');
-        print_r($userData);
-
-        $where_sql = "";
-        if(!empty($gameId)){
-            $where_sql .= is_array($gameId) ? " AND game_id in (".implode(',', $gameId).")" : " AND game_id = {$gameId}";
-        }
-
-        if(!empty($mediaId)){
-            $where_sql .= " AND media_id = {$mediaId}";
-        }
-
-        if(!empty($siteId)){
-            $where_sql .= " AND site_id = {$siteId}";
-        }
-
-        if(!empty($authId)){
-            $where_sql .= " AND auth_id = {$authId}";
-        }
-
-        if(!empty($userName)){
-            $where_sql .= " AND user_name = {$userName}";
-        }
-
-        $uids = array_column($userData, 'uid');
-
-      
-
-        if(empty($userData)){
-            return [];
-        }
-        
-        $where_sql = " AND uid in (".implode(',', $uids).") {$where_sql}";
-       
-
-        $sql_parts = [];
-        $sql_parts[] = "SELECT * FROM role_data_and WHERE 1=1 {$where_sql}";
-        $sql_parts[] = "SELECT * FROM role_data_ios WHERE 1=1 {$where_sql}";
-
-        $unionSql = implode(" UNION ALL ", $sql_parts);
-        // 分页
-        $page = request()->input('page', 1);
-        $limit = request()->input('limit', 10);
-        $offset = ($page - 1) * $limit;
-        $unionSql .= " LIMIT {$offset}, {$limit}";
-        $roleData = Db::connect('db_game_log')->query($unionSql);
-        $count = count($roleData);
-
-        // 合并相同uid的数据,将角色信息放到数组中
-        $mergedData = [];
-        foreach ($roleData as $item) {
-            $uid = $item['uid'];
-            
-            if (!isset($mergedData[$uid])) {
-                // 创建用户基础信息,排除角色相关字段
-                $baseInfo = array_diff_key($item, array_flip(['role_id', 'role_name', 'role_level']));
-                $mergedData[$uid] = $baseInfo + ['roles' => []];
-            }
-            
-            // 添加角色信息到数组
-            $mergedData[$uid]['roles'][] = [
-                'server_name' => $item['server_name'],
-                'role_name' => $item['role_name'],
-                'role_level' => $item['role_level'],
-            ];
-        }
-        
-        // 转换回数组格式
-        $roleData = array_values($mergedData);
-        return [
-            'data'          => $roleData,
-            'current_page'  => $page,
-            'per_page'      => $limit,
-            'last_page'     => ceil($count / $limit),
-            'has_more'      => $page < ceil($count / $limit),
-            'total'         =>  $count
-        ];
-    }
-
-}

+ 0 - 61
app/v1/logic/gameLog/SdkLoginLogLogic.php

@@ -1,61 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\logic\gameLog;
-
-use plugin\saiadmin\basic\BaseLogic;
-use plugin\saiadmin\exception\ApiException;
-use plugin\saiadmin\utils\Helper;
-use app\v1\model\gameLog\SdkLoginLog;
-
-/**
- * 登录日志逻辑层
- */
-class SdkLoginLogLogic extends BaseLogic
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->model = new SdkLoginLog();
-    }
-
-    /**
-     * 分页查询数据
-     * @param $query
-     * @return mixed
-     */
-    public function getList($query): mixed
-    {
-        $saiType = request()->input('saiType', 'list');
-        $page = request()->input('page', 1);
-        $limit = request()->input('limit', 10);
-        $orderBy = request()->input('orderBy', '');
-        $loginTime = request()->input('login_time', '');
-        $orderType = request()->input('orderType', $this->orderType);
-        if(empty($orderBy)) {
-            $orderBy = $this->orderField !== '' ? $this->orderField : $this->model->getPk();
-        }
-        $query->order($orderBy, $orderType);
-
-       
-        $tableName = 'sdk_login_log_'.date('Ym',strtotime($loginTime));
-   
-        
-        print_r('tableName:'.$tableName);
-
-
-        // 切换表名
-        $query->table($tableName);
-
-        if ($saiType === 'all') {
-            return $query->select()->toArray();
-        }
-        
-        return $query->paginate($limit, false, ['page' => $page])->toArray();
-    }
-}

+ 0 - 151
app/v1/logic/gameLog/SdkOrderRankLogic.php

@@ -1,151 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\logic\gameLog;
-
-use plugin\saiadmin\basic\BaseLogic;
-use plugin\saiadmin\exception\ApiException;
-use plugin\saiadmin\utils\Helper;
-use app\v1\model\gameLog\SdkOrderRank;
-use support\think\Db;
-
-/**
- * 充值排行逻辑层
- */
-class SdkOrderRankLogic extends BaseLogic
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->model = new SdkOrderRank();
-    }
-
-    public function getList($query): mixed
-    {
-        $saiType = request()->input('saiType', 'list');
-        $page = request()->input('page', 1);
-        $limit = request()->input('limit', 10);
-        $orderBy = request()->input('orderBy', '');
-        $orderType = request()->input('orderType', $this->orderType);
-        
-        if(empty($orderBy)) {
-            $orderBy = 'searchTotalMoney';
-        }
-
-        // 先分组,再分页
-        $query = $query->field('user_name,sum(money) as searchTotalMoney,
-            orderid,
-            game_id,
-            media_id,
-            agent_id,
-            site_id,
-            uid,
-            pay_channel_id,
-            auth_id,
-            server_id,
-            server_name,
-            pay_date,
-            reg_date,
-            role_name,
-            role_id');
-
-
-        if ($saiType === 'all') {
-            return $query->select()->toArray();
-        }
-        
-     
-
-        
-        $query->group('uid, game_id,site_id,server_id,media_id,auth_id,agent_id,server_id,auth_id,role_id');
-
-        $query->order($orderBy, $orderType);
-        $data = $query->paginate($limit, false, ['page' => $page])->toArray();
-
-
-        $data['data'] = $this->trandformListColumn($data['data'], ['game','auth', 'agent', 'pay_channel']);
-
-
-        // // 告警提示,查询最近登录时间,查询最近充值时间,和现在时间对比,如果超过3天,则告警,并提示
-
-        foreach($data['data'] as &$item){
-            // 最后登录时间
-           $item['login_time'] = Db::connect('db_origin')->table('user_'.$item['uid']%10)->where('uid', $item['uid'])->value('login_time');
-           // 最近注册时间
-           $item['pay_time'] = Db::connect('db_origin')->table('user_'.$item['uid']%10)->where('uid', $item['uid'])->value('pay_time');
-           // 现在时间
-           $item['now_time'] = time();
-
-           // 最近登录时间与现在时间对比,如果超过3天,则告警,并提示
-           if($item['login_time'] < $item['now_time'] - 3 * 24 * 60 * 60){
-            $item['login_alert'] = 1;
-           }else{
-            $item['login_alert'] = 0;
-           }
-           // 最近充值时间与现在时间对比,如果超过3天,则告警,并提示
-           if($item['pay_time'] < $item['now_time'] - 3 * 24 * 60 * 60){
-            $item['pay_alert'] = 1;
-           }else{
-            $item['pay_alert'] = 0;
-           }
-        }
-
-
-
-        $where = $query->getOptions();
-        $totalWhere = [];
-       if(!empty($where['game_id'])){
-            $totalWhere[] = ['game_id', 'in', $where['game_id']];
-       }
-       if(!empty($where['auth_id'])){
-            $totalWhere[] = ['auth_id', 'in', $where['auth_id']];
-       }
-       if(!empty($where['agent_id'])){
-            $totalWhere['agent_id'] = $where['agent_id'];
-       }
-       if(!empty($where['site_id'])){
-            $totalWhere['site_id'] = $where['site_id'];
-       }
-       if(!empty($where['server_id'])){
-            $totalWhere['server_id'] = $where['server_id'];
-       }
-       if(!empty($where['user_name'])){
-            $totalWhere['user_name'] = $where['user_name'];
-       }
-       if(!empty($where['server_name'])){
-            $totalWhere['server_name'] = $where['server_name'];
-       }
-       if(!empty($where['reg_date'])){
-            $totalWhere['reg_date'] = $where['reg_date'];
-       }
-
-        $totalList = Db::connect('db_game_log')->table('sdk_order_success')
-                    ->where($totalWhere)
-                    ->field('game_id,uid,sum(money) as totalMoney')
-                    ->group('uid,game_id,site_id,server_id,media_id,auth_id,agent_id,server_id,auth_id,role_id')
-                    ->select()->toArray();
-
-        
-        // 查询累计充值金额(对每一行数据单独查询历史充值金额)
-        $totalMoneyMap = [];
-        if (!empty($data['data']) && !empty($totalList)) {
-            foreach ($totalList as $totalItem) {
-                $key = $totalItem['uid'] . '_' . $totalItem['game_id'];
-                $totalMoneyMap[$key] = $totalItem['totalMoney'] ?? 0;
-            }
-        }
-        
-        // 为搜索结果添加累计充值金额
-        foreach($data['data'] as &$item){
-            $key = $item['uid'] . '_' . $item['game_id'];
-            $item['totalMoney'] = $totalMoneyMap[$key] ?? 0;
-        }
-
-        return $data;
-    }
-}

+ 0 - 77
app/v1/logic/gameLog/SdkOrderSuccessLogic.php

@@ -1,77 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\logic\gameLog;
-
-use plugin\saiadmin\basic\BaseLogic;
-use plugin\saiadmin\exception\ApiException;
-use plugin\saiadmin\utils\Helper;
-use app\v1\model\gameLog\SdkOrderSuccess;
-use plugin\saiadmin\service\OpenSpoutWriter;
-
-/**
- * 订单记录表(支付成功)逻辑层
- */
-class SdkOrderSuccessLogic extends BaseLogic
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->model = new SdkOrderSuccess();
-    }
-
-     /**
-     * 导出数据
-     */
-    public function export($where = [])
-    {
-        // 传入的是多选game_id, 转换成字符串
-        $where['game_id'] = is_array($where['game_id']) ? implode(',', $where['game_id']) : $where['game_id'];
-        $query = $this->searchByAuth($where);
-        $data = $this->getAll($query);
-       
-        $data = $this->trandformListColumn($data, ['game', 'ip', 'agent','auth', 'pay_channel']);
-        $data = array_map(function($item){
-            return [
-                'orderid' => $item['orderid'],
-                'user_name' => $item['user_name'],
-                'agent_id' => $item['agent_id'],
-                'site_id' => $item['site_id'],
-                'game_name' => $item['game_name'],
-                'server_id' => $item['server_id'],
-                'server_name' => $item['server_name'],
-                'pay_channel_name' => $item['pay_channel_name'],
-                'money' => $item['money'],
-                'pay_date' => $item['pay_date'],
-                'reg_date' => $item['reg_date'],
-                
-                // 'is_first_pay' => $item['is_first_pay'],
-                'agent_name' => $item['agent_name'],
-                'auth_name' => $item['auth_name'],
-            ];
-        }, $data);
-      
-        // 是否首次付费
-        // $filter = [
-        //     'is_first_pay' => [
-        //         ['value' => 1, 'label' => '是'],
-        //         ['value' => 0, 'label' => '否']
-        //     ]
-        // ];
-        $file_name = '充值明细_'.date('YmdHis').'.xlsx';
-        $header = ['订单号', '用户名', '渠道ID', '广告位ID', '游戏名', '服务器ID', '服务器名', '支付方式', '充值金额', '充值时间', '注册时间',  '渠道名', '负责人'];
-       
-        $writer = new OpenSpoutWriter($file_name);
-        $writer->setWidth([15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]);
-        $writer->setHeader($header);
-        $writer->setData($data, null);
-        // $writer->setData($data, null, $filter);
-        $file_path = $writer->returnFile();
-        return response()->download($file_path, urlencode($file_name));
-    }
-}

+ 0 - 57
app/v1/logic/gameLog/SdkRegLogLogic.php

@@ -1,57 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | saiadmin [ saiadmin快速开发框架 ]
-// +----------------------------------------------------------------------
-// | Author: your name
-// +----------------------------------------------------------------------
-namespace app\v1\logic\gameLog;
-
-use plugin\saiadmin\basic\BaseLogic;
-use plugin\saiadmin\exception\ApiException;
-use plugin\saiadmin\utils\Helper;
-use app\v1\model\gameLog\SdkRegLog;
-
-/**
- * 注册日志逻辑层
- */
-class SdkRegLogLogic extends BaseLogic
-{
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        $this->model = new SdkRegLog();
-    }
-
-    /**
-     * 分页查询数据
-     * @param $query
-     * @return mixed
-     */
-    public function getList($query): mixed
-    {
-        $saiType = request()->input('saiType', 'list');
-        $page = request()->input('page', 1);
-        $limit = request()->input('limit', 10);
-        $orderBy = request()->input('orderBy', '');
-        $regTime = request()->input('reg_time', '');
-        $orderType = request()->input('orderType', $this->orderType);
-        if(empty($orderBy)) {
-            $orderBy = $this->orderField !== '' ? $this->orderField : $this->model->getPk();
-        }
-        $query->order($orderBy, $orderType);
-
-       
-        $tableName = 'sdk_reg_log_'.date('Ym',strtotime($regTime));
-   
-        
-        // 切换表名
-        $query->table($tableName);
-        if ($saiType === 'all') {
-            return $query->select()->toArray();
-        }
-        return $query->paginate($limit, false, ['page' => $page])->toArray();
-    }
-
-}