优化打款
parent
c3688db1f2
commit
903e98e3cf
@ -0,0 +1,240 @@
|
||||
<?php
|
||||
namespace Payment\Controller;
|
||||
/**
|
||||
* 后台首页控制器
|
||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||
*/
|
||||
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 : '<br />');
|
||||
|
||||
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']})<br>".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"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
<extend name="Public/base"/>
|
||||
|
||||
<block name="body">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
|
||||
<script src="__STATIC__/jquery.form.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js"></script>
|
||||
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
|
||||
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
|
||||
<style>
|
||||
.select2-container--default .select2-selection--single {
|
||||
color: #000;
|
||||
resize: none;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
|
||||
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
|
||||
height:28px;border-radius:3px;font-size:12px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height:35px;
|
||||
line-height:28px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height:26px;
|
||||
}
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
height:26px;line-height:26px;font-size:12px;
|
||||
}
|
||||
.select2-results__option[aria-selected] {font-size:12px;}
|
||||
.layui-layer-dialog .layui-layer-content{color:red}
|
||||
.butnbox {padding:10px 0 10px;}
|
||||
.butnbox .butnlist {overflow:hidden;clear:both;}
|
||||
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
|
||||
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
|
||||
.butnbox .butnlist .butn.last {background:#009900;}
|
||||
.butnbox .butnlist .butn~.butn {margin-left:20px;}
|
||||
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
|
||||
.layui-layer-title {
|
||||
text-align: center;
|
||||
height: 80px;
|
||||
line-height: 80px;
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
}
|
||||
/* .data_list table td{
|
||||
line-height: 2;
|
||||
} */
|
||||
|
||||
.layui-layer-title {
|
||||
text-align: center;
|
||||
height: 42px;
|
||||
line-height: 42px;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
}
|
||||
.tooltip {
|
||||
position: relative;
|
||||
/* display: block; */
|
||||
/* color: #056dae; */
|
||||
}
|
||||
|
||||
.tooltip .tooltiptext {
|
||||
display: none;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 6px;
|
||||
padding: 5px 10px 5px 5px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
bottom: 80%;
|
||||
left: 0;
|
||||
border: #000 solid 1px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.tooltip .tooltiptext::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: black transparent transparent transparent;
|
||||
}
|
||||
|
||||
.tooltip:hover .tooltiptext {
|
||||
color: #333;
|
||||
display: block;
|
||||
|
||||
}
|
||||
.page .sch-btn:before{
|
||||
content: '';
|
||||
padding: 0;
|
||||
}
|
||||
::-webkit-scrollbar {
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
border-radius: 3px; /*滚动条的背景区域的圆角*/
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 3px; /*滚动条的圆角*/
|
||||
background-color: #ccc; /*滚动条的背景颜色*/
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background-color: #bbb;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:active {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.triangle{
|
||||
width:0;
|
||||
height:0;
|
||||
border-top:10px solid blue;
|
||||
border-left:8px solid transparent;
|
||||
border-right:8px solid transparent;
|
||||
border-bottom:0;
|
||||
/*float: left;*/
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="cf main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">打款名录</h3>
|
||||
<p class="description_text">导出后可批量打款</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="cf top_nav_list" style="height: 38px;">
|
||||
<!-- 高级搜索 -->
|
||||
<div class="jssearch fl cf search_list" style="margin-bottom: 0">
|
||||
<div class="input-list">
|
||||
<input type="text" name="nickname" class="" value="{:I('nickname')}" placeholder="昵称查找" style="width: 180px;"/>
|
||||
</div>
|
||||
|
||||
<div class="input-list">
|
||||
<a class="sch-btn" href="javascript:;" id="search" url="{:U('customerLists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="butnbox" >
|
||||
<div class="butnlist jscheckbutn" style="margin-left: 2px">
|
||||
<a class='butn' id='customerExport'>导出所选记录</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<div class="data_list">
|
||||
<div class="">
|
||||
<table>
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input class="check-all" type="checkbox"></th>
|
||||
<th>昵称</th>
|
||||
<th>openid</th>
|
||||
<th>头像</th>
|
||||
<th>添加时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- 列表 -->
|
||||
<tbody>
|
||||
<if condition = "empty($data)">
|
||||
<tr>
|
||||
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
</tr>
|
||||
</if>
|
||||
<notemtpy name = "data">
|
||||
<volist name="data" id="data">
|
||||
<tr>
|
||||
<td ><input class="ids" type="checkbox" value="{$data['ids']}" data-verify_id="{$data['id']}" name="ids[]"></td>
|
||||
<td>{$data.nickname}</td>
|
||||
<td>{$data.openid}</td>
|
||||
<td style="display: flex;justify-content:center"><img src="{$data.avatar}" style="width: 50px;height: auto;"></td>
|
||||
<td>{$data.create_time}</td>
|
||||
</tr>
|
||||
</volist>
|
||||
</notemtpy>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="page">
|
||||
{$_page|default=''}
|
||||
</div>
|
||||
</block>
|
||||
|
||||
<block name="script">
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
||||
<php>if(C('COLOR_STYLE')=='blue_color') echo '
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
|
||||
';
|
||||
</php>
|
||||
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<script src="__STATIC__/laydate/laydate.js" type="text/javascript"></script>
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
<script>
|
||||
<volist name=":I('get.')" id="vo">
|
||||
Think.setValue('{$key}',"{$vo}");
|
||||
</volist>
|
||||
$(".select_gallery").select2();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
//导航高亮
|
||||
highlight_subnav("{:U('customerLists')}");
|
||||
|
||||
$(function(){
|
||||
$("#customerExport").click(function () {
|
||||
var flag = false;
|
||||
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
|
||||
return $(elem).data("verify_id");
|
||||
}).get();
|
||||
|
||||
if(text.length < 1){
|
||||
layer.msg("<font style='color:white'>" + '请先选择要导出的打款单' + "</font>");
|
||||
return;
|
||||
}
|
||||
_export();
|
||||
function _export(){
|
||||
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中,注意打款金额默认为元,打款模板的表头不允许修改"+ "</font>");
|
||||
var id = text.join(",");
|
||||
var url ="{:U('customerExport')}"+"&ids="+id;
|
||||
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"
|
||||
$("body").append(iframeExcel);
|
||||
}
|
||||
});
|
||||
$("#search").click(function(){
|
||||
var url = $(this).attr('url');
|
||||
var query = $('.jssearch').find('input').serialize();
|
||||
query += "&"+$('.jssearch').find('select').serialize();
|
||||
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
|
||||
query = query.replace(/^&/g,'');
|
||||
if( url.indexOf('?')>0 ){
|
||||
url += '&' + query;
|
||||
}else{
|
||||
url += '?' + query;
|
||||
}
|
||||
window.location.href = url;
|
||||
});
|
||||
//回车自动提交
|
||||
$('.jssearch').find('input').keyup(function(event){
|
||||
if(event.keyCode===13){
|
||||
$("#search").click();
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
</block>
|
Binary file not shown.
Loading…
Reference in New Issue