Merge branch 'hotfix2/shift_promote' of wmtx/platform into release

优化换绑
master
廖金灵 4 years ago committed by Gogs
commit 83e6164654

@ -118,7 +118,6 @@ class MendController extends ThinkController {
public function edit($id = null)
{
if (IS_POST) {
$promoteService = new PromoteService();
if ($_POST['prmoote_id_to'] == -1){
@ -178,15 +177,19 @@ class MendController extends ThinkController {
$this->error($res['msg']);
}
} else {
$user = A('User', 'Event');
$user_data = $user->user_entity($id);
$user_data || $this->error("用户数据异常");
// echo 1;die();
$map['id'] = $id;
$data = M("user","tab_")->where($map)->find();
// $user = A('User', 'Event');
// $user_data = $user->user_entity($id);
// $user_data || $this->error("用户数据异常");
// var_dump($user_data);die;
$this->assign("data", $user_data);
$this->assign("data", $data);
$this->meta_title = '编辑推广补链';
$this->m_title = '推广补链';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find());
$this->m_title = '推广补链';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find());
$this->display();
@ -200,42 +203,49 @@ class MendController extends ThinkController {
$map = array(
"pay_status"=>1,
"user_account"=>$account,
"pay_time"=>array("EGT",$order_time)
"payed_time"=>array("EGT",$order_time)
);
$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();
//获取结算方式
$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')
->where("a.account = '{$account}'")
->find();
$dsh_list = false;
if(!empty($withspendlist)){
//获取所有涉及订单
foreach ($withspendlist as $value) {
$dsh_list .= (','.$value['spend_ids']);
}
if(empty($c_id) || $c_id['company_id'] == 0){
//官方渠道不结算,可换绑
return false;
}
if($dsh_list){
$dsh_list = array_flip(explode(",",$dsh_list));
$c_id = $c_id['company_id'];
$r = M("CompanyRelation","tab_")->where("(first_company_type = 2 AND first_company_id = '{$c_id}') OR (second_company_type = 2 AND second_company_id = '{$c_id}')")->find();
if(empty($r) || $r['settlement_type'] == 0){
//不结算的公司允许换绑
return false;
}
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; //有待审核的
}
$checktime = 0;
if($r['settlement_type'] == 1){
//周结
$sdefaultDate = date("Y-m-d");
$first=1;
$w=date('w',strtotime($sdefaultDate));
$checktime=strtotime("$sdefaultDate -".($w ? $w - $first : 6).' days'); //本周开始时间
}else{
//月结
$y = date("Y", time()); //年
$m = date("m", time()); //月
$checktime = mktime(0, 0, 0, $m, 1, $y); // 本月开始时间
}
return false;
if($order_time >= $checktime){
//未在结算期内,允许换绑
return false;
}
//其他情况不允许换绑
return true;
}
/**

Loading…
Cancel
Save