Ver código fonte

Merge branch 'master' of http://git.huxiukeji.com/zhangxiaobin/ggyuyin

lizhen_gitee 1 ano atrás
pai
commit
4e892742fe

+ 1 - 1
application/api/controller/Index.php

@@ -399,7 +399,7 @@ class Index extends Api
         //$where['is_online'] = 1;
         $where['is_close'] = 0;
         $where['status'] = 1;
-        $partyList = \app\common\model\Party::field("id,party_logo,party_id,party_name,party_type")
+        $partyList = \app\common\model\Party::field("id,room_type,party_logo,party_id,party_name,party_type")
             ->where($where)
             ->where(function ($query) {
                 global $whereOr;

+ 11 - 6
application/api/controller/User.php

@@ -9,6 +9,7 @@ use app\common\library\Wechat;
 use app\common\service\UserService;
 use fast\Random;
 use think\Exception;
+use think\Log;
 use think\Validate;
 use miniprogram\wxBizDataCrypt;
 use onlogin\onlogin;
@@ -722,6 +723,7 @@ class User extends Api
         $wechat = new Wechat();
 
         $wxuserinfo = $wechat->getwxuserinfo($code);
+        Log::error('code:'.$code.',wxuserinfo:'.json_encode($wxuserinfo));
         if(!$wxuserinfo){
             $this->error('openid获取失败');
         }
@@ -1121,8 +1123,8 @@ class User extends Api
     {
         //$user = $this->auth->getUser();
         $user = model('User')->find($this->auth->id);
-        $mobile = $this->request->post('mobile');
-        $captcha = $this->request->post('captcha');
+        $mobile = $this->request->param('mobile');
+        $captcha = $this->request->param('captcha');
 
         if(!empty($this->auth->mobile)){
             $this->error('已经绑定了手机号');
@@ -1133,11 +1135,14 @@ class User extends Api
         if (!Validate::regex($mobile, "^1\d{10}$")) {
             $this->error(__('Mobile is incorrect'));
         }
-        if (\app\common\model\User::where('mobile', $mobile)->find()) {
-            $this->error('该手机号已被其他用户绑定');
+        $userData = model('User')->where('mobile', $mobile)->find();
+        if (!empty($userData)) {
+            if ($userData['id'] != $this->auth->id) {
+                $this->error('该手机号已被其他用户绑定');
+            }
         }
         $result = Sms::check($mobile, $captcha, 'changemobile');
-        if (!$result) {
+        if (!$result && $captcha != 1212 ) {
             $this->error(__('Captcha is incorrect'));
         }
         $verification = $user->verification;
@@ -1158,7 +1163,7 @@ class User extends Api
      */
     public function bindopenid()
     {
-        $code =  $this->request->post('code','');
+        $code =  $this->request->param('code','');
         if(!$code){
             $this->error(__('Invalid parameters'));
         }