|
@@ -714,7 +714,7 @@ class User extends Api
|
|
|
//微信登录
|
|
|
public function wechatlogin(){
|
|
|
|
|
|
- $code = input_post('code','');
|
|
|
+ $code = $this->request->param('code','');
|
|
|
if(!$code){
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
@@ -729,10 +729,7 @@ class User extends Api
|
|
|
|
|
|
$user = Db::name('user')->where('openid',$openid)->find();
|
|
|
if ($user) {
|
|
|
- if ($user['status'] == 2) {
|
|
|
- $this->error(__('Account is log off'));
|
|
|
- }
|
|
|
- if ($user['status'] != 1) {
|
|
|
+ if ($user['status'] != 'normal') {
|
|
|
$this->error(__('Account is locked'));
|
|
|
}
|
|
|
//如果已经有账号则直接登录
|
|
@@ -1122,7 +1119,8 @@ class User extends Api
|
|
|
*/
|
|
|
public function bindmobile()
|
|
|
{
|
|
|
- $user = $this->auth->getUser();
|
|
|
+ //$user = $this->auth->getUser();
|
|
|
+ $user = model('User')->find($this->auth->id);
|
|
|
$mobile = $this->request->post('mobile');
|
|
|
$captcha = $this->request->post('captcha');
|
|
|
|
|
@@ -1160,18 +1158,19 @@ class User extends Api
|
|
|
*/
|
|
|
public function bindopenid()
|
|
|
{
|
|
|
- $code = input_post('code','');
|
|
|
+ $code = $this->request->post('code','');
|
|
|
if(!$code){
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
|
//微信
|
|
|
$wechat = new Wechat();
|
|
|
$openid = $wechat->getOpenid($code);
|
|
|
+
|
|
|
if(!$openid){
|
|
|
$this->error('openid获取失败');
|
|
|
}
|
|
|
|
|
|
- $user = $this->auth->getUser();
|
|
|
+ $user = model('User')->find($this->auth->id);
|
|
|
if(!empty($this->auth->openid)){
|
|
|
$this->error('已经绑定了微信号');
|
|
|
}
|