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