This commit is contained in:
2026-09-24 08:34:32 +08:00
parent 9b876701c3
commit e5fff985cf
15 changed files with 616 additions and 55 deletions
+4 -10
View File
@@ -145,18 +145,12 @@ var (
ErrorWecomHttpError = NewError(994, "企业微信请求失败")
// 参数类
ErrorDefaultError = NewError(10004, "默认地址不能删除")
ErrorJwtExpired = NewError(10005, "jwt过期")
ErrorMissingProjectId = NewError(10006, "缺少权限项目ID")
ErrorMissingIdentification = NewError(10007, "缺少权限标识")
ErrorEncryptMissingKey = NewError(10010, "加密密钥错误")
ErrorDecryptAesError = NewError(10012, "解密失败")
ErrorEncryptAesKeyError = NewError(10013, "AESKey失败")
ErrorEncryptBase64Error = NewError(10014, "解码失败")
ErrorNameInexistence = NewError(10015, "账号不存在")
ErrorEncryptMissingKey = NewError(10010, "加密密钥错误")
ErrorDecryptAesError = NewError(10012, "解密失败")
ErrorEncryptAesKeyError = NewError(10013, "AESKey失败")
ErrorEncryptBase64Error = NewError(10014, "解码失败")
// ErrorNotFund 数据类
ErrorNoChange = NewError(11002, "没有改变")
ErrorRepeatPayment = NewError(11005, "不能重复支付")
ErrorNotSufficientFunds = NewError(11006, "余额不足")
ErrorSaleLevel = NewError(11007, "有下级销售,不允许修改")
Binary file not shown.
+26
View File
@@ -204,6 +204,20 @@ message ApiSupplyRequest {
repeated string images = 4;
}
message WebSaleItemsRequest {
int32 page = 1;
int32 size = 2;
string name = 3;
int64 sale_id = 4;
repeated string time = 5;
}
message WebStoreItemsRequest {
int32 page = 1;
int32 size = 2;
string name = 3;
repeated string time = 4;
}
message StatusRequest {
int64 id = 1;
@@ -365,4 +379,16 @@ service order {
body: "*"
};
};
rpc WebSaleItems(WebSaleItemsRequest) returns(Response){
option (google.api.http) = {
post: "/api/v3/order/sale/items"
body: "*"
};
};
rpc WebStoreItems(WebStoreItemsRequest) returns(Response){
option (google.api.http) = {
post: "/api/v3/order/store/items"
body: "*"
};
};
}
+206 -43
View File
@@ -1934,6 +1934,150 @@ func (x *ApiSupplyRequest) GetImages() []string {
return nil
}
type WebSaleItemsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
SaleId int64 `protobuf:"varint,4,opt,name=sale_id,json=saleId,proto3" json:"sale_id,omitempty"`
Time []string `protobuf:"bytes,5,rep,name=time,proto3" json:"time,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *WebSaleItemsRequest) Reset() {
*x = WebSaleItemsRequest{}
mi := &file_order_order_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *WebSaleItemsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WebSaleItemsRequest) ProtoMessage() {}
func (x *WebSaleItemsRequest) ProtoReflect() protoreflect.Message {
mi := &file_order_order_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WebSaleItemsRequest.ProtoReflect.Descriptor instead.
func (*WebSaleItemsRequest) Descriptor() ([]byte, []int) {
return file_order_order_proto_rawDescGZIP(), []int{28}
}
func (x *WebSaleItemsRequest) GetPage() int32 {
if x != nil {
return x.Page
}
return 0
}
func (x *WebSaleItemsRequest) GetSize() int32 {
if x != nil {
return x.Size
}
return 0
}
func (x *WebSaleItemsRequest) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *WebSaleItemsRequest) GetSaleId() int64 {
if x != nil {
return x.SaleId
}
return 0
}
func (x *WebSaleItemsRequest) GetTime() []string {
if x != nil {
return x.Time
}
return nil
}
type WebStoreItemsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Time []string `protobuf:"bytes,4,rep,name=time,proto3" json:"time,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *WebStoreItemsRequest) Reset() {
*x = WebStoreItemsRequest{}
mi := &file_order_order_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *WebStoreItemsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WebStoreItemsRequest) ProtoMessage() {}
func (x *WebStoreItemsRequest) ProtoReflect() protoreflect.Message {
mi := &file_order_order_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WebStoreItemsRequest.ProtoReflect.Descriptor instead.
func (*WebStoreItemsRequest) Descriptor() ([]byte, []int) {
return file_order_order_proto_rawDescGZIP(), []int{29}
}
func (x *WebStoreItemsRequest) GetPage() int32 {
if x != nil {
return x.Page
}
return 0
}
func (x *WebStoreItemsRequest) GetSize() int32 {
if x != nil {
return x.Size
}
return 0
}
func (x *WebStoreItemsRequest) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *WebStoreItemsRequest) GetTime() []string {
if x != nil {
return x.Time
}
return nil
}
type StatusRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
@@ -1945,7 +2089,7 @@ type StatusRequest struct {
func (x *StatusRequest) Reset() {
*x = StatusRequest{}
mi := &file_order_order_proto_msgTypes[28]
mi := &file_order_order_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1957,7 +2101,7 @@ func (x *StatusRequest) String() string {
func (*StatusRequest) ProtoMessage() {}
func (x *StatusRequest) ProtoReflect() protoreflect.Message {
mi := &file_order_order_proto_msgTypes[28]
mi := &file_order_order_proto_msgTypes[30]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1970,7 +2114,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.
func (*StatusRequest) Descriptor() ([]byte, []int) {
return file_order_order_proto_rawDescGZIP(), []int{28}
return file_order_order_proto_rawDescGZIP(), []int{30}
}
func (x *StatusRequest) GetId() int64 {
@@ -2007,7 +2151,7 @@ type SupplyItemsRequest struct {
func (x *SupplyItemsRequest) Reset() {
*x = SupplyItemsRequest{}
mi := &file_order_order_proto_msgTypes[29]
mi := &file_order_order_proto_msgTypes[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2019,7 +2163,7 @@ func (x *SupplyItemsRequest) String() string {
func (*SupplyItemsRequest) ProtoMessage() {}
func (x *SupplyItemsRequest) ProtoReflect() protoreflect.Message {
mi := &file_order_order_proto_msgTypes[29]
mi := &file_order_order_proto_msgTypes[31]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2032,7 +2176,7 @@ func (x *SupplyItemsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SupplyItemsRequest.ProtoReflect.Descriptor instead.
func (*SupplyItemsRequest) Descriptor() ([]byte, []int) {
return file_order_order_proto_rawDescGZIP(), []int{29}
return file_order_order_proto_rawDescGZIP(), []int{31}
}
func (x *SupplyItemsRequest) GetPage() int32 {
@@ -2229,7 +2373,18 @@ const file_order_order_proto_rawDesc = "" +
"\border_sn\x18\x01 \x01(\tR\aorderSn\x12\x12\n" +
"\x04info\x18\x02 \x01(\tR\x04info\x12\x16\n" +
"\x06reason\x18\x03 \x01(\tR\x06reason\x12\x16\n" +
"\x06images\x18\x04 \x03(\tR\x06images\"O\n" +
"\x06images\x18\x04 \x03(\tR\x06images\"~\n" +
"\x13WebSaleItemsRequest\x12\x12\n" +
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x12\n" +
"\x04size\x18\x02 \x01(\x05R\x04size\x12\x12\n" +
"\x04name\x18\x03 \x01(\tR\x04name\x12\x17\n" +
"\asale_id\x18\x04 \x01(\x03R\x06saleId\x12\x12\n" +
"\x04time\x18\x05 \x03(\tR\x04time\"f\n" +
"\x14WebStoreItemsRequest\x12\x12\n" +
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x12\n" +
"\x04size\x18\x02 \x01(\x05R\x04size\x12\x12\n" +
"\x04name\x18\x03 \x01(\tR\x04name\x12\x12\n" +
"\x04time\x18\x04 \x03(\tR\x04time\"O\n" +
"\rStatusRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" +
"\x06status\x18\x02 \x01(\x05R\x06status\x12\x16\n" +
@@ -2239,7 +2394,7 @@ const file_order_order_proto_rawDesc = "" +
"\x04size\x18\x02 \x01(\x05R\x04size\x12\x19\n" +
"\border_sn\x18\x03 \x01(\tR\aorderSn\x12\x12\n" +
"\x04time\x18\x04 \x03(\tR\x04time\x12\x16\n" +
"\x06status\x18\x05 \x01(\x05R\x06status2\x8f\x13\n" +
"\x06status\x18\x05 \x01(\x05R\x06status2\xd6\x14\n" +
"\x05order\x12T\n" +
"\x05Items\x12\x18.order.OrderItemsRequest\x1a\x0f.order.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/order/items\x12^\n" +
"\vAddressItem\x12\x1a.order.AddressItemsRequest\x1a\x0f.order.Response\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\x12\x17/admin/v3/address/items\x12n\n" +
@@ -2266,7 +2421,9 @@ const file_order_order_proto_rawDesc = "" +
"\x0eWebAddressInfo\x12\x17.order.IdAndTypeRequest\x1a\x0f.order.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\x12\x14/api/v3/address/info\x12X\n" +
"\x0fWebAddressItems\x12\x12.order.TypeRequest\x1a\x0f.order.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/api/v3/address/items\x12G\n" +
"\aWebCart\x12\x12.order.CartRequest\x1a\x0f.order.Response\"\x17\x82\xd3\xe4\x93\x02\x11:\x01*\x12\f/api/v3/cart\x12T\n" +
"\vWebCartEdit\x12\x16.order.EditCartRequest\x1a\x0f.order.Response\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/api/v3/cart/editB\x19Z\x17lone-services/rpc/orderb\x06proto3"
"\vWebCartEdit\x12\x16.order.EditCartRequest\x1a\x0f.order.Response\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/api/v3/cart/edit\x12`\n" +
"\fWebSaleItems\x12\x1a.order.WebSaleItemsRequest\x1a\x0f.order.Response\"#\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/api/v3/order/sale/items\x12c\n" +
"\rWebStoreItems\x12\x1b.order.WebStoreItemsRequest\x1a\x0f.order.Response\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/api/v3/order/store/itemsB\x19Z\x17lone-services/rpc/orderb\x06proto3"
var (
file_order_order_proto_rawDescOnce sync.Once
@@ -2280,7 +2437,7 @@ func file_order_order_proto_rawDescGZIP() []byte {
return file_order_order_proto_rawDescData
}
var file_order_order_proto_msgTypes = make([]protoimpl.MessageInfo, 30)
var file_order_order_proto_msgTypes = make([]protoimpl.MessageInfo, 32)
var file_order_order_proto_goTypes = []any{
(*OrderItemsRequest)(nil), // 0: order.OrderItemsRequest
(*Response)(nil), // 1: order.Response
@@ -2310,8 +2467,10 @@ var file_order_order_proto_goTypes = []any{
(*OrderInfoResponse)(nil), // 25: order.OrderInfoResponse
(*ProductItemsResponse)(nil), // 26: order.ProductItemsResponse
(*ApiSupplyRequest)(nil), // 27: order.ApiSupplyRequest
(*StatusRequest)(nil), // 28: order.StatusRequest
(*SupplyItemsRequest)(nil), // 29: order.SupplyItemsRequest
(*WebSaleItemsRequest)(nil), // 28: order.WebSaleItemsRequest
(*WebStoreItemsRequest)(nil), // 29: order.WebStoreItemsRequest
(*StatusRequest)(nil), // 30: order.StatusRequest
(*SupplyItemsRequest)(nil), // 31: order.SupplyItemsRequest
}
var file_order_order_proto_depIdxs = []int32{
26, // 0: order.OrderInfoResponse.product_items:type_name -> order.ProductItemsResponse
@@ -2323,8 +2482,8 @@ var file_order_order_proto_depIdxs = []int32{
17, // 6: order.order.OrderCreate:input_type -> order.AdminCreateOrderRequest
0, // 7: order.order.OrderDown:input_type -> order.OrderItemsRequest
9, // 8: order.order.OrderInfo:input_type -> order.IdRequest
29, // 9: order.order.SupplyItems:input_type -> order.SupplyItemsRequest
28, // 10: order.order.SupplyStatus:input_type -> order.StatusRequest
31, // 9: order.order.SupplyItems:input_type -> order.SupplyItemsRequest
30, // 10: order.order.SupplyStatus:input_type -> order.StatusRequest
23, // 11: order.order.UpdateAddressSaleInfo:input_type -> order.UpdateAddressSaleInfoRequest
18, // 12: order.order.UpdateOrderDeliverStatus:input_type -> order.UpdateOrderDeliverStatusRequest
24, // 13: order.order.GetOrderInfo:input_type -> order.GetOrderInfoRequest
@@ -2341,34 +2500,38 @@ var file_order_order_proto_depIdxs = []int32{
12, // 24: order.order.WebAddressItems:input_type -> order.TypeRequest
8, // 25: order.order.WebCart:input_type -> order.CartRequest
7, // 26: order.order.WebCartEdit:input_type -> order.EditCartRequest
1, // 27: order.order.Items:output_type -> order.Response
1, // 28: order.order.AddressItem:output_type -> order.Response
1, // 29: order.order.AddressByStore:output_type -> order.Response
1, // 30: order.order.OrderAuditingItems:output_type -> order.Response
1, // 31: order.order.OrderAuditing:output_type -> order.Response
1, // 32: order.order.OrderCreate:output_type -> order.Response
2, // 33: order.order.OrderDown:output_type -> order.ExcelExportResponse
1, // 34: order.order.OrderInfo:output_type -> order.Response
1, // 35: order.order.SupplyItems:output_type -> order.Response
1, // 36: order.order.SupplyStatus:output_type -> order.Response
22, // 37: order.order.UpdateAddressSaleInfo:output_type -> order.UpdateAddressSaleInfoResponse
21, // 38: order.order.UpdateOrderDeliverStatus:output_type -> order.UpdateOrderDeliverStatusResponse
25, // 39: order.order.GetOrderInfo:output_type -> order.OrderInfoResponse
20, // 40: order.order.UpdateOrderPayStatus:output_type -> order.UpdateOrderPayStatusResponse
1, // 41: order.order.ApiSupply:output_type -> order.Response
1, // 42: order.order.ApiSupplyInfo:output_type -> order.Response
1, // 43: order.order.WebCreate:output_type -> order.Response
1, // 44: order.order.WebCreateOne:output_type -> order.Response
1, // 45: order.order.WebAddressCreate:output_type -> order.Response
1, // 46: order.order.WebAddressEdit:output_type -> order.Response
1, // 47: order.order.WebAddressDel:output_type -> order.Response
1, // 48: order.order.WebAddressDef:output_type -> order.Response
1, // 49: order.order.WebAddressInfo:output_type -> order.Response
1, // 50: order.order.WebAddressItems:output_type -> order.Response
1, // 51: order.order.WebCart:output_type -> order.Response
1, // 52: order.order.WebCartEdit:output_type -> order.Response
27, // [27:53] is the sub-list for method output_type
1, // [1:27] is the sub-list for method input_type
28, // 27: order.order.WebSaleItems:input_type -> order.WebSaleItemsRequest
29, // 28: order.order.WebStoreItems:input_type -> order.WebStoreItemsRequest
1, // 29: order.order.Items:output_type -> order.Response
1, // 30: order.order.AddressItem:output_type -> order.Response
1, // 31: order.order.AddressByStore:output_type -> order.Response
1, // 32: order.order.OrderAuditingItems:output_type -> order.Response
1, // 33: order.order.OrderAuditing:output_type -> order.Response
1, // 34: order.order.OrderCreate:output_type -> order.Response
2, // 35: order.order.OrderDown:output_type -> order.ExcelExportResponse
1, // 36: order.order.OrderInfo:output_type -> order.Response
1, // 37: order.order.SupplyItems:output_type -> order.Response
1, // 38: order.order.SupplyStatus:output_type -> order.Response
22, // 39: order.order.UpdateAddressSaleInfo:output_type -> order.UpdateAddressSaleInfoResponse
21, // 40: order.order.UpdateOrderDeliverStatus:output_type -> order.UpdateOrderDeliverStatusResponse
25, // 41: order.order.GetOrderInfo:output_type -> order.OrderInfoResponse
20, // 42: order.order.UpdateOrderPayStatus:output_type -> order.UpdateOrderPayStatusResponse
1, // 43: order.order.ApiSupply:output_type -> order.Response
1, // 44: order.order.ApiSupplyInfo:output_type -> order.Response
1, // 45: order.order.WebCreate:output_type -> order.Response
1, // 46: order.order.WebCreateOne:output_type -> order.Response
1, // 47: order.order.WebAddressCreate:output_type -> order.Response
1, // 48: order.order.WebAddressEdit:output_type -> order.Response
1, // 49: order.order.WebAddressDel:output_type -> order.Response
1, // 50: order.order.WebAddressDef:output_type -> order.Response
1, // 51: order.order.WebAddressInfo:output_type -> order.Response
1, // 52: order.order.WebAddressItems:output_type -> order.Response
1, // 53: order.order.WebCart:output_type -> order.Response
1, // 54: order.order.WebCartEdit:output_type -> order.Response
1, // 55: order.order.WebSaleItems:output_type -> order.Response
1, // 56: order.order.WebStoreItems:output_type -> order.Response
29, // [29:57] is the sub-list for method output_type
1, // [1:29] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
@@ -2385,7 +2548,7 @@ func file_order_order_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_order_order_proto_rawDesc), len(file_order_order_proto_rawDesc)),
NumEnums: 0,
NumMessages: 30,
NumMessages: 32,
NumExtensions: 0,
NumServices: 1,
},
+76
View File
@@ -45,6 +45,8 @@ const (
Order_WebAddressItems_FullMethodName = "/order.order/WebAddressItems"
Order_WebCart_FullMethodName = "/order.order/WebCart"
Order_WebCartEdit_FullMethodName = "/order.order/WebCartEdit"
Order_WebSaleItems_FullMethodName = "/order.order/WebSaleItems"
Order_WebStoreItems_FullMethodName = "/order.order/WebStoreItems"
)
// OrderClient is the client API for Order service.
@@ -80,6 +82,8 @@ type OrderClient interface {
WebAddressItems(ctx context.Context, in *TypeRequest, opts ...grpc.CallOption) (*Response, error)
WebCart(ctx context.Context, in *CartRequest, opts ...grpc.CallOption) (*Response, error)
WebCartEdit(ctx context.Context, in *EditCartRequest, opts ...grpc.CallOption) (*Response, error)
WebSaleItems(ctx context.Context, in *WebSaleItemsRequest, opts ...grpc.CallOption) (*Response, error)
WebStoreItems(ctx context.Context, in *WebStoreItemsRequest, opts ...grpc.CallOption) (*Response, error)
}
type orderClient struct {
@@ -350,6 +354,26 @@ func (c *orderClient) WebCartEdit(ctx context.Context, in *EditCartRequest, opts
return out, nil
}
func (c *orderClient) WebSaleItems(ctx context.Context, in *WebSaleItemsRequest, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Order_WebSaleItems_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *orderClient) WebStoreItems(ctx context.Context, in *WebStoreItemsRequest, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Order_WebStoreItems_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// OrderServer is the server API for Order service.
// All implementations must embed UnimplementedOrderServer
// for forward compatibility.
@@ -383,6 +407,8 @@ type OrderServer interface {
WebAddressItems(context.Context, *TypeRequest) (*Response, error)
WebCart(context.Context, *CartRequest) (*Response, error)
WebCartEdit(context.Context, *EditCartRequest) (*Response, error)
WebSaleItems(context.Context, *WebSaleItemsRequest) (*Response, error)
WebStoreItems(context.Context, *WebStoreItemsRequest) (*Response, error)
mustEmbedUnimplementedOrderServer()
}
@@ -471,6 +497,12 @@ func (UnimplementedOrderServer) WebCart(context.Context, *CartRequest) (*Respons
func (UnimplementedOrderServer) WebCartEdit(context.Context, *EditCartRequest) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method WebCartEdit not implemented")
}
func (UnimplementedOrderServer) WebSaleItems(context.Context, *WebSaleItemsRequest) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method WebSaleItems not implemented")
}
func (UnimplementedOrderServer) WebStoreItems(context.Context, *WebStoreItemsRequest) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method WebStoreItems not implemented")
}
func (UnimplementedOrderServer) mustEmbedUnimplementedOrderServer() {}
func (UnimplementedOrderServer) testEmbeddedByValue() {}
@@ -960,6 +992,42 @@ func _Order_WebCartEdit_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Order_WebSaleItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(WebSaleItemsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServer).WebSaleItems(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Order_WebSaleItems_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServer).WebSaleItems(ctx, req.(*WebSaleItemsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Order_WebStoreItems_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(WebStoreItemsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServer).WebStoreItems(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Order_WebStoreItems_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServer).WebStoreItems(ctx, req.(*WebStoreItemsRequest))
}
return interceptor(ctx, in, info, handler)
}
// Order_ServiceDesc is the grpc.ServiceDesc for Order service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -1071,6 +1139,14 @@ var Order_ServiceDesc = grpc.ServiceDesc{
MethodName: "WebCartEdit",
Handler: _Order_WebCartEdit_Handler,
},
{
MethodName: "WebSaleItems",
Handler: _Order_WebSaleItems_Handler,
},
{
MethodName: "WebStoreItems",
Handler: _Order_WebStoreItems_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "order/order.proto",
-1
View File
@@ -114,7 +114,6 @@ message ApiSaleAddReq {
int64 district_id = 14;
}
message ApiLowerSaleItemsReq {
int32 page = 1;
int32 size = 2;
+12
View File
@@ -142,6 +142,18 @@ type OrderSaleItems struct {
ProductItems []OrderProducts `gorm:"-" json:"product_items"`
}
type OrderStoreItems struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:order_sn;type:varchar(100);comment:订单号;NOT NULL" json:"order_sn"`
StoreName string `gorm:"column:store_name;type:varchar(50);comment:门店名" json:"store_name"`
TotalPrice float64 `gorm:"column:total_price;type:decimal(10,2);comment:总价;NOT NULL" json:"total_price"`
PayPrice float64 `gorm:"column:pay_price;type:decimal(10,2);comment:实际支付金额" json:"pay_price"`
ProductIds string `gorm:"column:product_ids;type:varchar(150);comment:产品IDs" json:"product_ids"`
SignTime utils.CustomTime `gorm:"column:sign_time;type:datetime;comment:签收时间" json:"sign_time"`
CreateTime utils.CustomTime `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP;comment:订单创建时间" json:"create_time"`
ProductItems []OrderProducts `gorm:"-" json:"product_items"`
}
type OrderAccount struct {
Id int `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:order_sn;type:varchar(100);comment:订单号;NOT NULL" json:"order_sn"`
@@ -0,0 +1,101 @@
package logic
import (
"context"
"lone-services/pkg/modelbase"
"lone-services/pkg/utils"
"lone-services/services/order/internal/dao"
"lone-services/services/order/internal/model"
"strconv"
"lone-services/rpc/order/pb"
"lone-services/services/order/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)
type WebSaleItemsLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
BaseLogic
}
func NewWebSaleItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WebSaleItemsLogic {
return &WebSaleItemsLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *WebSaleItemsLogic) WebSaleItems(in *order.WebSaleItemsRequest) (*order.Response, error) {
adminInfo := utils.GetUserFromCtx(l.ctx)
if adminInfo.ID < utils.NumberOne {
return l.fail(utils.ErrorNoLoginInfo)
}
var info []dao.OrderSaleItems
w := modelbase.Params{
Page: int(in.Page),
Size: int(in.Size),
Order: "id desc",
Eq: map[string]string{"status": utils.StringStatusOk},
}
w.Like = make(map[string]string)
if len(in.Name) > utils.NumberZero {
w.Like["sale_name LIKE ? "] = "%%" + in.Name + "%%"
}
if in.SaleId > utils.NumberZero {
saleInfo, sErr := svc.GetSaleInfo(l.svcCtx.SaleName, in.SaleId)
if sErr != utils.Ok {
return l.fail(sErr)
}
if saleInfo.SaleId != adminInfo.SaleId {
return l.fail(utils.SetError(utils.Fail, "无权限访问"))
}
w.Eq["sale_id"] = strconv.FormatInt(in.SaleId, utils.NumberTen)
} else {
w.Eq["sale_id"] = strconv.FormatInt(adminInfo.ID, utils.NumberTen)
}
if len(in.Time) > utils.NumberOne {
w.Other["create_time > ?"] = in.Time[utils.NumberZero]
w.Other["create_time < ?"] = in.Time[utils.NumberOne]
}
items, err := model.OrderModel{}.Init().Page(w, &info)
if err != nil {
l.Logger.Error(err)
return l.fail(utils.Fail)
}
var orderSn []string
for _, v := range info {
orderSn = append(orderSn, v.OrderSn)
}
if len(orderSn) > utils.NumberZero {
w = modelbase.Params{In: map[string][]string{"order_sn": orderSn}}
var products []dao.OrderProducts
err = model.OrderProductModel{}.Init().Items(w, &products)
if err != nil {
return l.ok(items)
}
tmpProducts := map[string][]dao.OrderProducts{}
for _, v := range products {
tmpProducts[v.OrderSn] = append(tmpProducts[v.OrderSn], v)
}
for key, v := range info {
if val, ok := tmpProducts[v.OrderSn]; ok {
info[key].ProductItems = val
}
}
}
items.Items = info
return l.ok(items)
}
@@ -0,0 +1,76 @@
package logic
import (
"context"
"lone-services/pkg/modelbase"
"lone-services/pkg/utils"
"lone-services/rpc/order/pb"
"lone-services/services/order/internal/dao"
"lone-services/services/order/internal/model"
"lone-services/services/order/internal/svc"
"strconv"
"github.com/zeromicro/go-zero/core/logx"
)
type WebStoreItemsLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
BaseLogic
}
func NewWebStoreItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WebStoreItemsLogic {
return &WebStoreItemsLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *WebStoreItemsLogic) WebStoreItems(in *order.WebStoreItemsRequest) (*order.Response, error) {
adminInfo := utils.GetUserFromCtx(l.ctx)
if adminInfo.ID < utils.NumberOne {
return l.fail(utils.ErrorNoLoginInfo)
}
var info []dao.OrderStoreItems
w := modelbase.Params{
Page: int(in.Page),
Size: int(in.Size),
Order: "id desc",
Eq: map[string]string{"store_id": strconv.FormatInt(adminInfo.ID, utils.NumberTen), "status": utils.StringStatusOk},
}
items, err := model.OrderModel{}.Init().Page(w, &info)
if err != nil {
l.Logger.Error(err)
return l.fail(utils.Fail)
}
var orderSn []string
for _, v := range info {
orderSn = append(orderSn, v.OrderSn)
}
if len(orderSn) > utils.NumberZero {
w = modelbase.Params{In: map[string][]string{"order_sn": orderSn}}
var products []dao.OrderProducts
err = model.OrderProductModel{}.Init().Items(w, &products)
if err != nil {
return l.ok(items)
}
tmpProducts := map[string][]dao.OrderProducts{}
for _, v := range products {
tmpProducts[v.OrderSn] = append(tmpProducts[v.OrderSn], v)
}
for key, v := range info {
if val, ok := tmpProducts[v.OrderSn]; ok {
info[key].ProductItems = val
}
}
}
items.Items = info
return l.ok(items)
}
@@ -155,3 +155,13 @@ func (s *OrderServer) WebCartEdit(ctx context.Context, in *order.EditCartRequest
l := logic.NewWebCartEditLogic(ctx, s.svcCtx)
return l.WebCartEdit(in)
}
func (s *OrderServer) WebSaleItems(ctx context.Context, in *order.WebSaleItemsRequest) (*order.Response, error) {
l := logic.NewWebSaleItemsLogic(ctx, s.svcCtx)
return l.WebSaleItems(in)
}
func (s *OrderServer) WebStoreItems(ctx context.Context, in *order.WebStoreItemsRequest) (*order.Response, error) {
l := logic.NewWebStoreItemsLogic(ctx, s.svcCtx)
return l.WebStoreItems(in)
}
+17 -1
View File
@@ -7,6 +7,7 @@ import (
"lone-services/pkg/utils"
express "lone-services/rpc/express/pb"
product "lone-services/rpc/product/pb"
sale "lone-services/rpc/sale/pb"
"lone-services/services/order/internal/dao"
"math/rand"
"strconv"
@@ -129,5 +130,20 @@ func GetDeliveryInfo(name string, id int64, Type uint8) (*express.DeliveryInfoRe
}
return info, utils.Ok
}
func GetSaleInfo(name string, id int64) (*sale.InfoData, utils.Status) {
cli, err := GetRpcClient(name)
if err != nil {
logx.Errorf("get rpc client err: %v", err)
return nil, utils.Fail
}
client := sale.NewSaleClient(cli.Conn())
info, err := client.InfoInternal(context.Background(), &sale.InfoReq{Id: id})
if err != nil {
logx.Errorf("get products err: %v", err)
return nil, utils.Fail
}
return info, utils.Ok
}
+14
View File
@@ -44,6 +44,8 @@ type (
UpdateOrderDeliverStatusResponse = order.UpdateOrderDeliverStatusResponse
UpdateOrderPayStatusRequest = order.UpdateOrderPayStatusRequest
UpdateOrderPayStatusResponse = order.UpdateOrderPayStatusResponse
WebSaleItemsRequest = order.WebSaleItemsRequest
WebStoreItemsRequest = order.WebStoreItemsRequest
Order interface {
Items(ctx context.Context, in *OrderItemsRequest, opts ...grpc.CallOption) (*Response, error)
@@ -75,6 +77,8 @@ type (
WebAddressItems(ctx context.Context, in *TypeRequest, opts ...grpc.CallOption) (*Response, error)
WebCart(ctx context.Context, in *CartRequest, opts ...grpc.CallOption) (*Response, error)
WebCartEdit(ctx context.Context, in *EditCartRequest, opts ...grpc.CallOption) (*Response, error)
WebSaleItems(ctx context.Context, in *WebSaleItemsRequest, opts ...grpc.CallOption) (*Response, error)
WebStoreItems(ctx context.Context, in *WebStoreItemsRequest, opts ...grpc.CallOption) (*Response, error)
}
defaultOrder struct {
@@ -220,3 +224,13 @@ func (m *defaultOrder) WebCartEdit(ctx context.Context, in *EditCartRequest, opt
client := order.NewOrderClient(m.cli.Conn())
return client.WebCartEdit(ctx, in, opts...)
}
func (m *defaultOrder) WebSaleItems(ctx context.Context, in *WebSaleItemsRequest, opts ...grpc.CallOption) (*Response, error) {
client := order.NewOrderClient(m.cli.Conn())
return client.WebSaleItems(ctx, in, opts...)
}
func (m *defaultOrder) WebStoreItems(ctx context.Context, in *WebStoreItemsRequest, opts ...grpc.CallOption) (*Response, error) {
client := order.NewOrderClient(m.cli.Conn())
return client.WebStoreItems(ctx, in, opts...)
}
@@ -5,6 +5,7 @@ import (
"lone-services/pkg/modelbase"
"lone-services/pkg/utils"
"lone-services/pkg/validate"
"lone-services/pkg/wecomrpc"
"lone-services/services/sale/internal/dao"
"lone-services/services/sale/internal/model"
"lone-services/services/sale/validator"
@@ -159,6 +160,14 @@ func (l *ApiSaleAddLogic) ApiSaleAdd(in *sale.ApiSaleAddReq) (*sale.Response, er
return failResponse(utils.Fail), nil
}
m.Commit()
Time := utils.Now().String()
md5 := utils.MD5Encrypt(strconv.Itoa(int(data.Id)) + data.Name + Time)
wecomrpc.SendMessage(l.ctx, l.svcCtx.WecomSvcName, wecomrpc.SendMessageJob{
BizId: int(data.Id), // 门店ID
BizType: wecomrpc.BizTypeSales,
Type: wecomrpc.ProductSubmitReview,
Key: md5,
})
return okResponse(nil), nil
}
@@ -14,6 +14,7 @@ type ServiceContext struct {
Prefix string
ChoreSvcName string
UserSvcName string
WecomSvcName string
}
func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
@@ -25,6 +26,10 @@ func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
if userSvc == utils.StringEmpty {
logx.Error("config services.user empty")
}
wecomSvc := utils.GetConfigString("services.wecom")
if wecomSvc == utils.StringEmpty {
logx.Error("config services.wecom empty")
}
return &ServiceContext{
Config: c,
@@ -32,5 +37,6 @@ func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
Prefix: utils.GetConfigString("mysql.prefix"),
ChoreSvcName: choreSvc,
UserSvcName: userSvc,
WecomSvcName: wecomSvc,
}
}
+59
View File
@@ -0,0 +1,59 @@
[base]
login_out_time=43200 #api接口超时时间分
login_refresh_out_time=83200
name = "sale-service"
listenOn = "0.0.0.0:10700"
mode = "dev"
[log]
path = "logs"
serviceName = "sale-service"
mode = "file"
encoding = "plain"
level = "info"
keepDays = 7
maxSize = 50
maxBackups = 5
compress = false
[oss]
accessKeyId = "LTAI5t7U8KvxSiPE5auwQUuu"
accessKeySecret = "xjfgbQQRpL4TcIspNuClg6bYADa3pk"
roleArn = "acs:ram::1663896742753915:role/oss-upload"
roleSessionName = "oss-upload"
region = "oss-cn-hangzhou"
bucketName = "lone-images"
endpoint = "https://oss-accelerate.aliyuncs.com"
host = "https://images.ailuowan.com"
dir = "upload/"
expireSeconds = 3600
[mysql]
host = '39.106.171.204'
port = 33066
user = 'root'
password = 'MOLXRZNOU4Y4'
database = 'dms-sale'
charset = 'utf8mb4'
prefix = ''
debug = true
[mysql_read]
host = '39.106.171.204'
port = 33066
user = 'root'
password = 'MOLXRZNOU4Y4'
database = 'dms-sale'
charset = 'utf8mb4'
prefix = ''
[redis]
host = '39.106.171.204'
password = 'lLMLcuPpzSj'
port = 6379
db = 0
[encrypt]
data_key = "u2t9T3luZtoRfhBstkFN6TiIMW38BA8a"
[services]
chore = "chore-service"
user = "user-service"
wecom = "wecom-service"