diff --git a/app/admin/controller/User.php b/app/admin/controller/User.php index 79ea3b4..e92ec57 100755 --- a/app/admin/controller/User.php +++ b/app/admin/controller/User.php @@ -17,6 +17,7 @@ use app\common\model\Order; use app\common\model\OrderList; use app\common\model\UserAccount; use app\common\model\UserLoginIp; +use app\common\model\Goods; use think\facade\Db; use think\helper\Str; @@ -962,22 +963,11 @@ class User extends Base */ public function user_order() { - $user_id = request()->param('id', 0); - $nickname = request()->param('nickname', ''); - - // 将UID转换为用户ID - $user_id = $this->convertUidToUserId($user_id); - - // 验证参数 - if (empty($user_id)) { - $this->renderError('参数错误'); - } - - // 传递用户ID和昵称到模板 - View::assign('user_id', $user_id); - View::assign('nickname', $nickname); - - return View::fetch('User/user_order'); + $id = input('id'); + View::assign('id',$id); + $nickname = input('nickname'); + View::assign('nickname',$nickname); + return View::fetch(); } /** @@ -1036,4 +1026,245 @@ class User extends Base 'data' => $list ]); } + + /** + * 用户余额流水明细 + */ + public function user_money_detail() + { + $user_id = input('user_id'); + $nickname = input('nickname', ''); + + View::assign('user_id', $user_id); + View::assign('nickname', $nickname); + return View::fetch('User/user_money_detail'); + } + + /** + * 获取用户余额流水明细数据 + */ + public function user_money_detail_data() + { + $param = input(); + $user_id = isset($param['user_id']) ? intval($param['user_id']) : 0; + + if (empty($user_id)) { + return json(['code' => 1, 'msg' => '参数错误', 'count' => 0, 'data' => []]); + } + + $where = [ + ['user_id', '=', $user_id] + ]; + + // 时间范围 + if (!empty($param['start_time']) && !empty($param['end_time'])) { + $start_time = strtotime($param['start_time']); + $end_time = strtotime($param['end_time']); + $where[] = ['addtime', 'between', [$start_time, $end_time]]; + } + + // 类型筛选 + if (isset($param['type']) && $param['type'] !== '') { + $where[] = ['type', '=', intval($param['type'])]; + } + + // 变化类型(收入/消耗) + if (isset($param['change_type']) && $param['change_type'] !== '') { + if ($param['change_type'] === 'add') { + $where[] = ['change_money', '>', 0]; + } elseif ($param['change_type'] === 'sub') { + $where[] = ['change_money', '<', 0]; + } + } + + // 备注搜索 + if (isset($param['content']) && $param['content'] !== '') { + $where[] = ['content|other', 'like', '%' . $param['content'] . '%']; + } + + // 获取数据 + $model = new \app\common\model\ProfitMoney(); + + // 获取总数 + $count = $model->where($where)->count(); + + // 分页 + $page = isset($param['page']) ? max(1, intval($param['page'])) : 1; + $limit = isset($param['limit']) ? max(1, intval($param['limit'])) : 50; + + $list = $model->where($where) + ->order('id desc') + ->page($page, $limit) + ->select() + ->toArray(); + + return json([ + 'code' => 0, + 'msg' => '', + 'count' => $count, + 'data' => $list + ]); + } + + /** + * 用户货币2流水明细 + */ + public function user_integral_detail() + { + $user_id = input('user_id'); + $nickname = input('nickname', ''); + + View::assign('user_id', $user_id); + View::assign('nickname', $nickname); + View::assign('currency_name', getConfig('app_setting')['currency1_name'] ?? '货币2'); + return View::fetch('User/user_integral_detail'); + } + + /** + * 获取用户货币2流水明细数据 + */ + public function user_integral_detail_data() + { + $param = input(); + $user_id = isset($param['user_id']) ? intval($param['user_id']) : 0; + + if (empty($user_id)) { + return json(['code' => 1, 'msg' => '参数错误', 'count' => 0, 'data' => []]); + } + + $where = [ + ['user_id', '=', $user_id] + ]; + + // 时间范围 + if (!empty($param['start_time']) && !empty($param['end_time'])) { + $start_time = strtotime($param['start_time']); + $end_time = strtotime($param['end_time']); + $where[] = ['addtime', 'between', [$start_time, $end_time]]; + } + + // 类型筛选 + if (isset($param['type']) && $param['type'] !== '') { + $where[] = ['type', '=', intval($param['type'])]; + } + + // 变化类型(收入/消耗) + if (isset($param['change_type']) && $param['change_type'] !== '') { + if ($param['change_type'] === 'add') { + $where[] = ['change_money', '>', 0]; + } elseif ($param['change_type'] === 'sub') { + $where[] = ['change_money', '<', 0]; + } + } + + // 备注搜索 + if (isset($param['content']) && $param['content'] !== '') { + // 使用content字段进行搜索 + $where[] = ['content', 'like', '%' . $param['content'] . '%']; + } + + try { + // 使用DB类进行查询,避免使用模型方法 + $list = Db::name('profit_integral') + ->where($where) + ->order('id desc') + ->page(isset($param['page']) ? max(1, intval($param['page'])) : 1, isset($param['limit']) ? max(1, intval($param['limit'])) : 50) + ->select() + ->toArray(); + + $count = Db::name('profit_integral') + ->where($where) + ->count(); + + return json([ + 'code' => 0, + 'msg' => '', + 'count' => $count, + 'data' => $list + ]); + } catch (\Exception $e) { + return json(['code' => 1, 'msg' => '数据查询出错: ' . $e->getMessage(), 'count' => 0, 'data' => []]); + } + } + + /** + * 用户货币3流水明细 + */ + public function user_score_detail() + { + $user_id = input('user_id'); + $nickname = input('nickname', ''); + + View::assign('user_id', $user_id); + View::assign('nickname', $nickname); + View::assign('currency_name', getConfig('app_setting')['currency2_name'] ?? '货币3'); + return View::fetch('User/user_score_detail'); + } + + /** + * 获取用户货币3流水明细数据 + */ + public function user_score_detail_data() + { + $param = input(); + $user_id = isset($param['user_id']) ? intval($param['user_id']) : 0; + + if (empty($user_id)) { + return json(['code' => 1, 'msg' => '参数错误', 'count' => 0, 'data' => []]); + } + + $where = [ + ['user_id', '=', $user_id] + ]; + + // 时间范围 + if (!empty($param['start_time']) && !empty($param['end_time'])) { + $start_time = strtotime($param['start_time']); + $end_time = strtotime($param['end_time']); + $where[] = ['addtime', 'between', [$start_time, $end_time]]; + } + + // 类型筛选 + if (isset($param['type']) && $param['type'] !== '') { + $where[] = ['type', '=', intval($param['type'])]; + } + + // 变化类型(收入/消耗) + if (isset($param['change_type']) && $param['change_type'] !== '') { + if ($param['change_type'] === 'add') { + $where[] = ['change_money', '>', 0]; + } elseif ($param['change_type'] === 'sub') { + $where[] = ['change_money', '<', 0]; + } + } + + // 备注搜索 + if (isset($param['content']) && $param['content'] !== '') { + // 使用content字段进行搜索 + $where[] = ['content', 'like', '%' . $param['content'] . '%']; + } + + try { + // 使用DB类进行查询,避免使用模型方法 + $list = Db::name('profit_money2') + ->where($where) + ->order('id desc') + ->page(isset($param['page']) ? max(1, intval($param['page'])) : 1, isset($param['limit']) ? max(1, intval($param['limit'])) : 50) + ->select() + ->toArray(); + + $count = Db::name('profit_money2') + ->where($where) + ->count(); + + return json([ + 'code' => 0, + 'msg' => '', + 'count' => $count, + 'data' => $list + ]); + } catch (\Exception $e) { + return json(['code' => 1, 'msg' => '数据查询出错: ' . $e->getMessage(), 'count' => 0, 'data' => []]); + } + } } diff --git a/app/admin/route/app.php b/app/admin/route/app.php index 97449ee..5a6924b 100755 --- a/app/admin/route/app.php +++ b/app/admin/route/app.php @@ -47,6 +47,16 @@ Route::rule('detailed_flow', 'User/detailed_flow', 'GET|POST'); Route::rule('user_team', 'User/user_team', 'GET|POST'); Route::rule('ip_list', 'User/ip_list', 'GET|POST'); Route::rule('ipzh', 'User/ipzh', 'GET|POST'); +Route::rule('user_box', 'User/user_box', 'GET|POST'); +Route::rule('user_box_list', 'User/user_box_list', 'GET|POST'); +Route::rule('user_order', 'User/user_order', 'GET|POST'); +Route::rule('user_order_list', 'User/user_order_list', 'GET|POST'); +Route::rule('user_money_detail', 'User/user_money_detail', 'GET|POST'); +Route::rule('user_money_detail_data', 'User/user_money_detail_data', 'GET|POST'); +Route::rule('user_integral_detail', 'User/user_integral_detail', 'GET|POST'); +Route::rule('user_integral_detail_data', 'User/user_integral_detail_data', 'GET|POST'); +Route::rule('user_score_detail', 'User/user_score_detail', 'GET|POST'); +Route::rule('user_score_detail_data', 'User/user_score_detail_data', 'GET|POST'); Route::rule('usermobileclear', 'User/usermobileclear', 'POST');//清空手机号 Route::rule('userwxclear', 'User/userwxclear', 'POST');//清空微信登录数据 diff --git a/app/admin/view/Config/systemconfig.html b/app/admin/view/Config/systemconfig.html index cb993cf..a9de653 100755 --- a/app/admin/view/Config/systemconfig.html +++ b/app/admin/view/Config/systemconfig.html @@ -13,81 +13,113 @@