增加语言表获取接口
This commit is contained in:
parent
52d9baf2e6
commit
3c1984be81
@ -22,6 +22,9 @@ func (b *BundleProvider) BundleListV2(_ context.Context, req *bundle.BundleListR
|
||||
func (b *BundleProvider) BundleDetailV2(_ context.Context, req *bundle.BundleDetailRequest) (res *bundle.BundleDetailResponseV2, err error) {
|
||||
return logic.BundleDetailV2(req)
|
||||
}
|
||||
func (b *BundleProvider) BundleLangDetailV2(_ context.Context, req *bundle.BundleDetailRequest) (res *bundle.BundleProfileLang, err error) {
|
||||
return logic.BundleLangDetailV2(req)
|
||||
}
|
||||
|
||||
// ***************************************************新增值服务***********************
|
||||
func (b *BundleProvider) SaveValueAddService(_ context.Context, req *bundle.ValueAddServiceLang) (res *bundle.SaveResponse, err error) {
|
||||
|
@ -240,9 +240,6 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
|
||||
if req.Uuid == "" {
|
||||
return res, errors.New("缺少套餐UUID")
|
||||
}
|
||||
// if req.Language == "" {
|
||||
// return res, errors.New("language不能为空")
|
||||
// }
|
||||
detail, err := dao.BundleDetailV2(req)
|
||||
if err != nil {
|
||||
return res, errors.New("获取套餐信息失败")
|
||||
@ -288,34 +285,6 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
|
||||
CreatedAt: time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
// 通过中间表拼接增值服务数据
|
||||
// if detail.BundleToValueAddService != nil && len(detail.BundleToValueAddService) > 0 {
|
||||
// for _, valueAddService := range detail.BundleToValueAddService {
|
||||
// valueAddDeatilData, err := dao.ValueAddServiceDetailByUuidAndLanguage(valueAddService.ValueUid, bundleProfileLang.Language)
|
||||
// if err != nil {
|
||||
// return res, err
|
||||
// }
|
||||
//if valueAddService.IsDisplay{}
|
||||
// ValueAddServiceLang := &bundle.ValueAddServiceLang{
|
||||
// Uuid: valueAddDeatilData.UUID,
|
||||
// ServiceName: valueAddDeatilData.ServiceName,
|
||||
// ServiceType: int32(valueAddDeatilData.ServiceType),
|
||||
// PriceMode: int32(valueAddDeatilData.PriceMode),
|
||||
// PriceType: int64(valueAddDeatilData.PriceType),
|
||||
// OriginalPrice: fmt.Sprintf("%.2f", float32(valueAddDeatilData.OriginalPrice)),
|
||||
// Unit: string(valueAddDeatilData.Unit),
|
||||
// Language: valueAddDeatilData.Language,
|
||||
// CreatedAt: time.Unix(valueAddDeatilData.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
// UpdatedAt: time.Unix(valueAddDeatilData.UpdatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
// }
|
||||
//bundleProfileLang.ValueAddServiceLang = append(bundleProfileLang.ValueAddServiceLang, ValueAddServiceLang)
|
||||
// selectValueAddService = append(selectValueAddService, &bundle.SelectValueAddService{
|
||||
// ValueAddUuid: valueAddService.ValueUid,
|
||||
// ServiceName: valueAddDeatilData.ServiceName,
|
||||
// IsDisplay: valueAddService.IsDisplay,
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
bundleProfileLangs = append(bundleProfileLangs, bundleProfileLang)
|
||||
}
|
||||
}
|
||||
@ -328,6 +297,43 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
|
||||
res.Bundle = bundleProfile
|
||||
return
|
||||
}
|
||||
func BundleLangDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleProfileLang, err error) {
|
||||
res = new(bundle.BundleProfileLang)
|
||||
if req.Uuid == "" {
|
||||
return res, errors.New("缺少套餐UUID")
|
||||
}
|
||||
if req.Language == "" {
|
||||
return res, errors.New("language不能为空")
|
||||
}
|
||||
detail, err := dao.BundleDetailV2(req)
|
||||
if err != nil {
|
||||
return res, errors.New("获取套餐信息失败")
|
||||
}
|
||||
lang, err := dao.BundleDetailByUuidAndLanguage(req.Uuid, req.Language)
|
||||
if err != nil {
|
||||
return res, errors.New("获取套餐信息失败")
|
||||
}
|
||||
if detail != nil {
|
||||
res.Uuid = detail.UUID
|
||||
res.ImgOption = int32(detail.ImgOption)
|
||||
res.BgImg1 = detail.BgImg1
|
||||
res.BgImg2 = detail.BgImg2
|
||||
res.FontColor = detail.FontColor
|
||||
res.Sort = detail.Sort
|
||||
res.ShelfStatus = detail.ShelfStatus
|
||||
res.Contract = detail.Contract
|
||||
}
|
||||
if lang != nil {
|
||||
res.Name = lang.Name
|
||||
res.Price = lang.Price
|
||||
res.PriceType = lang.PriceType
|
||||
res.Content = lang.Content
|
||||
res.Language = lang.Language
|
||||
res.CreatedAt = time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05")
|
||||
res.UpdatedAt = time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05")
|
||||
}
|
||||
return
|
||||
}
|
||||
func HandleShelf(req *bundle.HandShelfRequest) (res *bundle.CommonResponse, err error) {
|
||||
res = new(bundle.CommonResponse)
|
||||
if req.Uuid == "" {
|
||||
|
@ -18,6 +18,8 @@ service Bundle {
|
||||
rpc BundleListV2(BundleListRequest) returns(BundleListResponse) {}
|
||||
rpc BundleDetailV2(BundleDetailRequest) returns(BundleDetailResponseV2) {}
|
||||
rpc BundleListH5V2(BundleListRequest) returns(BundleListResponse) {}
|
||||
rpc BundleLangDetailV2(BundleDetailRequest) returns(BundleProfileLang) {}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -250,9 +252,15 @@ message BundleProfileLang {
|
||||
string language = 6 [json_name = "language"];
|
||||
string createdAt = 7 [json_name = "createdAt"];
|
||||
string updatedAt = 8 [json_name = "updatedAt"];
|
||||
//string bgImg1 = 9 [json_name = "bgImg1"];
|
||||
//string bgImg2 = 10 [json_name = "bgImg2"];
|
||||
// int64 sort = 11 [json_name = "sort"];
|
||||
string contract = 9 [json_name = "contract"];
|
||||
string companySign = 10 [json_name = "companySign"];
|
||||
int64 contractDuration = 11 [json_name = "contractDuration"];
|
||||
string fontColor = 12 [json_name = "fontColor"];
|
||||
int64 sort = 13 [json_name = "sort"];
|
||||
string bgImg1 = 14 [json_name = "bgImg1"];
|
||||
string bgImg2 = 15 [json_name = "bgImg2"];
|
||||
int64 shelfStatus = 16 [json_name = "shelfStatus"]; // 1 上架 2 下架
|
||||
int32 imgOption = 17 [json_name = "imgOption"];
|
||||
//repeated ValueAddServiceLang valueAddServiceLang = 12 [json_name = "ValueAddServiceLang"];
|
||||
}
|
||||
message SaveResponse {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,7 @@ type BundleClient interface {
|
||||
BundleListV2(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment)
|
||||
BundleDetailV2(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleDetailResponseV2, common.ErrorWithAttachment)
|
||||
BundleListH5V2(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment)
|
||||
BundleLangDetailV2(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleProfileLang, common.ErrorWithAttachment)
|
||||
BundleList(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment)
|
||||
BundleDetail(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleDetailResponse, common.ErrorWithAttachment)
|
||||
CreateOrderRecord(ctx context.Context, in *OrderCreateRecord, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
@ -94,6 +95,7 @@ type BundleClientImpl struct {
|
||||
BundleListV2 func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetailV2 func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponseV2, error)
|
||||
BundleListH5V2 func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleLangDetailV2 func(ctx context.Context, in *BundleDetailRequest) (*BundleProfileLang, error)
|
||||
BundleList func(ctx context.Context, in *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetail func(ctx context.Context, in *BundleDetailRequest) (*BundleDetailResponse, error)
|
||||
CreateOrderRecord func(ctx context.Context, in *OrderCreateRecord) (*CommonResponse, error)
|
||||
@ -194,6 +196,12 @@ func (c *bundleClient) BundleListH5V2(ctx context.Context, in *BundleListRequest
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleListH5V2", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) BundleLangDetailV2(ctx context.Context, in *BundleDetailRequest, opts ...grpc_go.CallOption) (*BundleProfileLang, common.ErrorWithAttachment) {
|
||||
out := new(BundleProfileLang)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleLangDetailV2", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) BundleList(ctx context.Context, in *BundleListRequest, opts ...grpc_go.CallOption) (*BundleListResponse, common.ErrorWithAttachment) {
|
||||
out := new(BundleListResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -434,6 +442,7 @@ type BundleServer interface {
|
||||
BundleListV2(context.Context, *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetailV2(context.Context, *BundleDetailRequest) (*BundleDetailResponseV2, error)
|
||||
BundleListH5V2(context.Context, *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleLangDetailV2(context.Context, *BundleDetailRequest) (*BundleProfileLang, error)
|
||||
BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error)
|
||||
BundleDetail(context.Context, *BundleDetailRequest) (*BundleDetailResponse, error)
|
||||
CreateOrderRecord(context.Context, *OrderCreateRecord) (*CommonResponse, error)
|
||||
@ -509,6 +518,9 @@ func (UnimplementedBundleServer) BundleDetailV2(context.Context, *BundleDetailRe
|
||||
func (UnimplementedBundleServer) BundleListH5V2(context.Context, *BundleListRequest) (*BundleListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleListH5V2 not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) BundleLangDetailV2(context.Context, *BundleDetailRequest) (*BundleProfileLang, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleLangDetailV2 not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) BundleList(context.Context, *BundleListRequest) (*BundleListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleList not implemented")
|
||||
}
|
||||
@ -883,6 +895,35 @@ func _Bundle_BundleListH5V2_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_BundleLangDetailV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BundleDetailRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("BundleLangDetailV2", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_BundleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BundleListRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -2024,6 +2065,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "BundleListH5V2",
|
||||
Handler: _Bundle_BundleListH5V2_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BundleLangDetailV2",
|
||||
Handler: _Bundle_BundleLangDetailV2_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BundleList",
|
||||
Handler: _Bundle_BundleList_Handler,
|
||||
|
Loading…
Reference in New Issue
Block a user