Compare commits

..

No commits in common. "5d47d6f1a99c895e7f2daf0692aa1fff8493d597" and "49f89d1319b40b43549f132ffa16a5ac6375eb35" have entirely different histories.

4 changed files with 1157 additions and 1150 deletions

View File

@ -340,15 +340,14 @@ 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,
@ -364,10 +363,24 @@ 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" && serviceInfo.ServiceType != 5 && serviceInfo.ServiceType != 4 { if serviceLangInfo.Language == "zh-CN" {
serviceInfo.QuotaType = serviceLangInfo.QuotaType switch serviceLangInfo.QuotaType {
serviceInfo.QuotaValue = serviceLangInfo.QuotaValue case 0:
serviceInfo.IsExpired = serviceLangInfo.IsExpired 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 len(serviceLang.Options) > 0 { if len(serviceLang.Options) > 0 {
var options []*bundle.ValueAddPriceOptions var options []*bundle.ValueAddPriceOptions
@ -397,6 +410,10 @@ 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

@ -514,9 +514,8 @@ 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"]; //
int32 quotaType = 5 [json_name = "quotaType"];// string serviceQuota = 5 [json_name = "serviceQuota"];//
int32 quotaValue = 6 [json_name = "quotaValue"];// bool isExpired = 6 [json_name = "isExpired"];//
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

@ -7,8 +7,8 @@ import (
fmt "fmt" fmt "fmt"
math "math" math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
_ "google.golang.org/protobuf/types/descriptorpb"
_ "github.com/mwitkow/go-proto-validators" _ "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 "github.com/mwitkow/go-proto-validators"
) )