cqpCow 1 anno fa
parent
commit
378216872e
1 ha cambiato i file con 1 aggiunte e 0 eliminazioni
  1. 1 0
      app/Service/Weixin/WeixinService.php

+ 1 - 0
app/Service/Weixin/WeixinService.php

@@ -33,6 +33,7 @@ class WeixinService extends Service
     }
 
     public function getOpenid($data){
+        if(empty($data['code'])) return [false, 'code不能为空'];
         $code = $data['code'];
         $url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code';
         $url = sprintf($url,self::APPID,self::APPSECRET,$code);