feat:修改服务列表额度字段逻辑
This commit is contained in:
parent
2280cc40d9
commit
2461bb8a93
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user