|
@@ -139,6 +139,10 @@ class User extends Api
|
|
}
|
|
}
|
|
$user_id = $this->auth->id;
|
|
$user_id = $this->auth->id;
|
|
|
|
|
|
|
|
+ if(!empty($this->auth->pre_userid)){
|
|
|
|
+ $this->error('您已经填写过邀请人');
|
|
|
|
+ }
|
|
|
|
+
|
|
// 查询邀请码用户信息
|
|
// 查询邀请码用户信息
|
|
$inviteUserInfo = \app\common\model\User::where(["invite_no" => $invite_no])->find();
|
|
$inviteUserInfo = \app\common\model\User::where(["invite_no" => $invite_no])->find();
|
|
if (!$inviteUserInfo) {
|
|
if (!$inviteUserInfo) {
|
|
@@ -149,7 +153,9 @@ class User extends Api
|
|
throw new Exception('对方已被您邀请过');
|
|
throw new Exception('对方已被您邀请过');
|
|
}
|
|
}
|
|
if ($inviteUserInfo->id == $user_id) $this->error("不能邀请自己哦!");
|
|
if ($inviteUserInfo->id == $user_id) $this->error("不能邀请自己哦!");
|
|
- if ($inviteUserInfo->is_auth != 2) $this->error("该邀请码用户尚未完成实名认证");
|
|
|
|
|
|
+ //if ($inviteUserInfo->is_auth != 2) $this->error("该邀请码用户尚未完成实名认证");
|
|
|
|
+
|
|
|
|
+ //邀请奖励
|
|
|
|
|
|
$res = \app\common\model\User::update(["pre_userid" => $inviteUserInfo->id], ["id" => $user_id]);
|
|
$res = \app\common\model\User::update(["pre_userid" => $inviteUserInfo->id], ["id" => $user_id]);
|
|
if ($res) {
|
|
if ($res) {
|
|
@@ -202,30 +208,7 @@ class User extends Api
|
|
$data[$field] = $newone;
|
|
$data[$field] = $newone;
|
|
}
|
|
}
|
|
|
|
|
|
- if(isset($data['invite_no']) && !empty($data['invite_no'])){
|
|
|
|
- $intro_user = Db::name('user')->where('invite_no',$data['invite_no'])->value('id');
|
|
|
|
- if(!$intro_user){
|
|
|
|
- $this->error('不存在的邀请人');
|
|
|
|
- }
|
|
|
|
- if(!empty($this->auth->pre_userid)){
|
|
|
|
- $this->error('您已经填写过邀请人');
|
|
|
|
- }
|
|
|
|
- unset($data['invite_no']);//别人的邀请码,不能改了自己的
|
|
|
|
- $data['pre_userid'] = $intro_user;
|
|
|
|
-
|
|
|
|
- //邀请用户注册,给邀请人奖励
|
|
|
|
- if(isset($data['pre_userid']) && !empty($data['pre_userid'])){
|
|
|
|
- /*$intro_gold = config('site.intro_newuser_gift_goldnum') ?: 0;
|
|
|
|
- if($intro_gold > 0){
|
|
|
|
- $wallet_rs = model('wallet')->lockChangeAccountRemain();
|
|
|
|
- if($wallet_rs['status'] === false){
|
|
|
|
- Db::rollback();
|
|
|
|
- $this->setError($wallet_rs['msg']);
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- }*/
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
if(empty($data)){
|
|
if(empty($data)){
|
|
$this->error('没有任何改变');
|
|
$this->error('没有任何改变');
|
|
}
|
|
}
|