admin/app/common/model/plus/agent/User.php
@@ -8,7 +8,8 @@
use app\common\model\plus\team\Apply as TeamApplyModel;
use app\common\model\plus\shareholder\Apply as ShareholderApplyModel;
use app\common\model\plus\agent\Grade as AgentGradeModel;
use app\common\model\branch\ActivityUser as ActivityUserModel;
use app\common\model\plus\agent\Referee as refereeModel;
/**
 * 分销商用户模型
 */
@@ -76,6 +77,17 @@
            'app_id' => $model::$app_id,
            'grade_id' => AgentGradeModel::getDefaultGradeId()
        ], $data));
        $user=(new \app\common\model\user\User())->find($user_id);
        if ($user){
            $user_ids=(new ActivityUserModel)->where(['recommend_name'=>$user['real_name'],'recommend_mobile'=>$user['mobile']])->column('user_id');
            if ($user_ids){
                foreach ($user_id as $value)
                {
                    (new \app\common\model\user\User())->where(['user_id'=>$value])->update(['referee_id'=>$user_id])
                    (new refereeModel())->createRelation($value,$user_id);
                }
            }
        }
        event('AgentUserGrade', $model['referee_id']);
        return true;
    }