...
|
...
|
@@ -349,21 +349,10 @@ class Person extends Api |
|
|
$score = $scoreRule['set_score'];
|
|
|
}
|
|
|
$offlineModel = new Line();
|
|
|
//此处判断分享用户否已有上线,如果有,则不能成为其他的下线
|
|
|
$each_other = $offlineModel->where(['off_uid'=>$share_uid])->select();
|
|
|
//判断本登录用户是否有上线
|
|
|
//判断本登录用户是否有上线,如果有,则不能成为其他人的下线
|
|
|
$other = $offlineModel->where(['off_uid'=>$this->user_id])->select();
|
|
|
//分享人是自己无效
|
|
|
if($share_uid != $this->user_id){
|
|
|
//分享用户有上线
|
|
|
if($each_other){
|
|
|
$on_uid = array_unique(array_column($each_other,'uid'))[0];
|
|
|
//给上线增加积分
|
|
|
$userModel = new \app\admin\model\User();
|
|
|
$userModel->where(['id'=>$on_uid,'status'=>'normal'])->setInc('score', $score);
|
|
|
//创建上线用户的积分记录
|
|
|
$offlineModel->create(['uid'=>$on_uid,'s_score'=>$score,'off_uid'=>$share_uid,'type'=>$class]);
|
|
|
}else{
|
|
|
//本登录用户没有上线
|
|
|
if(!$other){
|
|
|
//给分享用户增加积分
|
...
|
...
|
@@ -371,6 +360,16 @@ class Person extends Api |
|
|
$userModel->where(['id'=>$share_uid,'status'=>'normal'])->setInc('score', $score);
|
|
|
//成为分享用户的下线并创建积分记录
|
|
|
$offlineModel->create(['uid'=>$share_uid,'s_score'=>$score,'off_uid'=>$this->user_id,'type'=>$class]);
|
|
|
}else{
|
|
|
//本登陆用户有上线
|
|
|
$is_share = array_unique(array_column($other,'uid'))[0];
|
|
|
//判断上线是不是原有的上线用户
|
|
|
if($is_share == $share_uid){
|
|
|
//给分享用户增加积分
|
|
|
$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,'type'=>$class]);
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|