f
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"qnc-server/app/main/api/internal/config"
|
||||
"qnc-server/app/main/model"
|
||||
"qnc-server/common/ctxdata"
|
||||
@@ -446,9 +447,10 @@ func (w *WechatPayService) GenerateOutTradeNo() string {
|
||||
func (w *WechatPayService) getWechatMiniOpenID(ctx context.Context, code string) (string, error) {
|
||||
appID := w.config.WechatMini.AppID
|
||||
appSecret := w.config.WechatMini.AppSecret
|
||||
url := fmt.Sprintf("https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code", appID, appSecret, code)
|
||||
apiURL := fmt.Sprintf("https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code",
|
||||
url.QueryEscape(appID), url.QueryEscape(appSecret), url.QueryEscape(code))
|
||||
|
||||
resp, err := http.Get(url)
|
||||
resp, err := http.Get(apiURL)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("请求微信API失败: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user