quanwei
2025-12-13 30563323a53b0d0260c97d08a9e8bd4cc8227a95
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,20 @@
            'app_id' => $model::$app_id,
            'grade_id' => AgentGradeModel::getDefaultGradeId()
        ], $data));
        $user=(new \app\common\model\user\User())->find($user_id);
        if ($user){
            if($user['real_name']!=''&&$user['mobile']!=''){
                $user_ids=(new ActivityUserModel)->where(['recommend_name'=>$user['real_name'],'recommend_mobile'=>$user['mobile']])->column('user_id');
                if ($user_ids){
                    foreach ($user_ids 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;
    }
@@ -106,6 +121,7 @@
        // 团队分红添加队长 by yj
        $teamModel = new TeamApplyModel;
        $teamModel->becomeTeamByAgent($user_id, 50, $model['app_id']);
        $teamModel->becomeTeamByAgent($user_id, 70, $model['app_id']);
        // 股东分红添加股东 by yj
        $shareholdModel = new ShareholderApplyModel;
        $shareholdModel->becomeShareholderByAgent($user_id, 50, $model['app_id']);