zxhxx 3 年之前
父節點
當前提交
f377161ed8
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      application/api/controller/MiniProgram.php

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

@@ -58,7 +58,7 @@ class MiniProgram extends  Api
             $this->error('签名无效,重新刷新'.$e->getMessage());
         }
         if (!isset($userInfo['unionId'])) $userInfo['unionId'] = '';
-        if(!$userInfo['openId'])  $userInfo['openId'] = $userInfoCong['openid'];
+        if(!$userInfo['openId'] && isset($userInfoCong['openid']))  $userInfo['openId'] = $userInfoCong['openid'];
         if(!$userInfo['openId']) $this->error('获取openId失败!');
         User::routineOauth($userInfo);
         $user = User::where('id', UserRelation::openidToUid($userInfo['openId'], 'routine_openid'))->find();