feat(tenant): 隔离邀请返利与推广追踪数据

This commit is contained in:
yml
2026-11-15 20:18:47 +08:00
parent db7dbc7596
commit 1eb2fa749b
10 changed files with 344 additions and 30 deletions
@@ -27,7 +27,7 @@ func NewHandler(service *Service) *Handler {
func (h *Handler) Redirect(c *gin.Context) {
code := strings.TrimSpace(c.Param("code"))
if !codePattern.MatchString(code) {
c.Redirect(http.StatusFound, "https://hao858.com/")
c.Redirect(http.StatusFound, getRequestBaseURL(c)+"/")
return
}
@@ -46,7 +46,7 @@ func (h *Handler) Redirect(c *gin.Context) {
targetURL, err := h.service.ResolveRedirect(c.Request.Context(), code, ip, ua, referer, visitorID)
if err != nil {
// 链接不存在或已停用时,优雅兜底跳转至官网首页,附带失效短码参数以备提示
c.Redirect(http.StatusFound, "https://hao858.com/?ref_invalid="+url.QueryEscape(code))
c.Redirect(http.StatusFound, getRequestBaseURL(c)+"/?ref_invalid="+url.QueryEscape(code))
return
}