diff --git a/Application/Payment/Controller/WxPaymentController.class.php b/Application/Payment/Controller/WxPaymentController.class.php new file mode 100644 index 000000000..8b081683d --- /dev/null +++ b/Application/Payment/Controller/WxPaymentController.class.php @@ -0,0 +1,240 @@ + + */ +class WxPaymentController extends BaseController +{ + public $PayStatus=[ + "-2"=>"信息配置不全", + "-1"=>"打款失败", + "0"=>"未打款", + "1"=>"打款成功" + ]; + public $CompanyType = [ + "1"=>"下游公司", + "2"=>"下游个人", + "3"=>"上游CP" + ]; + public $ALIRSP=[ + "out_biz_no"=>"商户订单号", + "order_id"=>"支付订单号", + "pay_fund_order_id"=>"资金流水号", + "status"=>"转账状态", + "trans_date"=>"订单支付时间", + "msg"=>"支付信息", + "sub_msg"=>"失败描述", + "sub_code"=>"失败码", + "remark"=>"打款备注", + "code"=>"打款状态码" + ]; + public function _initialize() + { + $this->admininfo = session('payment_user');; + // $this->DBModel = M("CompanyStatementPool","tab_"); + parent::_initialize(); + } + public function customerLists() + { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + $where = []; + if(isset($_REQUEST['nickname'])){ + $where['nickname'] = ["LIKE","%{$_REQUEST['nickname']}%"]; + } + $data = M('mini_program_user', 'tab_') + ->field("wx_json",true) + ->where($where) + ->page($page,$row) + ->select(); + foreach ($data as $key => $value) { + $data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']); + } + $count = M('mini_program_user', 'tab_')->where($where)->count(); + $page = set_pagination_all($count['count'], $row); + if ($page) { + $this->assign('_page', $page); + } + $this->assign('data', $data); + $this->display(); + } + + public function customerExport() + { + $where["_string"]="1=1"; + if($_REQUEST['ids']){ + $where = [ + "id"=>["in",$_REQUEST['ids']] + ]; + } + + $data = M('mini_program_user', 'tab_') + ->field("wx_json",true) + ->where($where) + ->select(); + + header("Content-type: text/html; charset=utf-8"); + error_reporting(E_ALL); + ini_set('display_errors', TRUE); + ini_set('display_startup_errors', TRUE); + + define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + + Vendor("PHPExcel.PHPExcel"); + $objPHPExcel = new \PHPExcel(); + $objReader = \PHPExcel_IOFactory::createReader('Excel2007'); + $objPHPExcel = $objReader->load("Public/Admin/excel/customer.xlsx"); + $line = 2; + //设置模板文件 + foreach ($data as $key => $value) { + $objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $line-1)->setCellValue('B'.$line, $value['openid']); + $line++; + } + + $fileName = "微信打款模板"; + ob_end_clean();//清除缓冲区,避免乱码 + header('pragma:public'); + header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xlsx'); + header("Content-Disposition:attachment;filename={$fileName}.xlsx");//attachment新窗口打印inline本窗口打印 + $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); + $objWriter->save('php://output'); + exit; + } + + public function lists() + { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + + $map=[ + "_string"=>"1=1", + ]; + + if (isset($_REQUEST['pay_time_start']) && isset($_REQUEST['pay_time_end'])) { + $map['pay_time'] = ['between', [strtotime($_REQUEST['pay_time_start']), strtotime($_REQUEST['pay_time_end']) + 86399]]; + } elseif (isset($_REQUEST['pay_time_start'])) { + $map['pay_time'] = ['EGT', strtotime($_REQUEST['pay_time_start'])]; + } elseif (isset($_REQUEST['pay_time_end'])) { + $map['pay_time'] = ['ELT', strtotime($_REQUEST['pay_time_end']) + 86399]; + } + + if(isset($_REQUEST['realname'])){ + $map['realname'] = ['LIKE',"%".$_REQUEST['realname']."%"]; + } + if(isset($_REQUEST['pay_status'])){ + $map['pay_status'] = $_REQUEST['pay_status']; + } + if(isset($_REQUEST['batch_num'])){ + $map['batch_num'] = ["LIKE","%{$_REQUEST['batch_num']}%"]; + } + + + if (isset($_REQUEST['export']) && $_REQUEST['export']==1) { + $data = M("excel_statement_info","tab_") + ->alias('i') + ->field("i.*") + ->where($map) + ->order("FIELD(pay_status,0,-1,1)") + ->select(); + $ids = array_column($data, 'id'); + $ids = implode(',', $ids); + $this->viewPool($ids); + return ; + } + $CompanyInfo = M("excel_statement_info","tab_") + ->alias('i') + ->field("i.*") + ->where($map) + ->page($page,$row) + ->order("FIELD(pay_status,0,-1,1)") + ->select(); + foreach($CompanyInfo as $k=>&$v){ + $v['can_pay'] = 1; + if($v['pay_status'] == 1){ $v['can_pay'] = 0; } + if($v['statement_money'] < 0.1){ $v['can_pay'] = 0; } + + $v['company_type'] = $this->CompanyType[$v['company_type']]; + $v["pay_status_str"] = $this->PayStatus[$v['pay_status']]; + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + // $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']); + // $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']); + if(empty($v['pay_time'])){ + $v['pay_time'] = "--"; + }else{ + $v['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']); + } + + if($v['verify_status'] == 0){ + $v['verify'] = "--"; + }else { + $member = M("payment_member") + ->field("name") + ->where(['id'=>$v['verify_member_id']]) + ->find(); + $v['verify'] = (($v['verify_status'] == 1)?'审核通过':'审核拒绝')."({$member['name']})
".date('Y-m-d H:i:s', $v['verify_time']);; + } + + // $v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}"; + } + + //统计待打款金额 + $field = "IFNULL(SUM(CASE WHEN pay_status = 1 THEN statement_money ELSE 0 END),0) as success_money, + IFNULL(SUM(CASE WHEN pay_status = 0 THEN statement_money ELSE 0 END),0) as statement_money, + IFNULL(SUM(CASE WHEN pay_status = -1 THEN statement_money ELSE 0 END),0) as error_money"; + $money = M("excel_statement_info","tab_")->alias('i')->field( $field)->where($map)->find(); + + $count = M("excel_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find(); + $page = set_pagination_all($count['count'], $row); + if ($page) { + $this->assign('_page', $page); + } + // echo($page);die(); + $this->meta_title = '线下打款'; + $this->assign("data",$CompanyInfo); + $this->assign("money",$money); + $this->assign("CompanyType", $this->CompanyType); + $this->assign("PayStatus", $this->PayStatus); + + + $this->display(); + } + + public function add() + { + $batch = date('Ymd').date('His').sp_random_num(3); + $this->assign("batch",$batch); + $this->meta_title = 'EXCEL导入'; + $this->display(); + } + + public function loopAdd() + { + $p = $_REQUEST; + $batch = $p['batch']; + $checkarr = $p['checkarr']; + //循环获取添加 + if(count($checkarr) < 1){ + $this->ajaxReturn(["status"=>1,"msg"=>"ok"]); + } + $wxPayment = M('wx_payment',"tab_"); + foreach ($checkarr as $k => &$v) { + if(!isset($v['realname']) || !isset($v['openid']) || !isset($v['statement_money']) || $v['realname'] == '' || $v['openid'] == '' || $v['statement_money'] <= 0){ + $wxPayment->where("batch_num = '{$v['batch_num']}'")->delete(); + $this->ajaxReturn(["status"=>0,"msg"=>"真实姓名,openid,打款金额均不允许为空"]); + } + $v['batch_num'] = $batch; + $res = $wxPayment->add($v); + if($res === false){ + $wxPayment->where("batch_num = '{$v['batch_num']}'")->delete(); + $this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]); + } + } + $this->ajaxReturn(["status"=>1,"msg"=>"ok"]); + } + + + +} diff --git a/Application/Payment/View/Public/base.html b/Application/Payment/View/Public/base.html index e6fd26592..f44ac7e86 100644 --- a/Application/Payment/View/Public/base.html +++ b/Application/Payment/View/Public/base.html @@ -223,6 +223,17 @@ $(function(){ 线下付款 + +

微信打款

+ + diff --git a/Application/Payment/View/WxPayment/add.html b/Application/Payment/View/WxPayment/add.html new file mode 100644 index 000000000..b51f88bdd --- /dev/null +++ b/Application/Payment/View/WxPayment/add.html @@ -0,0 +1,316 @@ + + + + + + if(C('COLOR_STYLE')=='blue_color') echo ' + '; + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + +
本次批次号: +
+
+ +
*文件上传: +
+ +
+ 暂只支持.xls .xlsx 格式文件 +
+
+
+ + + 返回 + +
+
+ + +
+
+
+ 文件格式参考:请严格按此格式,文件的第一行必须是字段名,且字段名不允许修改 +
+ + + + + + + + + + + + + + + + + + +
序号openid真实姓名打款金额
1oGkwL49glkGPgU3h0iEBQVIrY036张小花56.26
+
+ + +
+ + + + + + + + + \ No newline at end of file diff --git a/Application/Payment/View/WxPayment/customerLists.html b/Application/Payment/View/WxPayment/customerLists.html new file mode 100644 index 000000000..ade254b1e --- /dev/null +++ b/Application/Payment/View/WxPayment/customerLists.html @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+ 搜索 +
+ +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
昵称openid头像添加时间
aOh! 暂时还没有内容!
{$data.nickname}{$data.openid}{$data.create_time}
+
+ +
+
+ {$_page|default=''} +
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + + + diff --git a/Application/Payment/View/WxPayment/lists.html b/Application/Payment/View/WxPayment/lists.html new file mode 100644 index 000000000..740ff5e17 --- /dev/null +++ b/Application/Payment/View/WxPayment/lists.html @@ -0,0 +1,788 @@ + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +  -  +
+ + +
+
+ +
+ 搜索 +
+ +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
真实姓名openid结算金额批次号打款状态创建时间支付时间操作
aOh! 暂时还没有内容!
{$data.realname}{$data.openid}{$data.statement_money}{$data.batch_num}{$data.pay_status_str}{$data.pay_status_str}{$data.create_time}{$data.pay_time} + 查看 + 导出 + + 打款详情 + +
合计 + 待打款金额: {$money.statement_money}    打款成功金额: {$money.success_money}    打款失败金额: {$money.error_money} +
+
+ +
+
+ {$_page|default=''} +
+ + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + + + diff --git a/Public/Admin/excel/customer.xlsx b/Public/Admin/excel/customer.xlsx new file mode 100644 index 000000000..767e2b3c1 Binary files /dev/null and b/Public/Admin/excel/customer.xlsx differ