quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
 
namespace app\operations\model\plus\team;
 
use app\common\model\plus\team\Referee as RefereeModel;
 
/**
 * 队长用户模型
 */
class Referee extends RefereeModel
{
    /**
     * 获取指定用户的推荐人列表
     */
    public static function getRefereeList($userId)
    {
        return (new static)->with(['team1'])->where('user_id', '=', $userId)->select();
    }
 
    /**
     * 清空下级成员推荐关系
     */
    public function onClearTeam($team_id, $level = -1)
    {
        $model = $this;
        if($level > -1){
            $model = $model->where('level', '=', $level);
        }
        return $model->where('heads_id', '=', $team_id)->save(['heads_id' => 0]);
    }
    
}