| | |
| | | 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; |
| | | /** |
| | | * 分销商用户模型 |
| | | */ |
| | |
| | | '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; |
| | | } |
| | |
| | | // 团队分红添加队长 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']); |