|
@@ -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);
|