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" /} + +