优化订单日期内多个推广员无法补链

master
chenzhi 5 years ago
parent 60c7bdce34
commit 9df450f8cc

@ -119,7 +119,9 @@ class MendController extends ThinkController {
if(self::checkSettlement(strtotime($_POST['order_time']),$_POST['promote_id'])){ if(self::checkSettlement(strtotime($_POST['order_time']),$_POST['promote_id'])){
$this->error('在订单日期内含有已经结算的订单,无法补链'); $this->error('在订单日期内含有已经结算的订单,无法补链');
} }
if(self::checkPromote(strtotime($_POST['order_time']),$_POST['account'])){
$this->error('在订单日期内含有多个推广员,无法补链');
}
$create = $_REQUEST; $create = $_REQUEST;
$create['order_time'] = date($create['order_time']); $create['order_time'] = date($create['order_time']);
@ -156,28 +158,33 @@ class MendController extends ThinkController {
$this->display(); $this->display();
} }
} }
private function checkSettlement($order_time,$prmoote_id) private function checkSettlement($order_time,$prmote_id)
{ {
//判断是否已经结算 //判断是否已经结算,后台只会对会长进行结算
//获取会长信息 //获取会长信息
$Promote = M('promote','tab_'); $Promote = M('promote','tab_');
$prmootedata = $Promote->field('chain')->find($prmoote_id); $prmotedata = $Promote->field('chain')->find($prmote_id);
$chain = trim($prmootedata['chain'], '/'); $chain = trim($prmotedata['chain'], '/');
if ($chain == '') { if ($chain == '') {
$prmoote_id = 0; $prmote_id = $prmote_id;
} else { } else {
$prmoote_id = explode('/', $chain)[0]; $prmote_id = explode('/', $chain)[0];
} }
$jsres = M("Settlement","tab_")->where(array( $jsres = M("Settlement","tab_")->where(array(
"total_money"=>array("GT",0), "total_money"=>array("GT",0),
"starttime"=>array("ELT",$order_time), "starttime"=>array("ELT",$order_time),
"endtime"=>array("EGT",$order_time), "endtime"=>array("EGT",$order_time),
"promote_id"=>$prmoote_id "promote_id"=>$prmote_id
))->find(); ))->find();
if($jsres) return true; if($jsres) return true;
return false; return false;
}
# code... //判断是否跨推广员进行补链
private function checkPromote($order_time,$account)
{
$res = M("Spend","tab_")->field("promote_id")->where(["pay_time"=>array("EGT",$order_time),"user_account"=>$account])->group("promote_id")->select();
if(count($res)>0) return true;
return false;
} }
//补链详情 //补链详情
public function shiftInfo() public function shiftInfo()

Loading…
Cancel
Save