Documentation

Overview

*

* 计算佣金
* 2020/05/22

* string functions

* System info

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToUnitSize

func ByteToUnitSize(Size interface{}) (float64, string)

字节自动转换为B/KB/MB/GB

func CpuUsage

func CpuUsage() string

func DeleteExtraSpace

func DeleteExtraSpace(s string) string

* 删除多余空格 * 2019/05/05

func DistributionPrice

func DistributionPrice(business map[string]string, productSpecialPrice []map[string]string, distributionPrice interface{}, percentAge interface{}, productPrice interface{}) (float64, error)

*

* 计算某一商品对分销商的分销价
* @param business 分销商信息
* @param productSpecialPrice 分销特殊价格
* @param distributionPrice 基础分销价
* @param percentage 分销比例
* @param productPrice 商品销售价
* 2020/05/22
* gz

func FileUsage

func FileUsage() []interface{}

func FloatAdd

func FloatAdd(str ...interface{}) float64

*

* 数值相加
* @param str  加数,加数...
* 2020/05/22
* gz

func FloatMul

func FloatMul(str ...interface{}) float64

*

* float相乘
* @param str  被除数,除数,保留小数位数
* 2020/05/25
* gz

func FloatQuo

func FloatQuo(str ...interface{}) float64

*

* float相除
* @param str  被除数,除数,保留小数位数
* 2020/05/25
* gz

func FloatSub

func FloatSub(str ...interface{}) float64

*

* float相减
* @param str  被减数,减数...
* 2020/05/22
* gz

func FormatDate

func FormatDate(str string) string

func FormatDateTime

func FormatDateTime(str string) string

func FormatUUID

func FormatUUID(buf []byte) (string, error)

func GenerateRandomBytes

func GenerateRandomBytes(size int) ([]byte, error)

GenerateRandomBytes is used to generate random bytes of given size.

func GenerateUUID

func GenerateUUID() (string, error)

GenerateUUID is used to generate a random UUID

func GetDomain

func GetDomain(req *http.Request) string

*

* 取域名

func GetHost

func GetHost(req *http.Request) string

*

* 取访问主机名

func GetNetConfig

func GetNetConfig() []interface{}

*

*网络配置

func GetPage

func GetPage(pageNum, pageSize interface{}) (string, string)

*

* 根据第几页计算从第几行开始
* @param pageNum 第几页
* @param pageSize 每页几行
* @return from,offset 开始行数,偏移量
* 2020/05/15
* gz

func GetRandomNumber

func GetRandomNumber(length int) string

生成随机数字

func GetRandomString

func GetRandomString(length int) string

生成随机字符串

func IoUsage

func IoUsage() map[string]string

*

* IO读写

func IsEmail

func IsEmail(email string) bool

判断邮箱

func IsInStringArray

func IsInStringArray(arr []string, str string) bool

*

* 是否存在在字符切片中

func IsMobile

func IsMobile(mobile string) bool

判断手机号码

func LoadAverage

func LoadAverage() map[string]string

*

*系统负载1 5 10 分钟

func MergeStringMap

func MergeStringMap(x, y map[string]string) map[string]string

func NetBytes

func NetBytes(Iface string) []string

*

*网卡实时流量

func NetUsage

func NetUsage() []interface{}

*

*网卡使用情况

func NewUUID

func NewUUID() string

Simple call

func ParamsString

func ParamsString(param string) string

*

* 处理传递的参数
* @param param
* @return
* 2020/05/15
* gz

func ParseUUID

func ParseUUID(uuid string) ([]byte, error)

func PutNetConfig

func PutNetConfig(mString map[string]string) error

*

*修改网络配置

func SetHeader

func SetHeader(w http.ResponseWriter, resp *http.Request)

func StrFirstToUpper

func StrFirstToUpper(str string) string

*

* 字符串转大驼峰 ios_bbbbbbbb -> IosBbbbbbbbb

func StringJoin

func StringJoin(s ...string) string

* 连接多个字符串 * 2019/05/05

func ToFloat64

func ToFloat64(v interface{}) (float64, error)

func ToInt

func ToInt(inter interface{}) int

func ToInt64

func ToInt64(inter interface{}) int64

func ToMapStringArray

func ToMapStringArray(x interface{}) ([]map[string]string, error)

*

* 转换为map string数组
* 2021/1/5
* gz

func ToStr

func ToStr(v interface{}) string

func ToString

func ToString(v interface{}) string

func UrlJoin

func UrlJoin(host, url string) string

* 连接url * 2019/05/05

func VipPrice

func VipPrice(productSpecialPrice []map[string]string, productPrice interface{}) (float64, error)

*

* 计算某一商品的VIP价
* @param productSpecialPrice 特殊价格
* @param productPrice 商品销售价
* 2020/06/05
* gz

Types

type Validate

type Validate struct {
	Data  []interface{}
	Title []string
	Rule  []string //多个规则使用逗号(,)隔开
}

func (*Validate) Check

func (v *Validate) Check() error