浏览代码

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

lizhen_gitee 1 年之前
父节点
当前提交
9ef6ba7ae6

+ 3 - 2
application/api/controller/Index.php

@@ -397,6 +397,7 @@ class Index extends Api
         $whereOr["party_id"] = $search;
         $whereOr["party_name"] = ["like","%$search%"];
         //$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")
             ->where($where)
@@ -447,8 +448,8 @@ class Index extends Api
                 }
                 /*$mod = intval($gKey)%5;
                 $pVal["party_type_color"] = $mod == 0?5:$mod;*/
-                $pVal["party_type_color"] = 1;
-                $pVal["type_name"] = '普通房';
+                $gVal["party_type_color"] = 1;
+                $gVal["type_name"] = '普通房';
                 $gVal['member_list'] = $userData;
                 $gVal['online_num'] = count($userData);
                 unset($gVal['guildmember']);

+ 7 - 8
application/api/controller/User.php

@@ -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('已经绑定了微信号');
         }

+ 7 - 1
application/common/library/Auth.php

@@ -581,7 +581,13 @@ class Auth
                 UserPower::where(['user_id'=>$this->_user->id])->update($updateArr);
             }
         }
-        $userinfo['user_power'] = $this->power;
+        if (!isset($this->power)) {
+            $userPowerWhere['user_id'] = $this->_user->id;
+            $userPower = model('UserPower')->where($userPowerWhere)->find();
+        } else {
+            $userPower = $this->power;
+        }
+        $userinfo['user_power'] = $userPower;
         $userinfo['pre_nickname'] = isset($user['pre_nickname']) ? $user['pre_nickname'] : '';
         $userinfo['pre_avatar'] = isset($user['pre_avatar']) ? $user['pre_avatar'] : '';
         $userinfo['nickname_status'] = $userinfo['avatar_status'] = 0;

+ 7 - 6
application/common/library/Wechat.php

@@ -12,16 +12,17 @@ use think\Session;
  */
 class Wechat
 {
-    private $app_id = config('wxMiniProgram')['appid'];
-    private $app_secret = config('wxMiniProgram')['secret'];
+    private $app_id = '';
+    private $app_secret = '';
 
     private $scope = 'snsapi_userinfo';
 
-    /*public function __construct($app_id, $app_secret)
+    public function __construct()
     {
-        $this->app_id = $app_id;
-        $this->app_secret = $app_secret;
-    }*/
+        $wxConfig = config('wxMiniProgram');
+        $this->app_id = $wxConfig['appid'];
+        $this->app_secret = $wxConfig['secret'];
+    }
 
     /**
      * 获取微信授权链接