|
@@ -38,6 +38,7 @@ class Client extends Base
|
|
|
$this->initSave();
|
|
|
$this->initRequest();
|
|
|
$this->initAccount();
|
|
|
+ $this->initSource();
|
|
|
$this->initRefer();
|
|
|
$this->initConfig();
|
|
|
}
|
|
@@ -58,6 +59,12 @@ class Client extends Base
|
|
|
$this->session->add('oauth_account', $this->account);
|
|
|
}
|
|
|
|
|
|
+ private function initSource()
|
|
|
+ {
|
|
|
+ $this->source = (isset($this->request['source']) && $this->request['source']) ? $this->request['source'] : $this->session->get('oauth_source');
|
|
|
+ $this->session->add('oauth_source', $this->source);
|
|
|
+ }
|
|
|
+
|
|
|
private function initRefer()
|
|
|
{
|
|
|
$this->refer = (isset($this->request['refer']) && $this->request['refer']) ? $this->request['refer'] : $this->session->get('oauth_refer');
|
|
@@ -191,15 +198,13 @@ class Client extends Base
|
|
|
|
|
|
$id = false;
|
|
|
|
|
|
- if(isset($get['id']) && $get['id'] > 0)
|
|
|
- {
|
|
|
+ if (isset($get['id']) && $get['id'] > 0) {
|
|
|
$id = $get['id'];
|
|
|
}
|
|
|
|
|
|
$this->update($data, $id);
|
|
|
|
|
|
- if($this->refer)
|
|
|
- {
|
|
|
+ if ($this->refer) {
|
|
|
$refer = urldecode($this->refer);
|
|
|
Dever::location($refer);
|
|
|
}
|
|
@@ -220,8 +225,8 @@ class Client extends Base
|
|
|
if (!$userinfo) {
|
|
|
return;
|
|
|
}
|
|
|
- $user['source_type'] = 'service';
|
|
|
- $user['bind'] = 1;
|
|
|
+
|
|
|
+
|
|
|
$user['temp'] = 2;
|
|
|
$user['username'] = Dever::emoji($userinfo['nickname']);
|
|
|
if ($userinfo['headimgurl']) {
|
|
@@ -256,6 +261,7 @@ class Client extends Base
|
|
|
$wechat['unionid'] = $data['unionid'];
|
|
|
}
|
|
|
if (!$uid) {
|
|
|
+ $user['source_type'] = 'service';
|
|
|
$uid = Dever::load('passport/user-insert', $user);
|
|
|
} else {
|
|
|
$user['where_id'] = $uid;
|
|
@@ -270,6 +276,10 @@ class Client extends Base
|
|
|
$wechat['uid'] = $uid;
|
|
|
$wechat['type'] = 2;
|
|
|
$id = Dever::load('passport/wechat-insert', $wechat);
|
|
|
+
|
|
|
+ if (Dever::project('source') && isset($this->source) && $this->source && $this->source > 0) {
|
|
|
+ Dever::load('source/lib/core')->saveUser($id, $uid, $this->source, 'oauth', $this->account);
|
|
|
+ }
|
|
|
} else {
|
|
|
$uid = $info['uid'];
|
|
|
if (isset($data['unionid']) && $data['unionid']) {
|