|
@@ -119,6 +119,12 @@ class Applet extends Base
|
|
|
{
|
|
|
$uid = $this->check();
|
|
|
$vid = Dever::input('vid');
|
|
|
+ if (!$vid) {
|
|
|
+ $mobile = Dever::input('mobile');
|
|
|
+ if (!$mobile) {
|
|
|
+ Dever::alert('无效的用户id,请重新登录');
|
|
|
+ }
|
|
|
+ }
|
|
|
$result = array();
|
|
|
$mobile = $phoneNumber = '';
|
|
|
|
|
@@ -140,7 +146,7 @@ class Applet extends Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if ($mobile && $phoneNumber && $uid) {
|
|
|
+ if ($mobile && $uid) {
|
|
|
$uid = $this->combine($uid, $mobile, 'mobile');
|
|
|
|
|
|
$info = Dever::load('passport/user-one', $uid);
|
|
@@ -164,15 +170,7 @@ class Applet extends Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $result['vid'] = $vid;
|
|
|
- $result['uid'] = $uid;
|
|
|
- $result['signature'] = Dever::login($uid);
|
|
|
-
|
|
|
- //$result = $this->getSign($uid, $vid);
|
|
|
-
|
|
|
- if (isset($update['mobile']) && $update['mobile']) {
|
|
|
- $result['mobile'] = $update['mobile'];
|
|
|
- }
|
|
|
+ $result = $this->getSign($uid, $vid, $mobile);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
@@ -186,6 +184,7 @@ class Applet extends Base
|
|
|
{
|
|
|
$uid = false;
|
|
|
$data['system'] = Dever::input('system', 1);
|
|
|
+ $system_source = Dever::input('system_source', 5);
|
|
|
$info = Dever::db('passport/wechat')->one(array('openid' => $data['openid']));
|
|
|
|
|
|
$wechat = array();
|
|
@@ -202,7 +201,7 @@ class Applet extends Base
|
|
|
$wechat['unionid'] = $data['unionid'];
|
|
|
}
|
|
|
if (!$uid) {
|
|
|
- $uid = $this->reg('applet', $data);
|
|
|
+ $uid = $this->reg('applet', $system_source, $data);
|
|
|
if ($state) {
|
|
|
Dever::score($info['id'], 'bind_wechat', '用户微信授权');
|
|
|
}
|
|
@@ -213,7 +212,7 @@ class Applet extends Base
|
|
|
$wechat['uid'] = $uid;
|
|
|
# 微信小程序
|
|
|
$wechat['type'] = 1;//即将废弃,统一
|
|
|
- $wechat['system_source'] = 5;
|
|
|
+ $wechat['system_source'] = $system_source;
|
|
|
$wechat['system_id'] = $data['system'];
|
|
|
$id = Dever::db('passport/wechat')->insert($wechat);
|
|
|
|
|
@@ -338,12 +337,12 @@ class Applet extends Base
|
|
|
$project = false;
|
|
|
$system = Dever::input('system', 1);
|
|
|
if (Dever::project('token')) {
|
|
|
- $project = Dever::db('token/project')->one($system);
|
|
|
+ $project = Dever::db('token/project')->find($system);
|
|
|
}
|
|
|
|
|
|
if (!$project) {
|
|
|
if (isset($applet['project']) && $applet['project']) {
|
|
|
- $project = Dever::db($applet['project'])->one($system);
|
|
|
+ $project = Dever::db($applet['project'])->find($system);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -381,12 +380,14 @@ class Applet extends Base
|
|
|
|
|
|
$data = Dever::curl($url);
|
|
|
Dever::log($data, 'passport_applet');
|
|
|
+
|
|
|
+ //YzJkOThpRFhwZ1lQTF9mZl9hLVZjZnFXemJVenlYcDQ3d3JWekk0b1I4NjBBQ0Naejg4a0VQa0U=
|
|
|
+ //$data = '{"session_key":"aNAXk7nG\/DRYI\/G0KzJRsw==","openid":"oIZ895RZs2ZkywasoZIv6WavPZlQ"}';
|
|
|
+
|
|
|
if (strstr($data, 'errcode')) {
|
|
|
Dever::alert($data);
|
|
|
}
|
|
|
|
|
|
- //YzJkOThpRFhwZ1lQTF9mZl9hLVZjZnFXemJVenlYcDQ3d3JWekk0b1I4NjBBQ0Naejg4a0VQa0U=
|
|
|
- //$data = '{"session_key":"aNAXk7nG\/DRYI\/G0KzJRsw==","openid":"oIZ895RZs2ZkywasoZIv6WavPZlQ"}';
|
|
|
$data = Dever::json_decode($data);
|
|
|
|
|
|
return $data;
|