utils

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ImageCaptchaCacheKey = "IMAGE_CAPTCHA_CACHE:"

ImageCaptchaCacheKey 定义图形验证码缓存键前缀

Variables

This section is empty.

Functions

func AddClearUserID added in v0.0.21

func AddClearUserID(values string, valueToAdd string) string

AddClearUserID 添加一个值到字符串中(如果不存在),并返回添加后的字符串

func CalculateProfit added in v0.0.21

func CalculateProfit(userTotalAmount, upRate, feeRate, violationDeduction float64) bool

CalculateProfit 检查是否会赔钱 userTotalAmount: 用户的总金额 upRate: 上浮费率(例如 0.1 表示 10%) feeRate: 手续费费率(例如 0.02 表示 2%) violationDeduction: 违规扣除金额 返回值: 如果不赔钱返回 true,否则返回 false

func ContainsClearUserID added in v0.0.21

func ContainsClearUserID(values string, valueToCheck string) bool

ContainsClearUserID 判断字符串中是否包含指定的值

func ConvertUserId added in v0.0.21

func ConvertUserId(msg string) (uint64, error)

ConvertUserId 将 msg.UserId 从 string 转换为 uint64

func GenericCopy added in v0.0.17

func GenericCopy[T any](src interface{}) *T

GenericCopy 用于将一个类型的实例复制到另一个类型的实例

func GetHardWarePrice added in v0.0.21

func GetHardWarePrice(priceBox float64, priceCompany float64) float64

GetHardWarePrice 如果箱体回收单价存在返回箱体回收单价,否则返回公司回收单价

func GetImageCaptchaCacheKey added in v0.0.19

func GetImageCaptchaCacheKey(uuid string) string

GetImageCaptchaCacheKey 生成完整的图形验证码缓存键

func RemoveClearUserID added in v0.0.21

func RemoveClearUserID(values string, valueToRemove string) string

RemoveClearUserID 删除字符串中的一个特定值,并返回删除后的字符串

func RoundUpToTwoDecimal added in v0.0.21

func RoundUpToTwoDecimal(serviceFee float64) float64

RoundUpToTwoDecimal 保留两位小数并向上舍入

func ToJsonString

func ToJsonString(message interface{}) (string, error)

ToJsonString 通用转换Json字符串函数

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