|
|
|
@ -9,7 +9,7 @@ use Base\Service\PromoteService as PromoteService;
|
|
|
|
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
|
|
|
|
*/
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|