取出测试环境验证码判断1
This commit is contained in:
parent
090cfce650
commit
b84f0b73df
@ -8,6 +8,7 @@ import (
|
||||
"hepa-calc-api/extend/aliyun"
|
||||
"hepa-calc-api/global"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
@ -121,3 +122,12 @@ func (r *PublicService) GetIndex(userId int64) (g *dto.IndexDto, err error) {
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user