Documentation
¶
Index ¶
- Constants
- Variables
- func DiscountCalculation(realMoney, tagPrice float64) string
- func DiscountCalculationInt(realMoney, tagPrice int) string
- func EmojiFilter(content string) (newContent string)
- func FenToYuanFloat(money int) float64
- func FenToYuanString(money int) string
- func GetPathAllFile(pathname string) (files []string, err error)
- func GetRandomIp() string
- func GetRandomString(n int) string
- func GetTodayStartTime(formatLayout string) time.Time
- func HttpGet(url string) ([]byte, error)
- func HttpPost(url, contentType string, reqBody string) ([]byte, error)
- func IdCardValidate(idCardNumber string) bool
- func Ip2long(ipStr string) uint32
- func IsLeap(year int) bool
- func IsToday(t int64) bool
- func IsTomorrow(t int64) bool
- func IsYesterday(t int64) bool
- func JsonMarshalNoError(data interface{}) string
- func MobilePhoneValidate(phoneNumber string) bool
- func RandInt64(min, max int64) int64
- func RemoteIp(req *http.Request) string
- func TimeAgo(t time.Time) string
- func TimeFormatter(i interface{}, format string) string
- func YuanToFen(money float64) int64
- func YuanToFenRounding(money float64) int64
Constants ¶
View Source
const ( XForwardedFor = "X-Forwarded-For" XRealIP = "X-Real-IP" )
View Source
const (
HttpContentTypeForm = "application/x-www-form-urlencoded"
)
Variables ¶
View Source
var IpLong = [][]int{
{607649792, 608174079},
{975044608, 977272831},
{999751680, 999784447},
{1019346944, 1019478015},
{1038614528, 1039007743},
{1783627776, 1784676351},
{1947009024, 1947074559},
{1987051520, 1988034559},
{2035023872, 2035154943},
{2078801920, 2079064063},
{-1950089216, -1948778497},
{-1425539072, -1425014785},
{-1236271104, -1235419137},
{-770113536, -768606209},
{-569376768, -564133889},
}
Functions ¶
func DiscountCalculation ¶
DiscountCalculation计算折扣. realMoney实际价格,tagPrice吊牌价.
func DiscountCalculationInt ¶
DiscountCalculationInt计算折扣. realMoney实际价格,tagPrice吊牌价.
func EmojiFilter ¶
EmojiFilter过滤掉传入的字符串content中的Emoji
func FenToYuanString ¶
FenToYuanString将金额分转换成元. 返回一个string类型.
func GetPathAllFile ¶
GetPathAllFile获取路径下面所有文件
func GetRandomString ¶
GetRandomString随机生成大写字母和数字的组合. n是生成字符串的长度.
func GetTodayStartTime ¶
GetTodayStartTime获取本日起始时间. formatLayout为格式化格式.
func JsonMarshalNoError ¶
func JsonMarshalNoError(data interface{}) string
func MobilePhoneValidate ¶
MobilePhoneValidate校验传入的手机号是否正确.
func TimeFormatter ¶
TimeFormatter为时间格式化函数. i请传入time、int、int32、int64类型. format为需要格式化的日期格式 如:2006-01-02 15:04:05、2006.01.02等等.
func YuanToFenRounding ¶
YuanToFenRounding将金额元转换为分. 它满足:当乘以100后,仍然有小数位,四舍五入法后,再取整数部分.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.