diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index 7a669350a..6b4bf9ca6 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -136,8 +136,12 @@ class MendController extends ThinkController { // if(self::checkSettlement(strtotime($_POST['order_time']),$_POST['promote_id'])){ // $this->error('在订单日期内含有已经结算的订单,无法补链'); // } - if(self::checkSpend(strtotime($_POST['order_time']),$_POST['account'])){ - $this->error("在订单日期内含有已经结算的订单,无法补链。"); + + // if(self::checkSpend(strtotime($_POST['order_time']),$_POST['account'])){ + // $this->error("在订单日期内含有已经结算的订单,无法补链。"); + // } + if(self::checkOrderTime(strtotime($_POST['order_time']))){ + $this->error('仅能补链本周数据,请重新选择补链时间'); } if(self::checkPromote(strtotime($_POST['order_time']),$_POST['account'])){ $this->error('在订单日期内含有多个推广员,无法补链'); @@ -195,6 +199,17 @@ class MendController extends ThinkController { $this->display(); } } + private function checkOrderTime($order_time){ + $sdefaultDate = date("Y-m-d"); + $first=1;//周一开始 + $w=date('w',strtotime($sdefaultDate)); + $checktime=strtotime("$sdefaultDate -".($w ? $w - $first : 6).' days'); //本周开始时间 + if($order_time >= $checktime){ + //在本周允许换绑 + return false; + } + return true; + } /** * 2020.1.3 之后判断订单是否已经结算 */ @@ -207,10 +222,11 @@ class MendController extends ThinkController { ); $spendlist = M("Spend","tab_")->field("id,selle_status,pay_order_number")->where($map)->select(); if(count($spendlist) < 1){ + //无流水可换绑 return false; } //获取结算方式 - $c_id = M("User","tab_") + $c_id = M("User","tab_") ->alias('a') ->field("IFNULL(p.company_id,0) company_id") ->join('tab_promote p ON a.promote_id= p.id') @@ -246,6 +262,7 @@ class MendController extends ThinkController { } //其他情况不允许换绑 return true; + } /**