utils

package
v0.0.0-...-cc6c6cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChineseLoc = time.FixedZone("CST", 8*3600)
View Source
var (
	ProvideUtilSet = wire.NewSet(jwt.NewClient)
)

Functions

func AddUTM

func AddUTM(siteUrl string) string

func B64Encode

func B64Encode(str string) string

B64Encode encodes a string to base64

func BuildProxyUrl

func BuildProxyUrl(proxyData *payloads.ProxyConfig) string

func BuildSlice

func BuildSlice(l int) []int

func CleanUrl

func CleanUrl(siteUrl string) (string, error)

CleanUrl 去除url中的参数,只保留域名和路径

func ExtractDomain

func ExtractDomain(rawURL string) (string, error)

func ExtractRootDomain

func ExtractRootDomain(rawURL string) (string, error)

ExtractRootDomain 从 URL 中提取注册域(根域名)

func FormatDate

func FormatDate(t time.Time) string

func GenOrderID

func GenOrderID(uid int64) string

GenOrderID 生成订单号

func GenRandNumber

func GenRandNumber(length int) string

GenRandNumber 生成指定倍数的随机数

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString 生成指定长度的随机字符串

func GetIP

func GetIP(c *gin.Context) string

func HtmlX

func HtmlX(x string) template.HTML

func IsAdmin

func IsAdmin(c *gin.Context) bool

func Md5Str

func Md5Str(str string) string

func ModifyURLParams

func ModifyURLParams(inputURL string, params map[string]string) (string, error)

func MustHostname

func MustHostname(siteUrl string) string

MustHostname 从url中解析出域名

func ParseFavicon

func ParseFavicon(siteUrl, faviconPath string) (string, error)

ParseFavicon 解析站点图标

func ParseHostname

func ParseHostname(siteUrl string) (string, error)

ParseHostname 从url中解析出域名

func User

func User(c *gin.Context) *ent.User

User 获取用户信息,可能为nil

func UserID

func UserID(c *gin.Context) int64

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL