From 216321f46b897672ee97d10fe54b9c168a7906e2 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 7 Jan 2020 11:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8D=A2=E7=BB=91=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=9C=A8=E5=AE=A1=E6=A0=B8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/MendController.class.php | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index 034ad96ed..25dd2846d 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -9,7 +9,7 @@ use Base\Service\PromoteService as PromoteService; * @author 麦当苗儿 */ class MendController extends ThinkController { - + public $tempid = 0; public function lists($p=1){ $this->m_title = '推广补链'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find()); @@ -124,7 +124,7 @@ class MendController extends ThinkController { // $this->error('在订单日期内含有已经结算的订单,无法补链'); // } if(self::checkSpend(strtotime($_POST['order_time']),$_POST['account'])){ - $this->error('在订单日期内含有已经结算的订单,无法补链'); + $this->error("在订单日期内含有已经结算的订单,无法补链。如订单:{$this->tempid}"); } if(self::checkPromote(strtotime($_POST['order_time']),$_POST['account'])){ $this->error('在订单日期内含有多个推广员,无法补链'); @@ -169,14 +169,45 @@ class MendController extends ThinkController { * 2020.1.3 之后判断订单是否已经结算 */ private function checkSpend($order_time,$account){ + //获取所有涉及订单 $map = array( "pay_status"=>1, "user_account"=>$account, - "pay_time"=>array("EGT",$order_time), - "selle_status"=>1 + "pay_time"=>array("EGT",$order_time) ); - $flag = M("Spend","tab_")->where($map)->count(); - if($flag > 0) return true; + $spendlist = M("Spend","tab_")->field("id,selle_status,pay_order_number")->where($map)->select(); + if(count($spendlist) < 1){ + return false; + } + //获取所有未审核 + $withmap = array( + "status"=>0, + "settlement_begin_time"=>array("EGT",$order_time), + "settlement_end_time"=>array("ELT",$order_time) + ); + $withspendlist = M("withdraw","tab_")->field("spend_ids")->select(); + + $dsh_list = false; + if(!empty($withspendlist)){ + //获取所有涉及订单 + foreach ($withspendlist as $value) { + $dsh_list .= (','.$value['spend_ids']); + } + } + if($dsh_list){ + $dsh_list = array_flip(explode(",",$dsh_list)); + } + foreach($spendlist as $k=>$v){ + + if($v['selle_status'] == 1){ + $this->tempid = $v['pay_order_number']; + return true; //有已结算 + } + if($dsh_list && $dsh_list[$v['id']]){ + $this->tempid = $v['pay_order_number']; + return true; //有待审核的 + } + } return false; }