|
@@ -8,6 +8,7 @@ import (
|
|
|
"fmt"
|
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
|
+ "strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
"youngee_b_api/consts"
|
|
@@ -37,7 +38,8 @@ func QrCodeInit(config *system_model.Session) {
|
|
|
// getAndCacheWxAccessToken 获取并缓存微信的access token
|
|
|
func getAndCacheWxAccessToken(ctx context.Context) (string, error) {
|
|
|
appId := "wxac396a3be7a16844"
|
|
|
- secret := "c82ae9e75b4ed7d8022db5bda5371892"
|
|
|
+ // secret := "c82ae9e75b4ed7d8022db5bda5371892"
|
|
|
+ secret := "abbf27d46c46212c86e60f2ed3c534ee"
|
|
|
url := fmt.Sprintf(accessTokenUrlFormat, appId, secret)
|
|
|
|
|
|
resp, err := http.Get(url)
|
|
@@ -65,7 +67,7 @@ func getAndCacheWxAccessToken(ctx context.Context) (string, error) {
|
|
|
return accessTokenRes.AccessToken, nil
|
|
|
}
|
|
|
|
|
|
-func (q *qrcode) GetWxQrCode(ctx context.Context, Scene string, Page string) (*http_model.GetWxQRCodeData, error) {
|
|
|
+func (q *qrcode) GetWxQrCode(ctx context.Context, req *http_model.GetWxQRCodeRequest) (*http_model.GetWxQRCodeData, error) {
|
|
|
// 获取access_token
|
|
|
accessToken, err := redis.Get(ctx, wxAccesssTokenKey)
|
|
|
if err != nil && err != consts.RedisNil {
|
|
@@ -81,9 +83,35 @@ func (q *qrcode) GetWxQrCode(ctx context.Context, Scene string, Page string) (*h
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ var reqPath string
|
|
|
+ var reqData string
|
|
|
+
|
|
|
+ if req.SelectionId != "" {
|
|
|
+ reqPath = ""
|
|
|
+ reqData = req.SelectionId
|
|
|
+ }
|
|
|
+ if req.SProjectId != 0 || req.ProjectId != "" {
|
|
|
+ reqPath = ""
|
|
|
+ if req.SProjectId != 0 {
|
|
|
+ reqData = "0" + "-" + strconv.Itoa(req.SProjectId)
|
|
|
+ } else {
|
|
|
+ reqData = req.ProjectId + "-" + "0"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if req.SLocalId != 0 || req.LocalId != "" {
|
|
|
+ reqPath = ""
|
|
|
+ if req.SLocalId != 0 {
|
|
|
+ reqData = "0" + "-" + strconv.Itoa(req.SLocalId)
|
|
|
+ } else {
|
|
|
+ reqData = req.LocalId + "-" + "0"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Printf("reqData: %+v\n", reqData)
|
|
|
+
|
|
|
qrRequest := http_model.WxQrCodeRequest{
|
|
|
- Scene: Scene,
|
|
|
- Page: Page,
|
|
|
+ Scene: reqData,
|
|
|
+ Page: reqPath,
|
|
|
Width: 430,
|
|
|
CheckPath: false,
|
|
|
EnvVersion: "release",
|