优化打款

master
chenzhi 3 years ago
parent 903e98e3cf
commit 38151288a0

@ -7,7 +7,6 @@ namespace Payment\Controller;
class WxPaymentController extends BaseController
{
public $PayStatus=[
"-2"=>"信息配置不全",
"-1"=>"打款失败",
"0"=>"未打款",
"1"=>"打款成功"
@ -144,61 +143,37 @@ class WxPaymentController extends BaseController
$this->viewPool($ids);
return ;
}
$CompanyInfo = M("excel_statement_info","tab_")
->alias('i')
->field("i.*")
$data = M("wx_payment","tab_")
->field("*")
->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; }
foreach($data as $k=>&$v){
$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();
$money = M("wx_payment","tab_")->field( $field)->where($map)->find();
$count = M("excel_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
$count = M("wx_payment","tab_")->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("data",$data);
$this->assign("money",$money);
$this->assign("CompanyType", $this->CompanyType);
$this->assign("PayStatus", $this->PayStatus);
$this->display();
}
@ -226,6 +201,7 @@ class WxPaymentController extends BaseController
$this->ajaxReturn(["status"=>0,"msg"=>"真实姓名,openid,打款金额均不允许为空"]);
}
$v['batch_num'] = $batch;
$v['create_time'] = time();
$res = $wxPayment->add($v);
if($res === false){
$wxPayment->where("batch_num = '{$v['batch_num']}'")->delete();

Loading…
Cancel
Save