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 @@
- +
- - + +
- +
每天允许兑换几次,0不限次数
- +
- +
{if !empty($app_setting.balance_icon)} - + {/if}
+
+ 人民币单位,只能充值,可以抽赏 +
- +
- +
{if !empty($app_setting.currency1_icon)} - + {/if}
+
+ 道具币,活动获得,签到等,不计入消费额度,可以抽赏 +
- +
- +
{if !empty($app_setting.currency2_icon)} - + {/if}
+
+ 兑换获得,可以抽赏,可以去商城兑换,不计入消费额度 +
- +
- +
微信公众号设置
@@ -242,25 +276,30 @@
- +
- +
- +
- + @@ -274,7 +313,7 @@ var upload = layui.upload; // 图标上传功能 - $('.upload-icon').each(function() { + $('.upload-icon').each(function () { var inputName = $(this).data('input'); upload.render({ elem: this, @@ -286,10 +325,10 @@ acceptMime: 'image/*', exts: 'jpg|png|jpeg|gif', size: 2048, // 最大2MB - before: function(obj) { + before: function (obj) { layer.load(); // 显示等待框 }, - done: function(res) { + done: function (res) { layer.closeAll('loading'); // 关闭等待框 if (res.status) { // 设置输入框的值 @@ -298,18 +337,18 @@ $('#' + inputName + '_preview').html(''); layer.msg('上传成功'); } else { - layer.msg(res.msg || '上传失败', {icon: 2}); + layer.msg(res.msg || '上传失败', { icon: 2 }); } }, - error: function() { + error: function () { layer.closeAll('loading'); - layer.msg('上传失败', {icon: 2}); + layer.msg('上传失败', { icon: 2 }); } }); }); - + // 音频上传功能 - $('.upload-audio').each(function() { + $('.upload-audio').each(function () { var inputName = $(this).data('input'); upload.render({ elem: this, @@ -321,10 +360,10 @@ acceptMime: 'audio/*', exts: 'mp3|wav|ogg', size: 5120, // 最大5MB - before: function(obj) { + before: function (obj) { layer.load(); // 显示等待框 }, - done: function(res) { + done: function (res) { layer.closeAll('loading'); // 关闭等待框 if (res.status) { // 设置输入框的值 @@ -333,12 +372,12 @@ $('#' + inputName + '_preview').html(''); layer.msg('上传成功'); } else { - layer.msg(res.msg || '上传失败', {icon: 2}); + layer.msg(res.msg || '上传失败', { icon: 2 }); } }, - error: function() { + error: function () { layer.closeAll('loading'); - layer.msg('上传失败', {icon: 2}); + layer.msg('上传失败', { icon: 2 }); } }); }); @@ -371,12 +410,12 @@ // 表单提交 - 不再在前端处理数据转换,交给后端处理 form.on('submit(component-form-element)', function (data) { var field = data.field; - + // 检查并移除空的file字段 if ('file' in field && !field.file) { delete field.file; } - + // 提交到后台 $.ajax({ url: '{:url("/admin/update")}', @@ -529,23 +568,23 @@ .layui-input-block { margin-left: 150px; } - + .icon-preview { display: inline-block; vertical-align: middle; } - + .upload-icon { display: inline-block; vertical-align: middle; margin-right: 10px; } - + .audio-preview { display: inline-block; vertical-align: middle; } - + .upload-audio { display: inline-block; vertical-align: middle; diff --git a/app/admin/view/Finance/integral_list.html b/app/admin/view/Finance/integral_list.html index db93e4e..a7801d3 100755 --- a/app/admin/view/Finance/integral_list.html +++ b/app/admin/view/Finance/integral_list.html @@ -37,8 +37,8 @@ 用户信息 - 变化吧唧币数量 - 变后吧唧币数量 + 变化{$app_setting.currency1_name}数量 + 变后{$app_setting.currency1_name}数量 描述 变化时间 diff --git a/app/admin/view/Finance/money_list.html b/app/admin/view/Finance/money_list.html index 9f739d0..e681c69 100755 --- a/app/admin/view/Finance/money_list.html +++ b/app/admin/view/Finance/money_list.html @@ -37,8 +37,8 @@ 用户信息 - 变化余额数量 - 变后余额数量 + 变化{$app_setting.balance_name}数量 + 变后{$app_setting.balance_name}数量 描述 变化时间 diff --git a/app/admin/view/User/index.html b/app/admin/view/User/index.html index e1c2be1..22c30e0 100755 --- a/app/admin/view/User/index.html +++ b/app/admin/view/User/index.html @@ -109,17 +109,20 @@ @@ -227,7 +230,7 @@ , cols: [[ { field: 'userInfo', title: '用户信息', templet: '#userInfoTpl', width: 200 } , { field: 'pid_info', title: '推荐人', templet: '#pidInfoTpl', width: 200 } - , { field: 'money', title: '{$app_setting.balance_name}', templet: '#moneyTpl', width: 120 } + , { field: 'money', title: '{$app_setting.balance_name}', templet: '#moneyTpl', width: 150 } , { field: 'integral', title: '{$app_setting.currency1_name}', templet: '#integralTpl', width: 120 } , { field: 'score', title: '{$app_setting.currency2_name}', templet: '#scoreTpl', width: 120 } , { field: 'combined', title: '货币信息', templet: '#combinedTpl', width: 200 } @@ -327,6 +330,33 @@ maxmin: true }); break; + case 'moneyDetail': + layer.open({ + type: 2, + title: data.nickname + ' 的余额流水明细', + content: '/admin/user_money_detail?user_id=' + data.id + '&nickname=' + encodeURIComponent(data.nickname), + area: ['95%', '90%'], + maxmin: true + }); + break; + case 'integralDetail': + layer.open({ + type: 2, + title: data.nickname + ' 的{$app_setting.currency1_name}流水明细', + content: '/admin/user_integral_detail?user_id=' + data.id + '&nickname=' + encodeURIComponent(data.nickname), + area: ['95%', '90%'], + maxmin: true + }); + break; + case 'scoreDetail': + layer.open({ + type: 2, + title: data.nickname + ' 的{$app_setting.currency2_name}流水明细', + content: '/admin/user_score_detail?user_id=' + data.id + '&nickname=' + encodeURIComponent(data.nickname), + area: ['95%', '90%'], + maxmin: true + }); + break; } }); diff --git a/app/admin/view/User/user_integral_detail.html b/app/admin/view/User/user_integral_detail.html new file mode 100644 index 0000000..1d7e4e1 --- /dev/null +++ b/app/admin/view/User/user_integral_detail.html @@ -0,0 +1,486 @@ +{include file="Public:header2"/} + +
+
+
+ + 用户管理 + {$currency_name}流水明细 + + +
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+ + +
+ +
+
    + +
  • + +
    +
    加载中...
    +
    +
  • +
+ +
+
+ + + + + +
+ +
+
+
+
+ + + + + + + + {include file="Public:footer"/} + + + + + \ No newline at end of file diff --git a/app/admin/view/User/user_money_detail.html b/app/admin/view/User/user_money_detail.html new file mode 100644 index 0000000..ab768b3 --- /dev/null +++ b/app/admin/view/User/user_money_detail.html @@ -0,0 +1,571 @@ +{include file="Public:header2"/} + +
+
+
+ + 用户管理 + 余额流水明细 + + +
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+ + +
+ +
+
    + +
  • + +
    +
    加载中...
    +
    +
  • +
+ +
+
+ + + + + +
+ +
+
+
+
+ + + + + + + + {include file="Public:footer"/} + + + {include file="Public:footer"/} + + + + + \ No newline at end of file diff --git a/app/admin/view/User/user_score_detail.html b/app/admin/view/User/user_score_detail.html new file mode 100644 index 0000000..0dddfc6 --- /dev/null +++ b/app/admin/view/User/user_score_detail.html @@ -0,0 +1,486 @@ +{include file="Public:header2"/} + +
+
+
+ + 用户管理 + {$currency_name}流水明细 + + +
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+ + +
+ +
+
    + +
  • + +
    +
    加载中...
    +
    +
  • +
+ +
+
+ + + + + +
+ +
+
+
+
+ + + + + + + + {include file="Public:footer"/} + + + + + \ No newline at end of file diff --git a/config/menu.php b/config/menu.php index 116578f..33e49d3 100755 --- a/config/menu.php +++ b/config/menu.php @@ -40,7 +40,7 @@ return [ ], [ 'url' => '/admin/integral_list', - 'name' => '吧唧币明细', + 'name' => '货币1明细', ], [