From 5af705c2f9924d9ab30936c5a4dc43242774e38b Mon Sep 17 00:00:00 2001 From: tping Date: Tue, 24 Dec 2019 14:03:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=88=B0=E8=B4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/RepairController.class.php | 117 +++++++++++++++++- .../Controller/SpendController.class.php | 9 ++ Application/Admin/View/Deposit/lists.html | 42 +++++++ Application/Admin/View/Spend/lists.html | 38 ++++++ 4 files changed, 205 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/RepairController.class.php b/Application/Admin/Controller/RepairController.class.php index 2762546de..02f23d354 100644 --- a/Application/Admin/Controller/RepairController.class.php +++ b/Application/Admin/Controller/RepairController.class.php @@ -3,6 +3,7 @@ namespace Admin\Controller; use User\Api\UserApi as UserApi; use Common\Api\GameApi; +use Callback\Controller\BaseController; /** * 后台首页控制器 * @author 麦当苗儿 @@ -17,7 +18,20 @@ class RepairController extends ThinkController { $result=$game->game_pay_notify($param,1); } $spend = M('Spend',"tab_"); + if($result == "success"){ + $auth = session('user_auth'); + // 补单记录 + M('repair_pay', 'tab_')->add([ + 'admin_id' => $auth['uid'], + 'admin_name' => $auth['username'], + 'pay_order_number' => $orderNo, + 'ip' => get_client_ip(), + 'tab' => 'spend', + 'create_time' => time(), + 'type' => 1 // 补单 + ]); + $rr = $spend->where(array('pay_order_number'=>$orderNo))->save(array('pay_game_status'=>1)); $this->ajaxReturn(array('status'=>1,'msg'=>'补单成功')); }else{ @@ -97,6 +111,107 @@ class RepairController extends ThinkController { } - + /** + * 游戏充值补单 + */ + public function noticePayed($orderNo, $second, $type) { + $auth = session('user_auth'); + + if (IS_AJAX) { + if ($type != 'spend' && $type != 'deposit') { + $this->ajaxReturn(['status'=>0,'msg'=>'参数有误']); + } + $tab = $type; + + if (!$orderNo || !$second) { + $this->ajaxReturn(['status'=>0,'msg'=>'参数不足']); + } + $r = D('Member')->check_sc_pwd($second); + if (!$r) { + $this->ajaxReturn(['status'=>0,'msg'=>'二级密码错误']); + } + + M($tab, 'tab_')->startTrans(); + $order = M($tab, 'tab_')->where(['pay_order_number' => $orderNo])->find(); + if ($order['pay_status'] == 1) { + M($tab, 'tab_')->rollback(); + $this->ajaxReturn(['status'=>0,'msg'=>'支付成功,无需补单']); + } + + $r = M($tab, 'tab_')->where([ + 'pay_order_number' => $orderNo, + 'pay_status' => 0 + ])->save([ + 'pay_status' => 1 + ]); + if ($r) { + + $cpFlag = 0; // 0 通知cp失败 1 成功 + // 通知cp + if ($tab == 'spend') { + $param['out_trade_no'] = $orderNo; + $game = new GameApi(); + $result=$game->game_pay_notify($param,1); + $spend = M($tab, "tab_"); + if($result == "success"){ + $rr = $spend->where(array('pay_order_number'=>$orderNo))->save(array('pay_game_status'=>1)); + if ($rr) { + $cpFlag = 1; + M('spend', 'tab_')->commit(); + } else { + M($tab, 'tab_')->rollback(); + $this->ajaxReturn(array('status'=>1,'msg'=>'补单失败.')); + } + }else{ + M($tab, 'tab_')->commit(); + } + } else { // deposit + M('spend', 'tab_')->commit(); + } + + // 通知到账记录 + M('repair_pay', 'tab_')->add([ + 'admin_id' => $auth['uid'], + 'admin_name' => $auth['username'], + 'pay_order_number' => $orderNo, + 'ip' => get_client_ip(), + 'tab' => $tab, + 'create_time' => time(), + 'type' => 0 + ]); + if ($tab == 'spend' && $cpFlag === 1) { + // 补单记录 + M('repair_pay', 'tab_')->add([ + 'admin_id' => $auth['uid'], + 'admin_name' => $auth['username'], + 'pay_order_number' => $orderNo, + 'ip' => get_client_ip(), + 'tab' => $tab, + 'create_time' => time(), + 'type' => 1 + ]); + } + + // todo: 分红 上级奖励等 + if ($tab == 'spend' && $cpFlag == 0) { + $this->ajaxReturn(['status'=>0,'msg'=>'充值补单成功,通知CP失败!']); + } + $this->ajaxReturn(['status'=>0,'msg'=>'充值补单成功!']); + } else { + M('spend', 'tab_')->rollback(); + $this->ajaxReturn(['status'=>0,'msg'=>'补单失败,请重试']); + } + + } + } + + /** + * 平台币充值补单 + */ + public function platform($orderNo) { + if (IS_AJAX) { + $payOrderNumber = I('request.pay_order_number'); + } + } } diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index 329bcf91b..a90a2a13f 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -131,5 +131,14 @@ class SpendController extends ThinkController $this->assign('is_admin', is_administrator()); $this->display(); } + + /** + * 充值补单功能 + */ + public function order_repair() { + if (IS_AJAX) { + + } + } } diff --git a/Application/Admin/View/Deposit/lists.html b/Application/Admin/View/Deposit/lists.html index e482c3a29..488c82a12 100644 --- a/Application/Admin/View/Deposit/lists.html +++ b/Application/Admin/View/Deposit/lists.html @@ -127,6 +127,7 @@ 订单状态 + 操作 @@ -168,6 +169,16 @@ {:get_info_status($data['pay_status'],9)} + + +
+ + 通知到账 + + + + @@ -397,5 +408,36 @@ // minimumResultsForSearch: Infinity, // 永久隐藏搜索框 // }); } + + // 充值补单 + $(".pay_repair").click(function () { + url = $(this).attr('href-hhh'); + data = $(this).attr('href-data'); + var pwd2 = prompt("请输入二级密码"); + if (!pwd2) { + alert("二级密码不能为空"); + return ; + } + $.ajax({ + type: 'post', + url: url, + data: {orderNo: data, second: pwd2, type: 'deposit'}, + success: function (e) { + if (e.status == 1) { + layer.msg(e.msg, {icon: 1}); + setTimeout(function () { + location.reload(); + }, 1500); + } else { + if (e.msg) { + var tip_msg = e.msg; + } else { + var tip_msg = e.info ? e.info : "补单失败"; + } + layer.msg(tip_msg, {icon: 2}); + } + }, + }); + }); diff --git a/Application/Admin/View/Spend/lists.html b/Application/Admin/View/Spend/lists.html index 881fe2728..79a45ad5a 100644 --- a/Application/Admin/View/Spend/lists.html +++ b/Application/Admin/View/Spend/lists.html @@ -234,8 +234,15 @@ 补单 +
+ + + 通知到账 + + @@ -428,6 +435,37 @@ }, }); }); + + // 充值补单 + $(".pay_repair").click(function () { + url = $(this).attr('href-hhh'); + data = $(this).attr('href-data'); + var pwd2 = prompt("请输入二级密码"); + if (!pwd2) { + alert("二级密码不能为空"); + return ; + } + $.ajax({ + type: 'post', + url: url, + data: {orderNo: data, second: pwd2, type: 'spend'}, + success: function (e) { + if (e.status == 1) { + layer.msg(e.msg, {icon: 1}); + setTimeout(function () { + location.reload(); + }, 1500); + } else { + if (e.msg) { + var tip_msg = e.msg; + } else { + var tip_msg = e.info ? e.info : "补单失败"; + } + layer.msg(tip_msg, {icon: 2}); + } + }, + }); + }); $(".d_list").find(".drop-down11").hover(function () { $(this).find(".nav-list").removeClass("hidden");