From e3d9d382d9217354a353f753ae55e1801a6fc909 Mon Sep 17 00:00:00 2001 From: chenzhi <“chenzhi063@qq.com> Date: Wed, 23 Oct 2019 18:00:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BA=BF=E4=B8=8B?= =?UTF-8?q?=E5=85=85=E5=80=BC=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromoteCoinController.class.php | 156 ++++++++ .../Admin/Model/CoinPayOrderModel.class.php | 82 +++++ .../Admin/View/PromoteCoin/offlineList.html | 342 ++++++++++++++++++ .../View/PromoteCoin/offlineOrderInfo.html | 154 ++++++++ 4 files changed, 734 insertions(+) create mode 100644 Application/Admin/Model/CoinPayOrderModel.class.php create mode 100644 Application/Admin/View/PromoteCoin/offlineList.html create mode 100644 Application/Admin/View/PromoteCoin/offlineOrderInfo.html diff --git a/Application/Admin/Controller/PromoteCoinController.class.php b/Application/Admin/Controller/PromoteCoinController.class.php index a7103c06f..d120b1be5 100644 --- a/Application/Admin/Controller/PromoteCoinController.class.php +++ b/Application/Admin/Controller/PromoteCoinController.class.php @@ -215,4 +215,160 @@ class PromoteCoinController extends ThinkController { $this->display(); } + //获取线下充值列表 + public function offlineList($p=0) + { + //获取记录 + $map = array(); + $map['pay_type'] = 2; + $map['is_del'] = 0; + //其他条件查询 + if(isset($_REQUEST['promote_account'])){ + $map['promote_account']=array('like','%'.trim($_REQUEST['promote_account']).'%'); + unset($_REQUEST['promote_account']); + } + if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ + $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); + unset($_REQUEST['time-start']);unset($_REQUEST['time-end']); + }elseif(isset($_REQUEST['time-start'])){ + $map['create_time'] = ['GT',strtotime(I('time-start'))]; + unset($_REQUEST['time-start']); + }elseif(isset($_REQUEST['time-end'])){ + $map['create_time'] = ['LT',strtotime(I('time-end'))+86399]; + unset($_REQUEST['time-end']); + } + if(isset($_REQUEST['order_status'])){ + $map['order_status']=$_REQUEST['order_status']; + unset($_REQUEST['order_status']); + } + $data = D("CoinPayOrder")->lists($_GET["p"], $map, $order); + // dump($data); + //执行查询 + // parent::order_lists("CoinPayOrder",$_GET["p"],$extend); + $this->meta_title = '线下充值审核列表'; + $this->assign('list_data',$data['data']); + $this->assign('_page',$data['page']); + $this->display(); + # code... + } + public function offlineOrderInfo() + { + if(!isset($_REQUEST['id'])){ + exit("参数错误"); + } + $id = $_REQUEST['id']; + $data = D("CoinPayOrder")->info($id); + $this->meta_title = '线下充值审核详情'; + $this->assign('data', $data); + $this->display(); + # code... + } + //审核通过 + public function offlineAgree() + { + if(!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1){ + exit("参数错误"); + } + $ids = I("ids"); + $count = count($ids); + //执行操作 + for ($i=0; $i <$count; $i++) { + $this->doOfflineAgree($ids[$i]); + } + $this->success("批量通过成功"); + # code... + } + //批量审核拒绝 + public function offlineReject() + { + if(!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1){ + exit("参数错误"); + } + $ids = I("ids"); + $count = count($ids); + //执行操作 + for ($i=0; $i <$count; $i++) { + $this->orderReject($ids[$i]); + } + $this->success("批量拒绝成功"); + # code... + } + + public function doOfflineAgree($id) + { + //获取记录 + $order = D("CoinPayOrder")->info($id); + if($order['order_status'] != 2){ + return; + } + // + $balance_map['promote_id'] = $order['promote_id']; + $balance_map['game_id'] = 0; + $balance = M('promote_balance_coin', 'tab_')->where($balance_map)->find(); + $this->balance_coin_update($order,$balance);//更新汇总 + $this->coin_record_add($order,$balance); //添加流水 + $this->promote_balance_coin_update($order); //更新推广员平台币余额 + $this->orderAgree($id);//更新表 + } + public function orderReject($id) + { + $order = D("CoinPayOrder")->info($id); + if($order['order_status'] != 2){ + return; + } + $savedata = array(); + $auth = $_SESSION['onethink_admin']['user_auth']; + $savedata['auditor_id']=$auth['uid']; + $savedata['auditor_account']=$auth['username']; + $savedata['auditor_time']=time(); + $savedata['order_status']=-1; + D("CoinPayOrder")->updateData($savedata,$id); + # code... + } + public function orderAgree($id) + { + $savedata = array(); + $auth = $_SESSION['onethink_admin']['user_auth']; + $savedata['auditor_id']=$auth['uid']; + $savedata['auditor_account']=$auth['username']; + $savedata['auditor_time']=time(); + $savedata['order_status']=4; + D("CoinPayOrder")->updateData($savedata,$id); + # code... + } + // 添加流水 + public function coin_record_add($order,$balance){ + $data['sn']=date('Ymd') . date('His') . sp_random_num(6); + $data['type']=1; + $data['sub_type'] =1; + $data['target_id'] = $order['promote_id']; + $data['target_type'] = 1; + $data['ref_id'] = $order['id']; + $data['coin'] = $order['real_amount']; + $data['balance_coin'] = $balance['num']+$order['coin_num']; + $data['remark'] = $order['remark']; + $data['create_time']=time(); + $data['description']='线下充值'; + M('promote_coin_record', 'tab_')->data($data)->add(); + } + + //更新汇总 + public function balance_coin_update($order,$balance){ + if(!empty($balance)){ + $map['promote_id'] = $order['promote_id']; + $map['game_id'] = 0; + M('promote_balance_coin', 'tab_')->where($map)->setInc('num',$order['coin_num']); + }else{ + $balance['promote_id']= $order['promote_id']; + $balance['game_id'] = 0; + $balance['num']=$order['coin_num']; + M('promote_balance_coin', 'tab_')->data($balance)->add(); + } + } + + //更新推广员平台币余额 + public function promote_balance_coin_update($order){ + $map['id'] = $order['promote_id']; + M('promote', 'tab_')->where($map)->setInc('balance_coin',$order['coin_num']); + } } diff --git a/Application/Admin/Model/CoinPayOrderModel.class.php b/Application/Admin/Model/CoinPayOrderModel.class.php new file mode 100644 index 000000000..b5bd300cb --- /dev/null +++ b/Application/Admin/Model/CoinPayOrderModel.class.php @@ -0,0 +1,82 @@ + +// +---------------------------------------------------------------------- + +namespace Admin\Model; +use Think\Model; + +/** + * 文档基础模型 + */ +class CoinPayOrderModel extends Model{ + /** + * 构造函数 + * @param string $name 模型名称 + * @param string $tablePrefix 表前缀 + * @param mixed $connection 数据库连接信息 + */ + public function __construct($name = '', $tablePrefix = '', $connection = '') { + /* 设置默认的表前缀 */ + $this->tablePrefix ='tab_'; + /* 执行构造方法 */ + parent::__construct($name, $tablePrefix, $connection); + } + public function lists($p=1, $map=array(), $order, $field=true) + { + + $page = intval($p); + + $page = $page ? $page : 1; //默认显示第一页数据 + + if(isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + + $list = $this->field($field?:true) + ->where($map) + ->page($page, $row) + ->order($order?$order:'pay_time desc') + ->select(); + + $count = $this->where($map)->count(); + + $data['data'] = $list; + + $page = set_pagination($count,$row); + + if($page) { + $data['page']=$page; + } + + return $data; + } + //获取单个信息 + public function info($id) + { + $info = $this->field($field?:true) + ->where("id = '".$id."'") + ->find(); + if(!empty($info['voucher_img'])){ + $info['voucher_img'] = get_cover($info['voucher_img'])['path']; + } + + return $info; + # code... + } + //更新 + public function updateData($save,$id) + { + if(!empty($save['id'])){ + return false; + } + return $this->where("id = {$id}")->save($save); + # code... + } +} \ No newline at end of file diff --git a/Application/Admin/View/PromoteCoin/offlineList.html b/Application/Admin/View/PromoteCoin/offlineList.html new file mode 100644 index 000000000..bfb744abb --- /dev/null +++ b/Application/Admin/View/PromoteCoin/offlineList.html @@ -0,0 +1,342 @@ + + + + + + + + + + + +
+ + +
+
+ +
+ +
+ +
+
+ + - +
+ + +
+
+
+ +
+ + +
+ 搜索 +
+
+ + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 充值账号提交时间平台币数量付款金额汇入银行支付凭证备注审核状态操作
aOh! 暂时还没有内容!
{$data.promote_account}{:set_show_time($data['create_time'])}{$data.pay_amount}{$data.real_amount}— —{$data.pay_order_number}{$data.remark} + 待审核 + 审核通过 + 审核不通过 + + + 查看 +
+
+
+
+ + {$_page|default=''} +
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + diff --git a/Application/Admin/View/PromoteCoin/offlineOrderInfo.html b/Application/Admin/View/PromoteCoin/offlineOrderInfo.html new file mode 100644 index 000000000..cb0193cb3 --- /dev/null +++ b/Application/Admin/View/PromoteCoin/offlineOrderInfo.html @@ -0,0 +1,154 @@ + + + + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
充值账号: + {$data['promote_account']} +
平台币数量: + {$data['pay_amount']} +
购买金额: + {$data['real_amount']} +
汇入银行: + -- +
支付凭证: + {$data['pay_order_number']} +
支付截图: + +
备注: + {$data['remark']} +
+
+ + +
+
+
+
+
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + \ No newline at end of file From 2f124bffbbea12ba4d1eb59cda18415aaffc4b8a Mon Sep 17 00:00:00 2001 From: chenzhi <“chenzhi063@qq.com> Date: Thu, 24 Oct 2019 08:51:51 +0800 Subject: [PATCH 2/2] coin_num --- Application/Admin/View/PromoteCoin/offlineList.html | 2 +- Application/Admin/View/PromoteCoin/offlineOrderInfo.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Application/Admin/View/PromoteCoin/offlineList.html b/Application/Admin/View/PromoteCoin/offlineList.html index bfb744abb..ef6e8927a 100644 --- a/Application/Admin/View/PromoteCoin/offlineList.html +++ b/Application/Admin/View/PromoteCoin/offlineList.html @@ -115,7 +115,7 @@ {$data.promote_account} {:set_show_time($data['create_time'])} - {$data.pay_amount} + {$data.coin_num} {$data.real_amount} — — {$data.pay_order_number} diff --git a/Application/Admin/View/PromoteCoin/offlineOrderInfo.html b/Application/Admin/View/PromoteCoin/offlineOrderInfo.html index cb0193cb3..30f8c2aed 100644 --- a/Application/Admin/View/PromoteCoin/offlineOrderInfo.html +++ b/Application/Admin/View/PromoteCoin/offlineOrderInfo.html @@ -45,7 +45,7 @@ 平台币数量: - {$data['pay_amount']} + {$data['coin_num']}