common

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Billing

func Billing(ctx context.Context, usage smodel.Usage, spend *common.Spend)

计算花费

func ConvModelPricingToPrice

func ConvModelPricingToPrice(pricing common.Pricing) common.Pricing

转换模型定价成价格

func ConvModelPricingToRatio

func ConvModelPricingToRatio(pricing common.Pricing) common.Pricing

转换模型定价成倍率

func ConvPrice

func ConvPrice(ratio float64) float64

倍率转价格

func ConvQuotaUnit

func ConvQuotaUnit(quota float64) int

转换额度单位

func ConvQuotaUnitReverse

func ConvQuotaUnitReverse(quota int, n ...int) float64

转换额度单位(反向)

func ConvRatio

func ConvRatio(price float64) float64

价格转倍率

func ConvSpend

func ConvSpend(spend common.Spend) common.Spend

转换花费

func GetVariableData

func GetVariableData(ctx context.Context, user *entity.User, reseller *entity.Reseller, siteConfig *entity.SiteConfig, variables []string) map[string]any

获取变量数据

func New

func New() service.ICommon

func ParseSecretKey

func ParseSecretKey(ctx context.Context, secretKey string) (int, int, error)

解析密钥

func RecordSpend

func RecordSpend(ctx context.Context, userId, appId int, appKey string, rid int, key string, spend common.Spend) error

记录花费

Types

This section is empty.

Jump to

Keyboard shortcuts

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