修复订单金额落库不对的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m17s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m17s
This commit is contained in:
@@ -696,8 +696,9 @@ func parseGatewayTime(raw gateway.FlexString) *time.Time {
|
||||
}
|
||||
|
||||
// GetPackages 获取资产的所有套餐列表(支持分页和状态筛选)
|
||||
// callerAccountType: 调用方账号类型,"platform" 时返回成本价(paid_amount),其他类型不返回
|
||||
// page 默认 1,pageSize 默认 50,pageSize 最大 100
|
||||
func (s *Service) GetPackages(ctx context.Context, assetType string, id uint, page, pageSize int, status *int) (*dto.AssetPackagesResult, error) {
|
||||
func (s *Service) GetPackages(ctx context.Context, assetType string, id uint, page, pageSize int, status *int, callerAccountType string) (*dto.AssetPackagesResult, error) {
|
||||
// 分页参数边界处理
|
||||
if page < 1 {
|
||||
page = 1
|
||||
@@ -757,6 +758,10 @@ func (s *Service) GetPackages(ctx context.Context, assetType string, id uint, pa
|
||||
pkgType = pkg.PackageType
|
||||
expiryBase = pkg.ExpiryBase
|
||||
}
|
||||
var paidAmount *int64
|
||||
if callerAccountType == constants.OwnerTypePlatform {
|
||||
paidAmount = u.PaidAmount
|
||||
}
|
||||
item := &dto.AssetPackageResponse{
|
||||
PackageUsageID: u.ID,
|
||||
PackageID: u.PackageID,
|
||||
@@ -780,7 +785,8 @@ func (s *Service) GetPackages(ctx context.Context, assetType string, id uint, pa
|
||||
ExpiresAt: u.ExpiresAt,
|
||||
MasterUsageID: u.MasterUsageID,
|
||||
Priority: u.Priority,
|
||||
PaidAmount: u.PaidAmount,
|
||||
PaidAmount: paidAmount,
|
||||
RetailAmount: u.RetailAmount,
|
||||
CreatedAt: u.CreatedAt,
|
||||
}
|
||||
all = append(all, item)
|
||||
@@ -811,7 +817,8 @@ func (s *Service) GetPackages(ctx context.Context, assetType string, id uint, pa
|
||||
}
|
||||
|
||||
// GetCurrentPackage 获取资产当前生效的主套餐
|
||||
func (s *Service) GetCurrentPackage(ctx context.Context, assetType string, id uint) (*dto.AssetPackageResponse, error) {
|
||||
// callerAccountType: 调用方账号类型,"platform" 时返回成本价(paid_amount),其他类型不返回
|
||||
func (s *Service) GetCurrentPackage(ctx context.Context, assetType string, id uint, callerAccountType string) (*dto.AssetPackageResponse, error) {
|
||||
carrierType := assetType
|
||||
if assetType == "card" {
|
||||
carrierType = "iot_card"
|
||||
@@ -839,6 +846,10 @@ func (s *Service) GetCurrentPackage(ctx context.Context, assetType string, id ui
|
||||
pkgType = pkg.PackageType
|
||||
expiryBase = pkg.ExpiryBase
|
||||
}
|
||||
var paidAmount *int64
|
||||
if callerAccountType == constants.OwnerTypePlatform {
|
||||
paidAmount = usage.PaidAmount
|
||||
}
|
||||
return &dto.AssetPackageResponse{
|
||||
PackageUsageID: usage.ID,
|
||||
PackageID: usage.PackageID,
|
||||
@@ -862,7 +873,8 @@ func (s *Service) GetCurrentPackage(ctx context.Context, assetType string, id ui
|
||||
ExpiresAt: usage.ExpiresAt,
|
||||
MasterUsageID: usage.MasterUsageID,
|
||||
Priority: usage.Priority,
|
||||
PaidAmount: usage.PaidAmount,
|
||||
PaidAmount: paidAmount,
|
||||
RetailAmount: usage.RetailAmount,
|
||||
CreatedAt: usage.CreatedAt,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user