feat:解决冲突

This commit is contained in:
jiaji.H 2025-09-09 11:02:31 +08:00
commit 5d47d6f1a9
4 changed files with 1152 additions and 1159 deletions

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,8 @@ import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
_ "google.golang.org/protobuf/types/descriptorpb"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)