|
@@ -25,11 +25,19 @@ class Applet extends Base
|
|
|
*/
|
|
|
public function bind()
|
|
|
{
|
|
|
- $create = Dever::input('create', 2);
|
|
|
+ $create = Dever::input('create', 3);
|
|
|
$data = $this->getLoginInfo();
|
|
|
|
|
|
if ($create == 1) {
|
|
|
- # 未授权,生成临时用户,针对有的项目,不需要授权,但是还要生成用户
|
|
|
+ # 直接返回用户信息
|
|
|
+ $info = Dever::db('passport/wechat')->one(array('openid' => $data['openid']));
|
|
|
+ $data = array();
|
|
|
+ if ($info) {
|
|
|
+ //$user = Dever::db('passport/user')->one($uid);
|
|
|
+ $data = $this->getSign($info['uid'], $info['vid']);
|
|
|
+ }
|
|
|
+ } elseif ($create == 2) {
|
|
|
+ # 未授权,会生成临时用户,针对有的项目,不需要授权,但是还要生成用户
|
|
|
$data = $this->create($data, false);
|
|
|
}
|
|
|
|
|
@@ -43,24 +51,18 @@ class Applet extends Base
|
|
|
*/
|
|
|
public function login()
|
|
|
{
|
|
|
- $data = array();
|
|
|
-
|
|
|
$data = $this->getLoginInfo();
|
|
|
|
|
|
$data += $this->getWechatData($data['session_key']);
|
|
|
|
|
|
- $data['username'] = Dever::input('username', Dever::input('nickname'));
|
|
|
- $data['avatar'] = Dever::input('avatar', Dever::input('avatarurl'));
|
|
|
- $data['sex'] = Dever::input('sex', Dever::input('gender'));
|
|
|
+ $data['username'] = Dever::input('nickname');
|
|
|
+ $data['avatar'] = Dever::input('avatarurl');
|
|
|
+ $data['sex'] = Dever::input('gender');
|
|
|
$data['city'] = Dever::input('city');
|
|
|
//$data['mobile'] = Dever::input('mobile');
|
|
|
$data['province'] = Dever::input('province');
|
|
|
$data['country'] = Dever::input('country');
|
|
|
|
|
|
- //$str = 'session_key=9qHi7e3pyeHc4cN57XTZ3A==&expires_in=7200&openid=otiUg0Q-UimEsyVJnc3mHz7K9PvQ&unionid=o-vA6wrgxnhElDR-O6XdzuGCbKLA&mobile=&phone=&username=于斌&avatar=https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83erFfFF75hv0AOZsx4p8cXJEC7icg88c5686eHic1MticOCW75icKsmdGjfEnWpmAgLibm4TwwfcJYIQ1RQ/132&sex=1&city=Chaoyang&province=Beijing&country=China';
|
|
|
-
|
|
|
- //parse_str($str, $data);
|
|
|
-
|
|
|
$result = $this->create($data);
|
|
|
|
|
|
return $result;
|
|
@@ -101,9 +103,7 @@ class Applet extends Base
|
|
|
Dever::alert('无效的用户id,请重新登录');
|
|
|
}
|
|
|
|
|
|
- $result['vid'] = $vid;
|
|
|
- $result['uid'] = $uid;
|
|
|
- $result['signature'] = Dever::login($uid);
|
|
|
+ $result = $this->getSign($uid, $vid);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
@@ -162,9 +162,13 @@ 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'];
|
|
@@ -242,9 +246,7 @@ class Applet extends Base
|
|
|
|
|
|
$user = Dever::db('passport/user')->one($uid);
|
|
|
|
|
|
- $result['vid'] = $id;
|
|
|
- $result['uid'] = $uid;
|
|
|
- $result['signature'] = Dever::login($uid);
|
|
|
+ $result = $this->getSign($uid, $id);
|
|
|
|
|
|
if (isset($user['mobile']) && $user['mobile']) {
|
|
|
$result['mobile'] = $user['mobile'];
|