...
|
...
|
@@ -250,16 +250,20 @@ class Person extends Api |
|
|
*/
|
|
|
public function getScore($share_uid,$type){
|
|
|
$score = config('site.'.$type);
|
|
|
//给分享用户增加积分
|
|
|
$userModel = new \app\admin\model\User();
|
|
|
$user = $userModel->where(['id'=>$share_uid,'status'=>'normal'])->setInc('score', $score);
|
|
|
//成为分享用户的下线
|
|
|
|
|
|
$offlineModel = new Line();
|
|
|
$off = $offlineModel->create(['uid'=>$share_uid,'s_score'=>$score,'off_uid'=>$this->user_id]);
|
|
|
if($user && $off){
|
|
|
return true;
|
|
|
//此处判断不能相互成为下线(你成为我的下线,我就不能成为你的下线)
|
|
|
$offlineModel->where(['off_uid'=>$share_uid,'uid'=>$this->user_id])->find();
|
|
|
//分享人是自己无效
|
|
|
if($share_uid != $this->user_id){
|
|
|
if(!$offlineModel){
|
|
|
//给分享用户增加积分
|
|
|
$userModel = new \app\admin\model\User();
|
|
|
$userModel->where(['id'=>$share_uid,'status'=>'normal'])->setInc('score', $score);
|
|
|
//成为分享用户的下线
|
|
|
$offlineModel->create(['uid'=>$share_uid,'s_score'=>$score,'off_uid'=>$this->user_id]);
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|