Compare commits
2 Commits
c98ee10f9e
...
733691523b
Author | SHA1 | Date |
---|---|---|
Владимир Фёдоров | 733691523b | |
Владимир Фёдоров | 02e18e1618 |
|
@ -119,13 +119,13 @@ message BreadcrumbsRsp {
|
|||
|
||||
message OrderReq {
|
||||
Order order = 1;
|
||||
string name = 2;
|
||||
string phone = 3;
|
||||
}
|
||||
|
||||
message OrderRsp {}
|
||||
|
||||
message Order {
|
||||
string name = 2;
|
||||
string phone = 3;
|
||||
repeated OrderItem items = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ func (s *Server) Order(ctx context.Context, req *proto.OrderReq) (*proto.OrderRs
|
|||
func createOrderText(req *proto.OrderReq, items []*proto.CardItem) (string, error) {
|
||||
buffer := bytes.Buffer{}
|
||||
var orderAmount int64
|
||||
buffer.WriteString(fmt.Sprintf("Заказ от:\n%s\n%s\n", req.Name, req.Phone))
|
||||
buffer.WriteString(fmt.Sprintf("Заказ от:\n%s\n%s\n", req.Order.Name, req.Order.Phone))
|
||||
buffer.WriteString("\n")
|
||||
for _, item := range items {
|
||||
buffer.WriteString(item.Name)
|
||||
|
|
|
@ -318,7 +318,7 @@ func (x *Product) ProtoReflect() protoreflect.Message {
|
|||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use product.ProtoReflect.Descriptor instead.
|
||||
// Deprecated: Use Product.ProtoReflect.Descriptor instead.
|
||||
func (*Product) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
@ -829,8 +829,6 @@ type OrderReq struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Order *Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Phone string `protobuf:"bytes,3,opt,name=phone,proto3" json:"phone,omitempty"`
|
||||
}
|
||||
|
||||
func (x *OrderReq) Reset() {
|
||||
|
@ -872,20 +870,6 @@ func (x *OrderReq) GetOrder() *Order {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *OrderReq) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *OrderReq) GetPhone() string {
|
||||
if x != nil {
|
||||
return x.Phone
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type OrderRsp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -929,6 +913,8 @@ type Order struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Phone string `protobuf:"bytes,3,opt,name=phone,proto3" json:"phone,omitempty"`
|
||||
Items []*OrderItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -964,6 +950,20 @@ func (*Order) Descriptor() ([]byte, []int) {
|
|||
return file_main_proto_rawDescGZIP(), []int{16}
|
||||
}
|
||||
|
||||
func (x *Order) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Order) GetPhone() string {
|
||||
if x != nil {
|
||||
return x.Phone
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Order) GetItems() []*OrderItem {
|
||||
if x != nil {
|
||||
return x.Items
|
||||
|
@ -1314,14 +1314,14 @@ var file_main_proto_rawDesc = []byte{
|
|||
0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65,
|
||||
0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63,
|
||||
0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
|
||||
0x79, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0x5c, 0x0a,
|
||||
0x79, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0x32, 0x0a,
|
||||
0x08, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x05, 0x6f, 0x72, 0x64,
|
||||
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73,
|
||||
0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0x0a, 0x0a, 0x08, 0x4f,
|
||||
0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x33, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72,
|
||||
0x72, 0x22, 0x0a, 0x0a, 0x08, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x5d, 0x0a,
|
||||
0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68,
|
||||
0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65,
|
||||
0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x14, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x40, 0x0a, 0x09,
|
||||
|
@ -1404,7 +1404,7 @@ var file_main_proto_goTypes = []interface{}{
|
|||
(*Category)(nil), // 2: crabs.crm.Category
|
||||
(*GetPositionsReq)(nil), // 3: crabs.crm.GetPositionsReq
|
||||
(*PositionsRsp)(nil), // 4: crabs.crm.PositionsRsp
|
||||
(*Product)(nil), // 5: crabs.crm.product
|
||||
(*Product)(nil), // 5: crabs.crm.Product
|
||||
(*GroupedProduct)(nil), // 6: crabs.crm.GroupedProduct
|
||||
(*Variant)(nil), // 7: crabs.crm.Variant
|
||||
(*Property)(nil), // 8: crabs.crm.Property
|
||||
|
@ -1424,12 +1424,12 @@ var file_main_proto_goTypes = []interface{}{
|
|||
var file_main_proto_depIdxs = []int32{
|
||||
2, // 0: crabs.crm.CatalogRsp.categories:type_name -> crabs.crm.Category
|
||||
2, // 1: crabs.crm.Category.children:type_name -> crabs.crm.Category
|
||||
5, // 2: crabs.crm.PositionsRsp.products:type_name -> crabs.crm.product
|
||||
6, // 3: crabs.crm.product.grouped_products:type_name -> crabs.crm.GroupedProduct
|
||||
7, // 4: crabs.crm.product.variants:type_name -> crabs.crm.Variant
|
||||
9, // 5: crabs.crm.product.characteristics:type_name -> crabs.crm.Characteristic
|
||||
5, // 2: crabs.crm.PositionsRsp.products:type_name -> crabs.crm.Product
|
||||
6, // 3: crabs.crm.Product.grouped_products:type_name -> crabs.crm.GroupedProduct
|
||||
7, // 4: crabs.crm.Product.variants:type_name -> crabs.crm.Variant
|
||||
9, // 5: crabs.crm.Product.characteristics:type_name -> crabs.crm.Characteristic
|
||||
8, // 6: crabs.crm.Variant.properties:type_name -> crabs.crm.Property
|
||||
5, // 7: crabs.crm.ProductRsp.product:type_name -> crabs.crm.product
|
||||
5, // 7: crabs.crm.ProductRsp.product:type_name -> crabs.crm.Product
|
||||
2, // 8: crabs.crm.BreadcrumbsRsp.categories:type_name -> crabs.crm.Category
|
||||
16, // 9: crabs.crm.OrderReq.order:type_name -> crabs.crm.Order
|
||||
17, // 10: crabs.crm.Order.items:type_name -> crabs.crm.OrderItem
|
||||
|
|
|
@ -205,10 +205,6 @@ func local_request_CRM_GetBreadcrumbs_0(ctx context.Context, marshaler runtime.M
|
|||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_CRM_Order_0 = &utilities.DoubleArray{Encoding: map[string]int{"order": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
|
||||
func request_CRM_Order_0(ctx context.Context, marshaler runtime.Marshaler, client CRMClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq OrderReq
|
||||
var metadata runtime.ServerMetadata
|
||||
|
@ -217,13 +213,6 @@ func request_CRM_Order_0(ctx context.Context, marshaler runtime.Marshaler, clien
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CRM_Order_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.Order(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
|
@ -237,13 +226,6 @@ func local_request_CRM_Order_0(ctx context.Context, marshaler runtime.Marshaler,
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CRM_Order_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.Order(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
|
|
|
@ -130,18 +130,6 @@
|
|||
"schema": {
|
||||
"$ref": "#/definitions/crabscrmOrder"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "phone",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
|
@ -216,6 +204,12 @@
|
|||
"crabscrmOrder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
Loading…
Reference in New Issue