From 2ecc7c4309153fd6490d64932b7280a25dca4a70 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sat, 12 Oct 2024 17:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=94=A8=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=B7=BB=E5=8A=A0=E5=85=85=E5=80=BC=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/user/User.php | 72 ++++-- app/admin/logic/user/UserLogic.php | 41 ++++ app/admin/view/user/user/cost_details.html | 268 +++++++++++++++++++++ app/admin/view/user/user/lists.html | 53 +++- 4 files changed, 405 insertions(+), 29 deletions(-) create mode 100755 app/admin/view/user/user/cost_details.html diff --git a/app/admin/controller/user/User.php b/app/admin/controller/user/User.php index 7bce7440..91dcf78b 100755 --- a/app/admin/controller/user/User.php +++ b/app/admin/controller/user/User.php @@ -1,19 +1,21 @@ request->isAjax()) { $get = $this->request->get(); return JsonServer::success('', UserLogic::lists($get)); @@ -26,16 +28,17 @@ class User extends AdminBase ]); } - public function setTag(){ - if($this->request->isAjax()){ + public function setTag() + { + if ($this->request->isAjax()) { $post = $this->request->post(); - try{ + try { validate(UserValidate::class)->scene('setTag')->check($post); - }catch(ValidateException $e) { + } catch (ValidateException $e) { return JsonServer::error($e->getMessage()); } $result = UserLogic::setTag($post); - if($result === true) { + if ($result === true) { return JsonServer::success('设置成功'); } return JsonServer::error(UserLogic::getError()); @@ -45,16 +48,17 @@ class User extends AdminBase ]); } - public function edit(){ - if($this->request->isAjax()){ + public function edit() + { + if ($this->request->isAjax()) { $post = $this->request->post(); - try{ + try { validate(UserValidate::class)->scene('edit')->check($post); - }catch(ValidateException $e) { + } catch (ValidateException $e) { return JsonServer::error($e->getMessage()); } $result = UserLogic::edit($post); - if($result === true) { + if ($result === true) { return JsonServer::success('编辑成功'); } return JsonServer::error(UserLogic::getError()); @@ -69,7 +73,8 @@ class User extends AdminBase ]); } - public function info(){ + public function info() + { $id = $this->request->get('id', '', 'intval'); $detail = UserLogic::getInfo($id); return view('', [ @@ -77,17 +82,18 @@ class User extends AdminBase ]); } - public function adjustAccount(){ + public function adjustAccount() + { if ($this->request->isAjax()) { $post = $this->request->post(); - try{ + try { validate(UserValidate::class)->scene('adjustAccount')->check($post); - }catch(ValidateException $e) { + } catch (ValidateException $e) { return JsonServer::error($e->getError()); } $result = UserLogic::adjustAccount($post); - if($result === true) { + if ($result === true) { return JsonServer::success('调整成功'); } return JsonServer::error(UserLogic::getError()); @@ -99,7 +105,8 @@ class User extends AdminBase ]); } - public function adjustLevel(){ + public function adjustLevel() + { if ($this->request->isPost()) { $params = $this->request->post(); $result = UserLogic::adjustLevel($params); @@ -122,7 +129,7 @@ class User extends AdminBase public function adjustFirstLeader() { - if($this->request->isPost()) { + if ($this->request->isPost()) { $params = $this->request->post(); $result = UserLogic::adjustFirstLeader($params); if ($result) { @@ -132,7 +139,7 @@ class User extends AdminBase } $id = $this->request->get('id/d'); - $user = \app\common\model\user\User::field('id,sn,nickname,first_leader')->findOrEmpty($id)->toArray(); + $user = \app\common\model\user\User::field('id,sn,nickname,first_leader')->findOrEmpty($id)->toArray(); $firstLeader = \app\common\model\user\User::getUserInfo($user['first_leader']); return view('', [ 'user_id' => $id, @@ -168,4 +175,21 @@ class User extends AdminBase $id = $this->request->get('id/d'); return view('', ['id' => $id]); } + + public function costDetails() + { + if ($this->request->isAjax()) { + $get = $this->request->get(); + if ($get['type'] == 1) { + $data = UserLogic::getUserRecharge($get); + return JsonServer::success('', $data); + } + } + + $id = $this->request->get('id/d'); + $detail = UserLogic::getUser($id); + return view('', [ + 'info' => $detail, + ]); + } } \ No newline at end of file diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index 9488e92c..bb666aa0 100755 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -6,9 +6,11 @@ use app\api\cache\TokenCache; use app\common\basics\Logic; use app\common\enum\ClientEnum; use app\common\enum\OrderEnum; +use app\common\enum\PayEnum; use app\common\logic\AccountLogLogic; use app\common\model\distribution\DistributionOrderGoods; use app\common\model\AccountLog; +use app\common\model\RechargeOrder; use app\common\model\Session; use app\common\model\user\User; use app\common\model\user\UserLevel; @@ -590,4 +592,43 @@ class UserLogic extends Logic 'lists' => $lists, ]; } + + public static function getUserRecharge($get) + { + $model = new RechargeOrder(); + + $filter_where = []; + if (!empty($get['start_time']) && !empty($get['end_time'])) { + $start_time = strtotime($get['start_time']); + $end_time = strtotime($get['end_time']); + $filter_where[] = ['pay_time', 'between', [$start_time, $end_time]]; + } + + $user = User::where('id', $get['id'])->field('user_money')->find(); + + $where = [ + 'user_id' => $get['id'], + 'pay_status' => PayEnum::ISPAID, // 已支付的 + ]; + + $lists = $model::field('id, order_sn, pay_way, pay_time, order_amount') + ->where($filter_where) + ->where($where) + ->page($get['page'], $get['limit']) + ->order('pay_time desc') + ->select() + ->toArray(); + + foreach ($lists as &$v) { + $v['pay_time'] = date('Y-m-d H:i:s', $v['pay_time']); + } + + $count = $model::where($filter_where)->where($where)->count(); + + return [ + 'count' => $count, + 'lists' => $lists, + 'user_money' => $user['user_money'] + ]; + } } diff --git a/app/admin/view/user/user/cost_details.html b/app/admin/view/user/user/cost_details.html new file mode 100755 index 00000000..9b988eb2 --- /dev/null +++ b/app/admin/view/user/user/cost_details.html @@ -0,0 +1,268 @@ +{layout name="layout2" /} + +
+ +
+
+
+
    +
  • 充值
  • +
  • 佣金
  • +
  • 返补
  • +
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+ + + + +
+ +
+ + +
+ +
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+ +
+
+ +
+ + +
+
+
+
+
+
+
+ +
+ +
+
+ diff --git a/app/admin/view/user/user/lists.html b/app/admin/view/user/user/lists.html index d4071dd2..dab886e8 100755 --- a/app/admin/view/user/user/lists.html +++ b/app/admin/view/user/user/lists.html @@ -178,10 +178,10 @@ @@ -395,7 +395,7 @@ ,{title: '上级推荐人',width: 90,align: 'center',width: 350, templet: '#first-info'} ,{field: 'fans', title: '推荐下级人数',width: 120,align: 'center'} ,{title: '注册信息',width: 300,align: 'center', templet: '#register-info'} - ,{fixed: 'right', title: '操作', width: 420,toolbar: '#user-operation',align: 'center'} + ,{fixed: 'right', title: '操作', width: 500,toolbar: '#user-operation',align: 'center'} ]] ,page:true ,text: {none: '暂无数据!'} @@ -613,6 +613,49 @@ } }) } + if(obj.event === 'cost_details') { + var id = obj.data.id; + layer.open({ + type: 2 + ,title: '账户调整' + ,content: '{:url("user.user/costDetails")}?id='+id + ,area: ['90%', '90%'] + ,btn: ['确定', '取消'] + ,yes: function(index, layero){ + var iframeWindow = window['layui-layer-iframe'+ index] + ,submit = layero.find('iframe').contents().find('#adjust_user-submit'); + //监听提交 + iframeWindow.layui.form.on('submit(adjust_user-submit)', function(data){ + var field = data.field; + $.ajax({ + url:'{:url("user.user/costDetails")}', + data:field, + type:"post", + success:function(res) + { + if(res.code == 1) + { + layui.layer.msg(res.msg, { + offset: '15px' + , icon: 1 + , time: 1000 + }); + layer.close(index); //关闭弹层 + table.reload('user-lists'); //数据刷新 + }else{ + layer.msg(res.msg, { + offset: '15px' + , icon: 2 + , time: 1000 + }); + } + } + }); + }); + submit.trigger('click'); + } + }) + } }); });