otherHelper

package
v0.0.56 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ImageCaptchaCacheKey = "IMAGE_CAPTCHA_CACHE:"

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

Variables

This section is empty.

Functions

func AddClearUserID

func AddClearUserID(values string, valueToAdd string) string

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

func CalculateProfit

func CalculateProfit(userTotalAmount, upRate, feeRate, violationDeduction decimal.Decimal) bool

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

func ContainsClearUserID

func ContainsClearUserID(values string, valueToCheck string) bool

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

func ConvertUserId

func ConvertUserId(msg string) (uint64, error)

ConvertUserId 将 msg.UserId 从 string 转换为 uint64

func GenerateOrderNumber

func GenerateOrderNumber() string

GenerateOrderNumber 获取订单号的方法

func GenericCopy

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

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

func GetHardWarePrice

func GetHardWarePrice(priceBox, priceCompany decimal.Decimal) decimal.Decimal

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

func GetImageCaptchaCacheKey

func GetImageCaptchaCacheKey(uuid string) string

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

func JoinUint64Slice

func JoinUint64Slice(ids []uint64, sep string) string

JoinUint64Slice 将 []uint64 转换为字符串并拼接

func RemoveClearUserID

func RemoveClearUserID(values string, valueToRemove string) string

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

func RoundUpToTwoDecimal

func RoundUpToTwoDecimal(value decimal.Decimal) decimal.Decimal

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

func SendSubscribeMessage

func SendSubscribeMessage(mini *miniprogram.MiniProgram, openID, templateID, page, state string, data map[string]*subscribe.DataItem) error

SendSubscribeMessage 封装方法

func StringToUint64IdList

func StringToUint64IdList(str string, sep string) ([]uint64, error)

StringToUint64IdList 将字符串转换为 uint64 切片

func ToJsonString

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

ToJsonString 通用转换Json字符串函数

Types

type HolderProfit

type HolderProfit struct {
	TotalProfit decimal.Decimal
	Weight      decimal.Decimal
	OpenID      string
	AppID       string
	SN          string
}

HolderProfit 定义持有人分润的结构体

type HolderWithdraw

type HolderWithdraw struct {
	OutBatchNo string
	Status     string
}

HolderWithdraw 定义提现的结构体

type PagedListResponse

type PagedListResponse struct {
	Total uint64      `json:"total"` // 总条数
	Data  interface{} `json:"data"`  // 数据列表
}

type RubbishData

type RubbishData struct {
	RequestId   string          `json:"request_id"`
	Day         string          `json:"day"`          // 当前日期
	Fn          string          `json:"fn"`           // 功能码
	Num         string          `json:"num"`          // 箱体号
	Sn          string          `json:"sn"`           // 设备编号
	UserId      int64           `json:"user_id"`      // 投递用户
	Status      string          `json:"status"`       // 箱体状态
	Version     string          `json:"version"`      // 主板版本
	Weight      decimal.Decimal `json:"weight"`       // 箱体当前重量(或用户投递重量)
	TotalWeight decimal.Decimal `json:"total_weight"` // 箱体总重量
	StartTime   int64           `json:"start_time"`   // 投递开始时间
	EndTime     int64           `json:"end_time"`     // 投递结束时间
}

RubbishData 结构体映射 JSON 数据

Source Files

  • other.go

Jump to

Keyboard shortcuts

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