diff --git a/Application/Home/Controller/WithdrawController.class.php b/Application/Home/Controller/WithdrawController.class.php index 1c78b1a17..30a300ca2 100644 --- a/Application/Home/Controller/WithdrawController.class.php +++ b/Application/Home/Controller/WithdrawController.class.php @@ -37,6 +37,7 @@ class WithdrawController extends BaseController $map["promote.id"] = get_pid(); $map['tab_company_statement_info.company_type'] = ['in',"1,2"]; + $map['tab_company_statement_info.verify_status'] = 1; if ($_REQUEST['pay_status'] || $_REQUEST['pay_status'] == '0') { $map['pay_status'] = $_REQUEST['pay_status']; @@ -140,12 +141,18 @@ class WithdrawController extends BaseController $savedata["pay_time"]=time(); } else { - $this->poolCount($dbres['pool_id']); + // $this->poolCount($dbres['pool_id']); $this->ajaxReturn(["msg"=>"已经打款过","data"=>$dbres,"status"=>0]); } - $this->poolCount($dbres['pool_id']); + M("company_statement_info","tab_")->save($savedata); - $this->ajaxReturn(["msg"=>"打款成功","data"=>$dbres,"status"=>1]); + // $this->poolCount($dbres['pool_id']); + + if ($savedata["pay_status"] == -1) { + $this->ajaxReturn(["msg"=>"提现失败","data"=>$dbres,"status"=>0]); + } + + $this->ajaxReturn(["msg"=>"提现成功","data"=>$dbres,"status"=>1]); } /** @@ -153,13 +160,14 @@ class WithdrawController extends BaseController * 整合数据,全部成功则支付成功,否则为支付中 */ public function poolCount($poolid){ - $f = M("company_statement_info","tab_")->where("pool_id = {$poolid} AND pay_status <> 1")->find(); - if(empty($f)){ - //全部完成 - $this->setOneVerifyStatus(4,"payment",$poolid); - }else{ + $f = M("company_statement_info","tab_")->field("id")->where("pool_id = {$poolid} AND pay_status <> 1")->find(); + + if(isset($f['id'])){ //打款中 $this->setOneVerifyStatus(3,"payment",$poolid); + }else{ + //全部完成 + $this->setOneVerifyStatus(4,"payment",$poolid); } } protected function setOneVerifyStatus($change_status,$op_pre,$id) diff --git a/Application/Home/View/default/Withdraw/index.html b/Application/Home/View/default/Withdraw/index.html index a00a87bde..27ce2abd7 100644 --- a/Application/Home/View/default/Withdraw/index.html +++ b/Application/Home/View/default/Withdraw/index.html @@ -326,14 +326,13 @@ dataType: "json", data: { id:id }, success: function (result) { - if (result.status == 0) { + poolCount(result.data.pool_id,function(){ layer.msg(result.msg); - } else { - layer.msg('提现成功~'); setTimeout(function () { location.reload(); }, 1000); - } + }); + }, error: function () { @@ -343,6 +342,23 @@ }); + function poolCount(pool_id,callback) { + + $.ajax({ + async: false, + url: "{:U('poolCount')}", + type: "POST", + dataType: "json", + data: { poolid:pool_id }, + success: function (result) { + callback(); + }, + error: function () { + } + }); + + } + $('.i_cancel').click(function () { location.reload(); });