|
|
|
@ -72,7 +72,7 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$map['i.pay_status'] = $_REQUEST['pay_status'];
|
|
|
|
|
}
|
|
|
|
|
if(isset($_REQUEST['batch_num'])){
|
|
|
|
|
$map['i.batch_num'] = $_REQUEST['batch_num'];
|
|
|
|
|
$map['i.batch_num'] = ["LIKE","%{$_REQUEST['batch_num']}%"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$CompanyInfo = M("excel_statement_info","tab_")
|
|
|
|
@ -89,26 +89,30 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
|
|
|
|
|
$v['company_type'] = $this->CompanyType[$v['company_type']];
|
|
|
|
|
$v["pay_status_str"] = $this->PayStatus[$v['pay_status']];
|
|
|
|
|
$v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
|
|
|
|
|
$v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
|
|
|
|
|
$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']);
|
|
|
|
|
}
|
|
|
|
|
$v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
|
|
|
|
|
// $v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//统计待打款金额
|
|
|
|
|
$countmap = $map;
|
|
|
|
|
$countmap['pay_status']=["neq",1];
|
|
|
|
|
$money = M("excel_statement_info","tab_")->alias('i')->field("sum(statement_money) statement_money")->where($countmap)->find();
|
|
|
|
|
$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($count['count'], $row);
|
|
|
|
|
$page = set_pagination_all($count['count'], $row);
|
|
|
|
|
if ($page) {
|
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
|
}
|
|
|
|
|
$this->meta_title = 'EXCEL打款';
|
|
|
|
|
// echo($page);die();
|
|
|
|
|
$this->meta_title = '线下打款';
|
|
|
|
|
$this->assign("data",$CompanyInfo);
|
|
|
|
|
$this->assign("money",$money);
|
|
|
|
|
$this->assign("CompanyType", $this->CompanyType);
|
|
|
|
@ -126,8 +130,8 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
public function loopAdd()
|
|
|
|
|
{
|
|
|
|
|
$p = $_REQUEST;
|
|
|
|
|
$statement_begin_time = strtotime($p['statement_begin_time']);
|
|
|
|
|
$statement_end_time = strtotime($p['statement_end_time'])+86399;
|
|
|
|
|
// $statement_begin_time = strtotime($p['statement_begin_time']);
|
|
|
|
|
// $statement_end_time = strtotime($p['statement_end_time'])+86399;
|
|
|
|
|
$batch = $p['batch'];
|
|
|
|
|
$checkarr = $p['checkarr'];
|
|
|
|
|
//循环获取添加
|
|
|
|
@ -137,14 +141,21 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$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;
|
|
|
|
|
// $v['statement_begin_time'] = $statement_begin_time;
|
|
|
|
|
// $v['statement_end_time'] = $statement_end_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_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"=>"支付宝真实姓名及登陆账号不允许为空"]);
|
|
|
|
@ -207,12 +218,32 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
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']);
|
|
|
|
|
// $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'] = '--';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$row = 0;
|
|
|
|
|
foreach($v['statement_info'] as $ke=>&$va){
|
|
|
|
|
$va['row'] = count($va['game_list']);
|
|
|
|
@ -312,10 +343,8 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
//执行打款
|
|
|
|
|
$title = $remark;
|
|
|
|
|
$amount = $dbres['statement_money'];
|
|
|
|
|
$amount = 0.1;
|
|
|
|
|
$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){
|
|
|
|
@ -329,6 +358,12 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
|
|
|
|
|
$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);
|
|
|
|
|
$this->ajaxReturn(["success"=>"打款成功","data"=>[]]);
|
|
|
|
|