|
@@ -12,8 +12,11 @@ import (
|
|
|
"os"
|
|
|
"path"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
|
|
|
+ "github.com/beego/beego/v2/server/web"
|
|
|
+ "github.com/beego/beego/v2/server/web/context"
|
|
|
"github.com/go-redis/redis/v8"
|
|
|
"github.com/rdlucklib/rdluck_tools/file"
|
|
|
"github.com/rdlucklib/rdluck_tools/http"
|
|
@@ -1488,3 +1491,19 @@ func TransfromToOriginUrl(linkToken string) (originLink string, msg string, err
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func FilterShareUrl() web.FilterFunc {
|
|
|
+ return func(c *context.Context) {
|
|
|
+ path := c.Input.Context.Request.URL.Path
|
|
|
+ tokenArr := strings.Split(path, "/")
|
|
|
+ token := tokenArr[len(tokenArr)-1]
|
|
|
+
|
|
|
+ newPath := "/v1/report/share/link"
|
|
|
+ q := c.Input.Context.Request.URL.Query()
|
|
|
+ q.Add("Token", token)
|
|
|
+ c.Input.Context.Request.URL.Path = newPath
|
|
|
+ c.Input.Context.Request.URL.RawQuery = q.Encode()
|
|
|
+
|
|
|
+ utils.ApiLog.Info(fmt.Sprintf("原始请求为:%s, 已修改请求路径为:%s?%s", path, newPath, q.Encode()))
|
|
|
+ }
|
|
|
+}
|