优化:使用邀请码时 如果不能绑定关系链 则无法使用
This commit is contained in:
parent
cc6342b150
commit
69969962e0
|
|
@ -953,7 +953,10 @@ class UserRepository extends BaseRepository
|
|||
Queue::push(UserBrokerageLevelJob::class, ['uid' => $spreadUid, 'type' => 'spread_user', 'inc' => 1]);
|
||||
app()->make(UserBrokerageRepository::class)->incMemberValue($user->uid, 'member_share_num', 0);
|
||||
event('user.spread', compact('user','spreadUid'));
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function userPosition($key, $uid)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
namespace app\controller\api\user;
|
||||
|
||||
use app\common\dao\store\coupon\StoreCouponProductDao;
|
||||
use app\common\model\user\UserBrokerageApplyFormal;
|
||||
use app\common\model\user\UserInviteCode;
|
||||
use app\common\model\user\UserOrder;
|
||||
use app\common\model\user\UserVipExchangeCode;
|
||||
|
|
@ -346,7 +347,12 @@ class Svip extends BaseController
|
|||
'status' => 2
|
||||
]);
|
||||
// 绑定上下级关系
|
||||
app()->make(UserRepository::class)->bindSpread($user, intval($exchangeCodeInfo['activate_uid']));
|
||||
$formalStatus = (int)UserBrokerageApplyFormal::where('uid', (int)$exchangeCodeInfo['activate_uid'])->value('status');
|
||||
if($formalStatus != 1) throw new ValidateException('邀请人身份无效!');
|
||||
if((int)$exchangeCodeInfo['activate_uid'] == (int)$uid) throw new ValidateException('邀请人和使用者不能是同一人!');
|
||||
|
||||
$bindRes = app()->make(UserRepository::class)->bindSpread($user, (int)$exchangeCodeInfo['activate_uid']);
|
||||
if(!$bindRes) throw new ValidateException('领取失败,关系链错误!');
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue