|
|
|
@ -946,9 +946,9 @@ class UserRepository extends BaseRepository |
|
|
|
|
*/ |
|
|
|
|
public function bindSpread(User $user, int $spreadUid,$is_new = false) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
if ($spreadUid && !$user->spread_uid && $user->uid != $spreadUid && ($spread = $this->dao->get($spreadUid)) && $spread->spread_uid != $user->uid && !$spread->cancel_time) { |
|
|
|
|
$config = systemConfig(['extension_limit', 'extension_limit_day', 'integral_user_give']); |
|
|
|
|
$config = systemConfig(['extension_limit', 'extension_limit_day', 'integral_user_give'])??[]; |
|
|
|
|
event('user.spread.before', compact('user', 'spreadUid')); |
|
|
|
|
Db::transaction(function () use ($spread, $spreadUid, $user, $config,$is_new) { |
|
|
|
|
if(!empty($is_new)){ |
|
|
|
@ -963,8 +963,10 @@ class UserRepository extends BaseRepository |
|
|
|
|
} |
|
|
|
|
$spread->spread_count++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!empty($is_new)){ |
|
|
|
|
if ($user->isNew) { |
|
|
|
|
|
|
|
|
|
//加到log日志 |
|
|
|
|
ValueContributionLog::getDB()->insert([ |
|
|
|
|
'type' => 2, |
|
|
|
@ -974,7 +976,7 @@ class UserRepository extends BaseRepository |
|
|
|
|
'memo' => '邀请好友获得100品宣积分', |
|
|
|
|
'user_id' => $user->spread_uid, |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$user2 = userModel::where('uid', $user->spread_uid)->find(); |
|
|
|
|
$user2->brand_integral += 100; |
|
|
|
@ -1005,6 +1007,10 @@ class UserRepository extends BaseRepository |
|
|
|
|
app()->make(UserBrokerageRepository::class)->incMemberValue($user->uid, 'member_share_num', 0); |
|
|
|
|
event('user.spread', compact('user', 'spreadUid')); |
|
|
|
|
} |
|
|
|
|
}catch (\Exception $e){ |
|
|
|
|
print_r($e->getTrace());exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function userPosition($key, $uid) |
|
|
|
|