feat:修改服务列表额度字段逻辑

This commit is contained in:
jiaji.H 2025-09-09 10:59:23 +08:00
parent 2280cc40d9
commit 2461bb8a93
4 changed files with 875 additions and 882 deletions

View File

@ -340,14 +340,15 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
return res, errors.New("查询增值服务列表失败") return res, errors.New("查询增值服务列表失败")
} }
for _, valueAddService := range list { for _, valueAddService := range list {
var quotaInfo string
var isExpired bool
serviceInfo := &bundle.ValueAddService{ serviceInfo := &bundle.ValueAddService{
Uuid: valueAddService.UUID, Uuid: valueAddService.UUID,
ServiceName: valueAddService.ServiceName, ServiceName: valueAddService.ServiceName,
ServiceType: valueAddService.ServiceType, ServiceType: valueAddService.ServiceType,
} }
for _, serviceLang := range valueAddService.ValueAddServiceLang { for _, serviceLang := range valueAddService.ValueAddServiceLang {
if serviceLang.QuotaType == 0 && serviceInfo.ServiceType != 5 && serviceInfo.ServiceType != 4 {
serviceLang.QuotaType = 1
}
serviceLangInfo := &bundle.ValueAddServiceLang{ serviceLangInfo := &bundle.ValueAddServiceLang{
Uuid: valueAddService.UUID, Uuid: valueAddService.UUID,
ServiceName: serviceLang.ServiceName, ServiceName: serviceLang.ServiceName,
@ -363,24 +364,10 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
QuotaValue: serviceLang.QuotaValue, QuotaValue: serviceLang.QuotaValue,
IsExpired: serviceLang.IsExpired, IsExpired: serviceLang.IsExpired,
} }
if serviceLangInfo.Language == "zh-CN" { if serviceLangInfo.Language == "zh-CN" && serviceInfo.ServiceType != 5 && serviceInfo.ServiceType != 4 {
switch serviceLangInfo.QuotaType { serviceInfo.QuotaType = serviceLangInfo.QuotaType
case 0: serviceInfo.QuotaValue = serviceLangInfo.QuotaValue
quotaInfo = "不限额度" serviceInfo.IsExpired = serviceLangInfo.IsExpired
case 1:
quotaInfo = fmt.Sprintf("每天%d个", serviceLangInfo.QuotaValue)
case 2:
quotaInfo = fmt.Sprintf("每月%d个", serviceLangInfo.QuotaValue)
case 3:
quotaInfo = fmt.Sprintf("每季度%d个", serviceLangInfo.QuotaValue)
case 4:
quotaInfo = fmt.Sprintf("每半年%d个", serviceLangInfo.QuotaValue)
case 5:
quotaInfo = fmt.Sprintf("每年%d个", serviceLangInfo.QuotaValue)
default:
quotaInfo = ""
}
isExpired = serviceLangInfo.IsExpired
} }
if len(serviceLang.Options) > 0 { if len(serviceLang.Options) > 0 {
var options []*bundle.ValueAddPriceOptions var options []*bundle.ValueAddPriceOptions
@ -410,10 +397,6 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
serviceLangInfo.Options = options serviceLangInfo.Options = options
} }
serviceInfo.ServiceLang = append(serviceInfo.ServiceLang, serviceLangInfo) serviceInfo.ServiceLang = append(serviceInfo.ServiceLang, serviceLangInfo)
if quotaInfo != "" && serviceInfo.ServiceType != 5 {
serviceInfo.ServiceQuota = quotaInfo
serviceInfo.IsExpired = isExpired
}
} }
res.ValueAddServiceList = append(res.ValueAddServiceList, serviceInfo) res.ValueAddServiceList = append(res.ValueAddServiceList, serviceInfo)
} }

View File

@ -503,8 +503,9 @@ message ValueAddService {
string serviceName = 2 [json_name = "serviceName"]; // string serviceName = 2 [json_name = "serviceName"]; //
int32 serviceType = 3 [json_name = "serviceType"]; // int32 serviceType = 3 [json_name = "serviceType"]; //
repeated ValueAddServiceLang serviceLang = 4 [json_name = "serviceLang"]; // repeated ValueAddServiceLang serviceLang = 4 [json_name = "serviceLang"]; //
string serviceQuota = 5 [json_name = "serviceQuota"];// int32 quotaType = 5 [json_name = "quotaType"];//
bool isExpired = 6 [json_name = "isExpired"];// int32 quotaValue = 6 [json_name = "quotaValue"];//
bool isExpired = 7 [json_name = "isExpired"];//
} }
message ValueAddServiceLang { message ValueAddServiceLang {
string uuid = 1 [json_name = "uuid"]; string uuid = 1 [json_name = "uuid"];

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT. // Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-triple v1.0.5 // - protoc-gen-go-triple v1.0.5
// - protoc v5.26.0 // - protoc v4.22.0
// source: pb/bundle.proto // source: pb/bundle.proto
package bundle package bundle