|
@@ -669,7 +669,7 @@ class Auth
|
|
|
|
|
|
public function openid_register($wechat_openid = '', $extend = [])
|
|
|
{
|
|
|
- /*if ($wechat_openid && User::getByOpenid($wechat_openid)) {
|
|
|
+ if ($wechat_openid && User::getByOpenid($wechat_openid)) {
|
|
|
$this->setError('openid已存在');
|
|
|
return false;
|
|
|
}
|
|
@@ -712,17 +712,22 @@ class Auth
|
|
|
|
|
|
//设置登录状态
|
|
|
$this->_logined = true;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ //初始化权限
|
|
|
+ $userPowerWhere['user_id'] = $user->id;
|
|
|
+ $userPowerData = Db::name('user_power')->where($userPowerWhere)->find();
|
|
|
+ if (empty($userPowerData)) {
|
|
|
+ $powerData = ['user_id' => $user->id];
|
|
|
+ Db::name('user_power')->insertGetId($powerData);
|
|
|
+ }
|
|
|
//注册成功的事件
|
|
|
Hook::listen("user_register_successed", $this->_user, $data);
|
|
|
+ \app\common\model\NewBagHave::insert(["user_id" => $user->id, "createtime" => time()]);
|
|
|
Db::commit();
|
|
|
} catch (Exception $e) {
|
|
|
$this->setError($e->getMessage());
|
|
|
Db::rollback();
|
|
|
return false;
|
|
|
- }*/
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
}
|