|
|
@ -7,7 +7,6 @@ namespace Payment\Controller;
|
|
|
|
class ExcelPaymentController extends BaseController
|
|
|
|
class ExcelPaymentController extends BaseController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public $PayStatus=[
|
|
|
|
public $PayStatus=[
|
|
|
|
"-2"=>"信息配置不全",
|
|
|
|
|
|
|
|
"-1"=>"打款失败",
|
|
|
|
"-1"=>"打款失败",
|
|
|
|
"0"=>"未打款",
|
|
|
|
"0"=>"未打款",
|
|
|
|
"1"=>"打款成功"
|
|
|
|
"1"=>"打款成功"
|
|
|
@ -42,7 +41,7 @@ class ExcelPaymentController extends BaseController
|
|
|
|
$row = $params['row'] ? intval($params['row']) : 10;
|
|
|
|
$row = $params['row'] ? intval($params['row']) : 10;
|
|
|
|
|
|
|
|
|
|
|
|
$map=[
|
|
|
|
$map=[
|
|
|
|
"i.verify_status"=>["in","-1,1"],
|
|
|
|
"_string"=>"1=1",
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
|
|
|
|
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
|
|
|
@ -65,48 +64,24 @@ class ExcelPaymentController extends BaseController
|
|
|
|
$map['i.pay_time'] = ['ELT', strtotime($_REQUEST['pay_time_end']) + 86399];
|
|
|
|
$map['i.pay_time'] = ['ELT', strtotime($_REQUEST['pay_time_end']) + 86399];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['company_type'])){
|
|
|
|
if(isset($_REQUEST['company_name'])){
|
|
|
|
$map['i.company_type'] = $_REQUEST['company_type'];
|
|
|
|
$map['i.company_name'] = $_REQUEST['company_name'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_REQUEST['company_id'])){
|
|
|
|
|
|
|
|
$map['i.company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['pay_status'])){
|
|
|
|
if(isset($_REQUEST['pay_status'])){
|
|
|
|
if($_REQUEST['pay_status'] == -2){
|
|
|
|
$map['i.pay_status'] = $_REQUEST['pay_status'];
|
|
|
|
$map['i.verify_status'] = -1;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$map['i.pay_status'] = $_REQUEST['pay_status'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['pay_type'])){
|
|
|
|
$CompanyInfo = M("excel_statement_info","tab_")
|
|
|
|
$map['i.pay_type'] = $_REQUEST['pay_type'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$CompanyInfo = M("company_statement_info","tab_")
|
|
|
|
|
|
|
|
->alias('i')
|
|
|
|
->alias('i')
|
|
|
|
->field("i.*,p.statement_num statement_pool_num")
|
|
|
|
->field("i.*")
|
|
|
|
->join("tab_company_statement_pool p ON p.id = i.pool_id")
|
|
|
|
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->order("FIELD(pay_status,0,-1,1),verify_status desc")
|
|
|
|
->page($page,$row)
|
|
|
|
|
|
|
|
->order("FIELD(pay_status,0,-1,1)")
|
|
|
|
->select();
|
|
|
|
->select();
|
|
|
|
foreach($CompanyInfo as $k=>&$v){
|
|
|
|
foreach($CompanyInfo as $k=>&$v){
|
|
|
|
$v['can_pay'] = 1;
|
|
|
|
|
|
|
|
if($v['verify_status'] == -1){
|
|
|
|
|
|
|
|
$v['verify_status_str']="信息配置不全";
|
|
|
|
|
|
|
|
$v['can_pay'] = 0;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
if($v['pay_status'] == 1){ $v['can_pay'] = 0; }
|
|
|
|
|
|
|
|
$v['verify_status_str'] = $this->PayStatus[$v['pay_status']];
|
|
|
|
|
|
|
|
if($v['pay_status'] == 1){
|
|
|
|
|
|
|
|
$v['pay_type'] = $v['pay_type'] == 1 ? "提现" :"线上打款";
|
|
|
|
|
|
|
|
$v['verify_status_str'] .= ("/". $v['pay_type']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$v['company_type'] = $this->CompanyType[$v['company_type']];
|
|
|
|
$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_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
|
|
|
|
$v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
|
|
|
|
$v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
|
|
|
|
if(empty($v['pay_time'])){
|
|
|
|
if(empty($v['pay_time'])){
|
|
|
@ -116,13 +91,12 @@ class ExcelPaymentController extends BaseController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
|
|
|
|
$v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//统计待打款金额
|
|
|
|
//统计待打款金额
|
|
|
|
$countmap = $map;
|
|
|
|
$countmap = $map;
|
|
|
|
$countmap['pay_status']=["neq",1];
|
|
|
|
$countmap['pay_status']=["neq",1];
|
|
|
|
$money = M("company_statement_info","tab_")->alias('i')->field("sum(statement_money) statement_money")->where($countmap)->find();
|
|
|
|
$money = M("excel_statement_info","tab_")->alias('i')->field("sum(statement_money) statement_money")->where($countmap)->find();
|
|
|
|
|
|
|
|
$count = M("excel_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
|
|
|
|
|
|
|
|
|
|
|
|
$count = M("company_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
|
|
|
|
|
|
|
|
// dd($count);
|
|
|
|
// dd($count);
|
|
|
|
$parameter['p'] = $page;
|
|
|
|
$parameter['p'] = $page;
|
|
|
|
$parameter['row'] = $row;
|
|
|
|
$parameter['row'] = $row;
|
|
|
@ -130,7 +104,7 @@ class ExcelPaymentController extends BaseController
|
|
|
|
if ($page) {
|
|
|
|
if ($page) {
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->meta_title = '打款结算单';
|
|
|
|
$this->meta_title = 'EXCEL打款';
|
|
|
|
$this->assign("data",$CompanyInfo);
|
|
|
|
$this->assign("data",$CompanyInfo);
|
|
|
|
$this->assign("money",$money);
|
|
|
|
$this->assign("money",$money);
|
|
|
|
$this->assign("CompanyType", $this->CompanyType);
|
|
|
|
$this->assign("CompanyType", $this->CompanyType);
|
|
|
@ -163,6 +137,11 @@ class ExcelPaymentController extends BaseController
|
|
|
|
$v['company_type'] = 2;
|
|
|
|
$v['company_type'] = 2;
|
|
|
|
$v['create_time'] = time();
|
|
|
|
$v['create_time'] = time();
|
|
|
|
$v['statement_num'] = "JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5);
|
|
|
|
$v['statement_num'] = "JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5);
|
|
|
|
|
|
|
|
if(!isset($v['company_info']['ali_user']) || !isset($v['company_info']['ali_account']) || $v['company_info']['ali_user'] == '' || $v['company_info']['ali_account'] == ''){
|
|
|
|
|
|
|
|
M('ExcelStatementInfo')->where("statement_num = '{$v['statement_num']}'")->delete();
|
|
|
|
|
|
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$res = $ExcelStatementInfo->add($v);
|
|
|
|
$res = $ExcelStatementInfo->add($v);
|
|
|
|
if($res === false){
|
|
|
|
if($res === false){
|
|
|
|
M('ExcelStatementInfo')->where("statement_num = '{$v['statement_num']}'")->delete();
|
|
|
|
M('ExcelStatementInfo')->where("statement_num = '{$v['statement_num']}'")->delete();
|
|
|
|