...
|
...
|
@@ -382,7 +382,7 @@ class Wechat extends Api |
|
|
if(!empty($myInfo['pid'])){
|
|
|
//上级
|
|
|
try{
|
|
|
$this->getParent($myInfo['pid'],$order_info['verification_store_id'],$order_info['id']);
|
|
|
$this->getParent($myInfo['pid'],$order_info['verification_coupon_ids'],$order_info['id']);
|
|
|
}catch(\Exception $e){
|
|
|
Common::put_file_log('上级-分销异常',json_encode($e->getMessage()), 'sales_distribution', __CLASS__ . __FUNCTION__ . __LINE__);
|
|
|
}die;
|
...
|
...
|
@@ -391,7 +391,7 @@ class Wechat extends Api |
|
|
$w1['id'] = $myInfo['pid'];
|
|
|
$myInfoP = Db::name('user')->where($w1)->find();
|
|
|
if(!empty($myInfoP['pid'])){
|
|
|
$this->getParent($myInfoP['pid'],$order_info['verification_store_id'],$order_info['id']);
|
|
|
$this->getParent($myInfoP['pid'],$order_info['verification_coupon_ids'],$order_info['id']);
|
|
|
}
|
|
|
}catch(\Exception $e){
|
|
|
Common::put_file_log('上级的上级-分销异常',json_encode($e->getMessage()), 'sales_distribution', __CLASS__ . __FUNCTION__ . __LINE__);
|
...
|
...
|
@@ -400,7 +400,8 @@ class Wechat extends Api |
|
|
}
|
|
|
|
|
|
//支付后,根据用户角色 处理对应的事情
|
|
|
private function getParent($pid,$verification_store_id,$order_id){
|
|
|
private function getParent($pid,$verification_coupon_ids,$order_id){
|
|
|
|
|
|
//上级身份
|
|
|
$time = time();
|
|
|
$w1 = [];
|
...
|
...
|
@@ -412,15 +413,14 @@ class Wechat extends Api |
|
|
$this->grant_commission($pid,$order_id);
|
|
|
}else{
|
|
|
//属于普通用户 发送代金券
|
|
|
$this->send_voucher($pid,$verification_store_id,$order_id,$time);
|
|
|
$this->send_voucher($pid,$verification_coupon_ids,$order_id,$time);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//发放代金券
|
|
|
public function send_voucher($pid,$verification_store_id,$order_id,$time){
|
|
|
//发放 对应活动包含的券
|
|
|
public function send_voucher($pid,$verification_coupon_ids,$order_id,$time){
|
|
|
$w1 = [];
|
|
|
$w1['verification_store_id'] = $verification_store_id;
|
|
|
$w1['closetime'] = ['<',$time];
|
|
|
$w1['id'] = ['in',$verification_coupon_ids];
|
|
|
$coupon = Db::name('verification_coupon')->where($w1)->select();
|
|
|
if(!empty($coupon)){
|
|
|
foreach($coupon as $k=>$v){
|
...
|
...
|
@@ -534,4 +534,8 @@ class Wechat extends Api |
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|