|
@@ -262,6 +262,19 @@ class Auth
|
|
|
//注册用户权限
|
|
|
Db::name('user_power')->insertGetId(['user_id'=>$user->id]);
|
|
|
|
|
|
+ //邀请用户注册,给邀请人奖励
|
|
|
+ if(isset($extend['intro_uid']) && !empty($extend['intro_uid'])){
|
|
|
+ $intro_gold = config('site.intro_newuser_gift_goldnum') ?: 0;
|
|
|
+ if($intro_gold > 0){
|
|
|
+ $wallet_rs = model('wallet')->lockChangeAccountRemain($extend['intro_uid'],'gold',$intro_gold,63,'邀请'.$this->_user->username);
|
|
|
+ if($wallet_rs['status'] === false){
|
|
|
+ $this->setError($wallet_rs['msg']);
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//注册成功的事件
|
|
|
Hook::listen("user_register_successed", $this->_user, $data);
|
|
|
Db::commit();
|
|
@@ -325,6 +338,19 @@ class Auth
|
|
|
//注册用户权限
|
|
|
Db::name('user_power')->insertGetId(['user_id'=>$user->id]);
|
|
|
|
|
|
+ //邀请用户注册,给邀请人奖励
|
|
|
+ if(isset($extend['intro_uid']) && !empty($extend['intro_uid'])){
|
|
|
+ $intro_gold = config('site.intro_newuser_gift_goldnum') ?: 0;
|
|
|
+ if($intro_gold > 0){
|
|
|
+ $wallet_rs = model('wallet')->lockChangeAccountRemain($extend['intro_uid'],'gold',$intro_gold,63,'邀请'.$this->_user->username);
|
|
|
+ if($wallet_rs['status'] === false){
|
|
|
+ $this->setError($wallet_rs['msg']);
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//注册成功的事件
|
|
|
Hook::listen("user_register_successed", $this->_user, $data);
|
|
|
Db::commit();
|