新增微信公众平台对接,增加缓存。默认10天
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
v1 "hospital-open-api/api/requests/v1"
|
||||
"hospital-open-api/api/responses"
|
||||
@@ -53,7 +53,13 @@ func (r *WeChat) GetScheme(c *gin.Context) {
|
||||
envVersion = "release"
|
||||
}
|
||||
|
||||
fmt.Println(req.Query)
|
||||
// 获取缓存
|
||||
redisKey := "c:official_account.scheme." + req.Path + "." + req.Query
|
||||
scheme, _ := global.Redis.Get(context.Background(), redisKey).Result()
|
||||
if scheme != "" {
|
||||
responses.OkWithData(scheme, c)
|
||||
return
|
||||
}
|
||||
|
||||
// 构建请求数据
|
||||
JumpWxaData := &Scheme.GetSchemeJumpWxaRequest{
|
||||
@@ -66,7 +72,7 @@ func (r *WeChat) GetScheme(c *gin.Context) {
|
||||
JumpWxa: JumpWxaData,
|
||||
ExpireType: 1,
|
||||
ExpireTime: 0,
|
||||
ExpireInterval: req.ExpireInterval,
|
||||
ExpireInterval: 10,
|
||||
}
|
||||
|
||||
openLink, err := GetSchemeRequest.GetScheme(1)
|
||||
|
||||
Reference in New Issue
Block a user