You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
583 lines
22 KiB
PHP
583 lines
22 KiB
PHP
<?php
|
|
namespace Payment\Controller;
|
|
/**
|
|
* 后台首页控制器
|
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
|
*/
|
|
class ExcelPaymentController extends BaseController
|
|
{
|
|
public $PayStatus=[
|
|
"-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 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['time_start']) && isset($_REQUEST['time_end'])) {
|
|
$time_start = strtotime($_REQUEST['time_start']);
|
|
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
|
|
$map["_string"] = "(i.statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (i.statement_end_time BETWEEN {$time_start} AND {$time_end})";
|
|
} elseif (isset($_REQUEST['time_start'])) {
|
|
$time_start = strtotime($_REQUEST['time_start']);
|
|
$map["_string"] = "(i.statement_begin_time >= {$time_start} ) OR (i.statement_end_time >= {$time_start})";
|
|
} elseif (isset($_REQUEST['time_end'])) {
|
|
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
|
|
$map["_string"] = "(i.statement_begin_time <= {$time_end} ) OR (i.statement_end_time <= {$time_end})";
|
|
}
|
|
|
|
if (isset($_REQUEST['pay_time_start']) && isset($_REQUEST['pay_time_end'])) {
|
|
$map['i.pay_time'] = ['between', [strtotime($_REQUEST['pay_time_start']), strtotime($_REQUEST['pay_time_end']) + 86399]];
|
|
} elseif (isset($_REQUEST['pay_time_start'])) {
|
|
$map['i.pay_time'] = ['EGT', strtotime($_REQUEST['pay_time_start'])];
|
|
} elseif (isset($_REQUEST['pay_time_end'])) {
|
|
$map['i.pay_time'] = ['ELT', strtotime($_REQUEST['pay_time_end']) + 86399];
|
|
}
|
|
|
|
if (isset($_REQUEST['verifytime_start']) && isset($_REQUEST['verifytime_end'])) {
|
|
$map['i.verify_time'] = ['between', [strtotime($_REQUEST['verifytime_start']), strtotime($_REQUEST['verifytime_end']) + 86399]];
|
|
} elseif (isset($_REQUEST['verifytime_start'])) {
|
|
$map['i.verify_time'] = ['EGT', strtotime($_REQUEST['verifytime_start'])];
|
|
} elseif (isset($_REQUEST['verifytime_end'])) {
|
|
$map['i.verify_time'] = ['ELT', strtotime($_REQUEST['verifytime_end']) + 86399];
|
|
}
|
|
|
|
if(isset($_REQUEST['company_name'])){
|
|
$map['i.company_name'] = ['LIKE',"%".$_REQUEST['company_name']."%"];
|
|
}
|
|
|
|
if(isset($_REQUEST['pay_status'])){
|
|
$map['i.pay_status'] = $_REQUEST['pay_status'];
|
|
}
|
|
if(isset($_REQUEST['batch_num'])){
|
|
$map['i.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;
|
|
// $statement_begin_time = strtotime($p['statement_begin_time']);
|
|
// $statement_end_time = strtotime($p['statement_end_time'])+86399;
|
|
$batch = $p['batch'];
|
|
$checkarr = $p['checkarr'];
|
|
//循环获取添加
|
|
if(count($checkarr) < 1){
|
|
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
|
|
}
|
|
// dump($batch);die();
|
|
|
|
$ExcelStatementInfo = M('ExcelStatementInfo',"tab_");
|
|
foreach ($checkarr as $k => &$v) {
|
|
$company_info = $v['company_info'];
|
|
// $v['statement_begin_time'] = $statement_begin_time;
|
|
// $v['statement_end_time'] = $statement_end_time;
|
|
|
|
$statement_time = explode('-',$v['statement_info'][0]['game_list'][0]['statement_time']);
|
|
|
|
$v['batch_num'] = $batch;
|
|
$v['statement_info'] = json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE);
|
|
$v['company_info'] = json_encode($v['company_info'],JSON_UNESCAPED_UNICODE);
|
|
$v['company_type'] = 2;
|
|
$v['create_time'] = time();
|
|
|
|
|
|
$v['statement_begin_time'] = strtotime(str_replace('.','-',$statement_time[0]));
|
|
$v['statement_end_time'] = strtotime(str_replace('.','-',$statement_time[1]));
|
|
|
|
$v['statement_num'] = "JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5);
|
|
$dm = [
|
|
"mobile"=>$this->admininfo['mobile'],
|
|
"real_name"=>$this->admininfo['real_name'],
|
|
"time"=>date("Y-m-d H:i:s")
|
|
];
|
|
$v['document_maker'] = json_encode($dm,JSON_UNESCAPED_UNICODE);
|
|
|
|
if(!isset($company_info['ali_user']) || !isset($company_info['ali_account']) || $company_info['ali_user'] == '' || $company_info['ali_account'] == ''){
|
|
M('ExcelStatementInfo',"tab_")->where("batch_num = '{$v['batch_num']}'")->delete();
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"支付宝真实姓名及登陆账号不允许为空"]);
|
|
}
|
|
|
|
$res = $ExcelStatementInfo->add($v);
|
|
if($res === false){
|
|
M('ExcelStatementInfo',"tab_")->where("batch_num = '{$v['batch_num']}'")->delete();
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
|
|
}
|
|
|
|
}
|
|
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
|
|
}
|
|
//查看
|
|
public function viewPool($id)
|
|
{
|
|
if (!$id) {
|
|
if (!isset($_REQUEST['id'])) $this->error("参数错误");
|
|
$id = $_REQUEST['id'];
|
|
}
|
|
$is_export= false;
|
|
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
|
|
$is_export = true;
|
|
}
|
|
//获取基本信息
|
|
if($is_export && isset($_REQUEST['exporttype']) && $_REQUEST['exporttype']=='all'){
|
|
$dbres = M("ExcelStatementInfo","tab_")->where("id in ({$id})")->select();
|
|
$title = date("YmdHis");
|
|
}else{
|
|
$dbres = M("ExcelStatementInfo","tab_")->where("id ='{$id}'")->select();
|
|
$title = $dbres[0]['company_name'].date("YmdHis");
|
|
}
|
|
|
|
$this->assign("title",$title);
|
|
$this->viewPuPool($dbres,$is_export);
|
|
|
|
}
|
|
public function delItem()
|
|
{
|
|
if(!isset($_REQUEST['ids'])){
|
|
$this->error('参数错误');
|
|
}
|
|
$ids = $_REQUEST['ids'];
|
|
$map = [
|
|
"pay_status"=>["NEQ",1],
|
|
"id"=>["IN",$ids]
|
|
];
|
|
$dbres = M("ExcelStatementInfo","tab_")->where($map)->delete();
|
|
if($dbres === false){
|
|
$this->ajaxReturn(["status"=>0,"info"=>"删除失败"]);
|
|
}
|
|
$this->ajaxReturn(["status"=>1,"info"=>"删除成功"]);
|
|
|
|
}
|
|
//个人汇总结算查看
|
|
public function viewPuPool(&$infolist,$is_export){
|
|
$line = 1;
|
|
$count = [];
|
|
//获取对接人
|
|
foreach($infolist as $k=>&$v){
|
|
$v['statement_info'] = json_decode($v['statement_info'],true);
|
|
$v['company_info'] = json_decode($v['company_info'],true);
|
|
// $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
|
|
// $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
|
|
|
|
$cline = $line+1;
|
|
if($is_export){
|
|
$v['sum_money_exp'] = "=";
|
|
$hh = "\n";
|
|
}else{
|
|
$hh = "<br>";
|
|
}
|
|
|
|
$dm = json_decode($v['document_maker'],true);
|
|
$v['document_maker'] = $dm['mobile'].$hh."({$dm['real_name']})";
|
|
if(!empty($v['payment_user'])){
|
|
$pu = json_decode($v['payment_user'],true);
|
|
$v['payment_user'] = $pu['mobile'].$hh."({$pu['real_name']})";
|
|
}else{
|
|
$v['payment_user'] = "--";
|
|
}
|
|
$v["pay_status_str"] = $this->PayStatus[$v['pay_status']];
|
|
if(!empty($v['pay_time'])){
|
|
$v['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']);
|
|
}else{
|
|
$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']})\n".date('Y-m-d H:i:s', $v['verify_time']);;
|
|
}
|
|
|
|
$row = 0;
|
|
foreach($v['statement_info'] as $ke=>&$va){
|
|
$va['row'] = count($va['game_list']);
|
|
$row += count($va['game_list']);
|
|
foreach($va['game_list'] as $key=>&$val){
|
|
$line ++;
|
|
if(isset($val['ratio'])){
|
|
$val['increment_ratio'] = 0;
|
|
}else{
|
|
$val['ratio'] = 0;
|
|
}
|
|
$val['ratio'] = $val['ratio']*100;
|
|
$val['increment_ratio'] = $val['increment_ratio']*100;
|
|
if($is_export){
|
|
// $val['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
|
|
}else{
|
|
$count['platform_amount'] += $val['pay_amount'];
|
|
$count['sum_money'] += $val['sum_money'];
|
|
}
|
|
}
|
|
}
|
|
$v['row'] = $row;
|
|
}
|
|
if($is_export){
|
|
$count["platform_amount"] = "=SUM(J2:J".$line.")";
|
|
$count["sum_money"] = "=SUM(D2:D".$line.")";
|
|
}
|
|
$this->assign("data",$infolist);
|
|
$this->assign("count",$count);
|
|
$this->assign("is_export",$is_export);
|
|
$this->display("viewPuPool");
|
|
}
|
|
|
|
public function showPayment()
|
|
{
|
|
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
|
|
$ids = $_REQUEST['ids'];
|
|
|
|
$CompanyInfo = M("ExcelStatementInfo","tab_")
|
|
->alias('i')
|
|
->field("i.id,i.company_name,i.company_info,i.statement_money,i.batch_num,i.remark,i.pay_status")
|
|
->where("i.id in ({$ids})")
|
|
->select();
|
|
foreach($CompanyInfo as $k=>&$v){
|
|
$v['company_info'] = json_decode($v['company_info'],true);
|
|
$v['company_info']['ali_user'] ?? '';
|
|
$v['company_info']['ali_account'] ?? '';
|
|
}
|
|
|
|
$count = M("ExcelStatementInfo","tab_")->field("sum(statement_money) statement_money")->where("id in ({$ids})")->find();
|
|
$paymentInfo = D("Admin/TransferMerchant")->getUnderPaymentInfo();
|
|
$this->getAccountMoney();
|
|
|
|
$this->assign("CompanyInfo",$CompanyInfo);
|
|
$this->assign("mobile",$this->admininfo['mobile']);
|
|
$this->assign("count",$count);
|
|
$this->assign("paymentInfo",$paymentInfo);
|
|
$this->display();
|
|
|
|
// $this->display();
|
|
|
|
}
|
|
public function getAccountMoney(){
|
|
Vendor("Alipay2020/Fund");
|
|
$isCanPayment = true;
|
|
if(empty(C("ALI_PAYMENT"))){
|
|
$isCanPayment = false;
|
|
$money = "测试站无法查看";
|
|
}else{
|
|
$fund = new \Fund(D("Admin/TransferMerchant")->getUnderPaymentConfig());
|
|
$money = $fund->account();
|
|
if($money !== -1){
|
|
$money = $money['amount'];
|
|
}else{
|
|
$isCanPayment = false;
|
|
$money = "--";
|
|
}
|
|
}
|
|
$this->assign("isCanPayment",$isCanPayment);
|
|
$this->assign("money",$money);
|
|
}
|
|
//以下打款流程
|
|
public function checkVerify()
|
|
{
|
|
$mobile = $this->admininfo['mobile'];
|
|
$verify = $_REQUEST['verify'];
|
|
if (!A("Public")->checksafecode($mobile, $verify)) {
|
|
$this->ajaxReturn(["error"=>"验证码错误"]);
|
|
}
|
|
$this->ajaxReturn(["success"=>"验证码验证成功","data"=>[]]);
|
|
}
|
|
//执行打款
|
|
public function doPayment()
|
|
{
|
|
$id = $_REQUEST['id'];
|
|
$remark = $_REQUEST['remark'];
|
|
if (empty(C("ALI_PAYMENT"))) {
|
|
$this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>['status'=>0]]);
|
|
}
|
|
|
|
Vendor("Alipay2020/Fund");
|
|
$fund = new \Fund(D("Admin/TransferMerchant")->getUnderPaymentConfig());
|
|
$dbres = M("ExcelStatementInfo", "tab_")->where("id='{$id}'")->find();
|
|
$company_info = json_decode($dbres['company_info'], true);
|
|
|
|
if ($dbres['pay_status'] != 1) {
|
|
//执行打款
|
|
$title = $remark;
|
|
$amount = $dbres['statement_money'];
|
|
$payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title);
|
|
$resultCode = $payres->code;
|
|
|
|
$savedata = ["id"=>$dbres['id']];
|
|
if (!empty($resultCode)&&$resultCode == 10000) {
|
|
$savedata["pay_status"]=1;
|
|
} else {
|
|
$savedata["pay_status"]=-1;
|
|
}
|
|
|
|
$payres = json_decode(json_encode($payres), true);
|
|
$payres["remark"] = $remark;
|
|
|
|
$savedata["pay_info"] = json_encode($payres, JSON_UNESCAPED_UNICODE);
|
|
$savedata["pay_time"]=time();
|
|
$pu = [
|
|
"mobile"=>$this->admininfo['mobile'],
|
|
"real_name"=>$this->admininfo['real_name'],
|
|
"time"=>date("Y-m-d H:i:s")
|
|
];
|
|
$savedata['payment_user'] = json_encode($pu, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
M("ExcelStatementInfo", "tab_")->save($savedata);
|
|
|
|
if ($savedata['pay_status'] == 1) {
|
|
$this->ajaxReturn(["success"=>"打款成功","data"=>['status'=>1]]);
|
|
} else {
|
|
$this->ajaxReturn(["success"=>"打款失败","data"=>['status'=>0]]);
|
|
}
|
|
|
|
|
|
}
|
|
/**
|
|
* 打款详情
|
|
*/
|
|
public function paymentInfo()
|
|
{
|
|
if(!isset($_REQUEST['id'])) $this->error("参数错误");
|
|
$id = $_REQUEST['id'];
|
|
$info = M("ExcelStatementInfo","tab_")->field("pay_info")->where("id='{$id}'")->find()['pay_info'];
|
|
$info = json_decode($info,true);
|
|
$senddata = [];
|
|
foreach($info as $k => &$v){
|
|
if(isset($this->ALIRSP[$k])){
|
|
$senddata[$this->ALIRSP[$k]] = $v;
|
|
}else{
|
|
$senddata[$k] = $v;
|
|
}
|
|
}
|
|
$this->assign("info",$senddata);
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* 打款审核
|
|
*/
|
|
public function verify() {
|
|
// dump($_SESSION['onethink_admin']['payment_user']['id']);die();
|
|
if ((!$_REQUEST['id']||!$_REQUEST['status'])&&$_REQUEST['status']!='0') {
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'数据传输错误']);
|
|
}
|
|
|
|
$id = $_REQUEST['id'];
|
|
$status = $_REQUEST['status'];
|
|
$member_id = $_SESSION['onethink_admin']['payment_user']['id'];
|
|
|
|
($status == 1)?($status_str = '已审核通过'):($status_str = '已审核拒绝');
|
|
|
|
$verify = M("excel_statement_info","tab_")
|
|
->where([
|
|
'id'=>['in',$id]
|
|
])
|
|
->save([
|
|
'verify_status'=>$status,
|
|
'verify_time'=>time(),
|
|
'verify_member_id'=>$member_id
|
|
]);
|
|
|
|
if ($verify) {
|
|
$this->ajaxReturn(['status'=>1,'msg'=>$status_str]);
|
|
} else {
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'审核失败请重新审核']);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* 验证订单
|
|
*/
|
|
public function checkOrder() {
|
|
|
|
if(!$_REQUEST['ids']) {
|
|
$this->ajaxReturn(['data'=>[]]);
|
|
}
|
|
|
|
$ids = $_REQUEST['ids'];
|
|
|
|
$data = M("excel_statement_info","tab_")
|
|
->field("id,statement_money,company_name,statement_begin_time,statement_end_time,pay_time")
|
|
->where(['id'=>['in',$ids]])
|
|
->select();
|
|
|
|
|
|
$return = [];
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
$check_data = M("excel_statement_info","tab_")
|
|
->where([
|
|
'statement_money'=>$value['statement_money'],
|
|
'company_name'=>$value['company_name'],
|
|
'statement_begin_time'=>$value['statement_begin_time'],
|
|
'statement_end_time'=>$value['statement_end_time'],
|
|
'id'=>['neq',$value['id']],
|
|
'pay_status'=>1
|
|
])
|
|
->select();
|
|
|
|
$check_company_statement_info = M("pay_statement_info","tab_")
|
|
->where([
|
|
'pay_status'=>1,
|
|
'company_name'=>$value['company_name'],
|
|
'statement_begin_time'=>$value['statement_begin_time'],
|
|
'statement_end_time'=>$value['statement_end_time'],
|
|
'statement_money'=>$value['statement_money'],
|
|
])
|
|
->select();
|
|
|
|
|
|
|
|
$return = array_merge($return,$check_data,$check_company_statement_info);
|
|
|
|
}
|
|
|
|
foreach ($return as $key => $value) {
|
|
|
|
$return[$key]['time'] = ($value['statement_begin_time']?date("Y-m-d",$value['statement_begin_time']):'无').'-'.($value['statement_end_time']?date("Y-m-d",$value['statement_end_time']):'无');
|
|
$return[$key]['pay_time'] = date("Y-m-d H:m:s",$value['pay_time']);
|
|
|
|
}
|
|
|
|
$this->ajaxReturn(['data'=>$return]);
|
|
|
|
}
|
|
|
|
//模板导出
|
|
public function downloadTemplate()
|
|
{
|
|
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/underPayment.xlsx");
|
|
|
|
$fileName = "线下打款导入模板";
|
|
|
|
ob_end_clean();//清除缓冲区,避免乱码
|
|
header('pragma:public');
|
|
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
|
|
header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
|
|
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
|
$objWriter->save('php://output');
|
|
exit;
|
|
}
|
|
|
|
}
|