取出测试环境验证码判断1

This commit is contained in:
wucongxing8150 2024-07-29 15:54:39 +08:00
parent 090cfce650
commit b84f0b73df

View File

@ -8,6 +8,7 @@ import (
"hepa-calc-api/extend/aliyun" "hepa-calc-api/extend/aliyun"
"hepa-calc-api/global" "hepa-calc-api/global"
"math/rand" "math/rand"
"net/http"
"strconv" "strconv"
"time" "time"
) )
@ -121,3 +122,12 @@ func (r *PublicService) GetIndex(userId int64) (g *dto.IndexDto, err error) {
return g, nil return g, nil
} }
// GetUserIP 获取用户ip
func (r *PublicService) GetUserIP(h *http.Request) string {
forwarded := h.Header.Get("X-FORWARDED-FOR")
if forwarded != "" {
return forwarded
}
return h.RemoteAddr
}