fix: wecom types agent
CI / changes (push) Successful in 12s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / bff (push) Successful in 3s
CI / chore (push) Successful in 0s
CI / express (push) Successful in 0s
CI / product (push) Successful in 1s
CI / sale (push) Successful in 0s
CI / user (push) Successful in 0s
CI / wecom (push) Successful in 31s

This commit is contained in:
zzw
2026-08-31 14:22:46 +08:00
parent 90a195c9ca
commit 1d41d7ca7e
15 changed files with 349 additions and 48 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ rpc/scripts/gen-rpc.sh order
4.增加 etc/order.yaml 配置文件 4.增加 etc/order.yaml 配置文件
5.Dockerfile 文件 5.Dockerfile 文件
6.changes 里的 SERVICES="..." 6.changes 里的 SERVICES="..."
docker.strategy.matrix.include 加一行 { name: xxx, dockerfile: services/xxx/Dockerfile } matrix.name 加一行 order
``` ```
+84 -39
View File
@@ -82,20 +82,56 @@ func (x *Response) GetData() string {
return "" return ""
} }
type EmptyReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *EmptyReq) Reset() {
*x = EmptyReq{}
mi := &file_wecom_wecom_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *EmptyReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EmptyReq) ProtoMessage() {}
func (x *EmptyReq) ProtoReflect() protoreflect.Message {
mi := &file_wecom_wecom_proto_msgTypes[1]
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 EmptyReq.ProtoReflect.Descriptor instead.
func (*EmptyReq) Descriptor() ([]byte, []int) {
return file_wecom_wecom_proto_rawDescGZIP(), []int{1}
}
type ItemsUserReq struct { type ItemsUserReq struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Page uint32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Page uint32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Type uint32 `protobuf:"varint,4,opt,name=type,proto3" json:"type,omitempty"` // 1: 管理员,2: 销售 Type uint32 `protobuf:"varint,4,opt,name=type,proto3" json:"type,omitempty"`
Status uint32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` // 1: 启用,2: 禁用 Status uint32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *ItemsUserReq) Reset() { func (x *ItemsUserReq) Reset() {
*x = ItemsUserReq{} *x = ItemsUserReq{}
mi := &file_wecom_wecom_proto_msgTypes[1] mi := &file_wecom_wecom_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -107,7 +143,7 @@ func (x *ItemsUserReq) String() string {
func (*ItemsUserReq) ProtoMessage() {} func (*ItemsUserReq) ProtoMessage() {}
func (x *ItemsUserReq) ProtoReflect() protoreflect.Message { func (x *ItemsUserReq) ProtoReflect() protoreflect.Message {
mi := &file_wecom_wecom_proto_msgTypes[1] mi := &file_wecom_wecom_proto_msgTypes[2]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -120,7 +156,7 @@ func (x *ItemsUserReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use ItemsUserReq.ProtoReflect.Descriptor instead. // Deprecated: Use ItemsUserReq.ProtoReflect.Descriptor instead.
func (*ItemsUserReq) Descriptor() ([]byte, []int) { func (*ItemsUserReq) Descriptor() ([]byte, []int) {
return file_wecom_wecom_proto_rawDescGZIP(), []int{1} return file_wecom_wecom_proto_rawDescGZIP(), []int{2}
} }
func (x *ItemsUserReq) GetPage() uint32 { func (x *ItemsUserReq) GetPage() uint32 {
@@ -172,7 +208,7 @@ type CreateUserReq struct {
func (x *CreateUserReq) Reset() { func (x *CreateUserReq) Reset() {
*x = CreateUserReq{} *x = CreateUserReq{}
mi := &file_wecom_wecom_proto_msgTypes[2] mi := &file_wecom_wecom_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -184,7 +220,7 @@ func (x *CreateUserReq) String() string {
func (*CreateUserReq) ProtoMessage() {} func (*CreateUserReq) ProtoMessage() {}
func (x *CreateUserReq) ProtoReflect() protoreflect.Message { func (x *CreateUserReq) ProtoReflect() protoreflect.Message {
mi := &file_wecom_wecom_proto_msgTypes[2] mi := &file_wecom_wecom_proto_msgTypes[3]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -197,7 +233,7 @@ func (x *CreateUserReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateUserReq.ProtoReflect.Descriptor instead. // Deprecated: Use CreateUserReq.ProtoReflect.Descriptor instead.
func (*CreateUserReq) Descriptor() ([]byte, []int) { func (*CreateUserReq) Descriptor() ([]byte, []int) {
return file_wecom_wecom_proto_rawDescGZIP(), []int{2} return file_wecom_wecom_proto_rawDescGZIP(), []int{3}
} }
func (x *CreateUserReq) GetUserId() int64 { func (x *CreateUserReq) GetUserId() int64 {
@@ -257,7 +293,7 @@ type UpdateUserReq struct {
func (x *UpdateUserReq) Reset() { func (x *UpdateUserReq) Reset() {
*x = UpdateUserReq{} *x = UpdateUserReq{}
mi := &file_wecom_wecom_proto_msgTypes[3] mi := &file_wecom_wecom_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -269,7 +305,7 @@ func (x *UpdateUserReq) String() string {
func (*UpdateUserReq) ProtoMessage() {} func (*UpdateUserReq) ProtoMessage() {}
func (x *UpdateUserReq) ProtoReflect() protoreflect.Message { func (x *UpdateUserReq) ProtoReflect() protoreflect.Message {
mi := &file_wecom_wecom_proto_msgTypes[3] mi := &file_wecom_wecom_proto_msgTypes[4]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -282,7 +318,7 @@ func (x *UpdateUserReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead. // Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead.
func (*UpdateUserReq) Descriptor() ([]byte, []int) { func (*UpdateUserReq) Descriptor() ([]byte, []int) {
return file_wecom_wecom_proto_rawDescGZIP(), []int{3} return file_wecom_wecom_proto_rawDescGZIP(), []int{4}
} }
func (x *UpdateUserReq) GetId() int64 { func (x *UpdateUserReq) GetId() int64 {
@@ -344,7 +380,7 @@ type StatusUserReq struct {
func (x *StatusUserReq) Reset() { func (x *StatusUserReq) Reset() {
*x = StatusUserReq{} *x = StatusUserReq{}
mi := &file_wecom_wecom_proto_msgTypes[4] mi := &file_wecom_wecom_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -356,7 +392,7 @@ func (x *StatusUserReq) String() string {
func (*StatusUserReq) ProtoMessage() {} func (*StatusUserReq) ProtoMessage() {}
func (x *StatusUserReq) ProtoReflect() protoreflect.Message { func (x *StatusUserReq) ProtoReflect() protoreflect.Message {
mi := &file_wecom_wecom_proto_msgTypes[4] mi := &file_wecom_wecom_proto_msgTypes[5]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -369,7 +405,7 @@ func (x *StatusUserReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use StatusUserReq.ProtoReflect.Descriptor instead. // Deprecated: Use StatusUserReq.ProtoReflect.Descriptor instead.
func (*StatusUserReq) Descriptor() ([]byte, []int) { func (*StatusUserReq) Descriptor() ([]byte, []int) {
return file_wecom_wecom_proto_rawDescGZIP(), []int{4} return file_wecom_wecom_proto_rawDescGZIP(), []int{5}
} }
func (x *StatusUserReq) GetId() int64 { func (x *StatusUserReq) GetId() int64 {
@@ -395,7 +431,7 @@ type DeleteUserReq struct {
func (x *DeleteUserReq) Reset() { func (x *DeleteUserReq) Reset() {
*x = DeleteUserReq{} *x = DeleteUserReq{}
mi := &file_wecom_wecom_proto_msgTypes[5] mi := &file_wecom_wecom_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -407,7 +443,7 @@ func (x *DeleteUserReq) String() string {
func (*DeleteUserReq) ProtoMessage() {} func (*DeleteUserReq) ProtoMessage() {}
func (x *DeleteUserReq) ProtoReflect() protoreflect.Message { func (x *DeleteUserReq) ProtoReflect() protoreflect.Message {
mi := &file_wecom_wecom_proto_msgTypes[5] mi := &file_wecom_wecom_proto_msgTypes[6]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -420,7 +456,7 @@ func (x *DeleteUserReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteUserReq.ProtoReflect.Descriptor instead. // Deprecated: Use DeleteUserReq.ProtoReflect.Descriptor instead.
func (*DeleteUserReq) Descriptor() ([]byte, []int) { func (*DeleteUserReq) Descriptor() ([]byte, []int) {
return file_wecom_wecom_proto_rawDescGZIP(), []int{5} return file_wecom_wecom_proto_rawDescGZIP(), []int{6}
} }
func (x *DeleteUserReq) GetId() int64 { func (x *DeleteUserReq) GetId() int64 {
@@ -438,7 +474,9 @@ const file_wecom_wecom_proto_rawDesc = "" +
"\bResponse\x12\x12\n" + "\bResponse\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x10\n" + "\x04code\x18\x01 \x01(\x05R\x04code\x12\x10\n" +
"\x03msg\x18\x02 \x01(\tR\x03msg\x12\x12\n" + "\x03msg\x18\x02 \x01(\tR\x03msg\x12\x12\n" +
"\x04data\x18\x03 \x01(\tR\x04data\"\x7f\n" + "\x04data\x18\x03 \x01(\tR\x04data\"\n" +
"\n" +
"\bEmptyReq\"\x7f\n" +
"\fItemsUserReq\x12\x12\n" + "\fItemsUserReq\x12\x12\n" +
"\x04page\x18\x01 \x01(\rR\x04page\x12\x1b\n" + "\x04page\x18\x01 \x01(\rR\x04page\x12\x1b\n" +
"\tpage_size\x18\x02 \x01(\rR\bpageSize\x12\x12\n" + "\tpage_size\x18\x02 \x01(\rR\bpageSize\x12\x12\n" +
@@ -464,7 +502,7 @@ const file_wecom_wecom_proto_rawDesc = "" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" +
"\x06status\x18\x02 \x01(\rR\x06status\"\x1f\n" + "\x06status\x18\x02 \x01(\rR\x06status\"\x1f\n" +
"\rDeleteUserReq\x12\x0e\n" + "\rDeleteUserReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id2\xc2\x03\n" + "\x02id\x18\x01 \x01(\x03R\x02id2\xe2\x04\n" +
"\x05Wecom\x12S\n" + "\x05Wecom\x12S\n" +
"\n" + "\n" +
"ItemsUsers\x12\x13.wecom.ItemsUserReq\x1a\x0f.wecom.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\x12\x14/admin/v3/wecom/user\x12T\n" + "ItemsUsers\x12\x13.wecom.ItemsUserReq\x1a\x0f.wecom.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\x12\x14/admin/v3/wecom/user\x12T\n" +
@@ -475,7 +513,9 @@ const file_wecom_wecom_proto_rawDesc = "" +
"\n" + "\n" +
"StatusUser\x12\x14.wecom.StatusUserReq\x1a\x0f.wecom.Response\"&\x82\xd3\xe4\x93\x02 :\x01*\x1a\x1b/admin/v3/wecom/user/status\x12[\n" + "StatusUser\x12\x14.wecom.StatusUserReq\x1a\x0f.wecom.Response\"&\x82\xd3\xe4\x93\x02 :\x01*\x1a\x1b/admin/v3/wecom/user/status\x12[\n" +
"\n" + "\n" +
"DeleteUser\x12\x14.wecom.DeleteUserReq\x1a\x0f.wecom.Response\"&\x82\xd3\xe4\x93\x02 :\x01*\x1a\x1b/admin/v3/wecom/user/deleteB\x19Z\x17lone-services/rpc/wecomb\x06proto3" "DeleteUser\x12\x14.wecom.DeleteUserReq\x1a\x0f.wecom.Response\"&\x82\xd3\xe4\x93\x02 :\x01*\x1a\x1b/admin/v3/wecom/user/delete\x12Q\n" +
"\vItemsAgents\x12\x0f.wecom.EmptyReq\x1a\x0f.wecom.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/wecom/agent\x12K\n" +
"\x05Types\x12\x0f.wecom.EmptyReq\x1a\x0f.wecom.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/wecom/typesB\x19Z\x17lone-services/rpc/wecomb\x06proto3"
var ( var (
file_wecom_wecom_proto_rawDescOnce sync.Once file_wecom_wecom_proto_rawDescOnce sync.Once
@@ -489,28 +529,33 @@ func file_wecom_wecom_proto_rawDescGZIP() []byte {
return file_wecom_wecom_proto_rawDescData return file_wecom_wecom_proto_rawDescData
} }
var file_wecom_wecom_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_wecom_wecom_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_wecom_wecom_proto_goTypes = []any{ var file_wecom_wecom_proto_goTypes = []any{
(*Response)(nil), // 0: wecom.Response (*Response)(nil), // 0: wecom.Response
(*ItemsUserReq)(nil), // 1: wecom.ItemsUserReq (*EmptyReq)(nil), // 1: wecom.EmptyReq
(*CreateUserReq)(nil), // 2: wecom.CreateUserReq (*ItemsUserReq)(nil), // 2: wecom.ItemsUserReq
(*UpdateUserReq)(nil), // 3: wecom.UpdateUserReq (*CreateUserReq)(nil), // 3: wecom.CreateUserReq
(*StatusUserReq)(nil), // 4: wecom.StatusUserReq (*UpdateUserReq)(nil), // 4: wecom.UpdateUserReq
(*DeleteUserReq)(nil), // 5: wecom.DeleteUserReq (*StatusUserReq)(nil), // 5: wecom.StatusUserReq
(*DeleteUserReq)(nil), // 6: wecom.DeleteUserReq
} }
var file_wecom_wecom_proto_depIdxs = []int32{ var file_wecom_wecom_proto_depIdxs = []int32{
1, // 0: wecom.Wecom.ItemsUsers:input_type -> wecom.ItemsUserReq 2, // 0: wecom.Wecom.ItemsUsers:input_type -> wecom.ItemsUserReq
2, // 1: wecom.Wecom.CreateUser:input_type -> wecom.CreateUserReq 3, // 1: wecom.Wecom.CreateUser:input_type -> wecom.CreateUserReq
3, // 2: wecom.Wecom.UpdateUser:input_type -> wecom.UpdateUserReq 4, // 2: wecom.Wecom.UpdateUser:input_type -> wecom.UpdateUserReq
4, // 3: wecom.Wecom.StatusUser:input_type -> wecom.StatusUserReq 5, // 3: wecom.Wecom.StatusUser:input_type -> wecom.StatusUserReq
5, // 4: wecom.Wecom.DeleteUser:input_type -> wecom.DeleteUserReq 6, // 4: wecom.Wecom.DeleteUser:input_type -> wecom.DeleteUserReq
0, // 5: wecom.Wecom.ItemsUsers:output_type -> wecom.Response 1, // 5: wecom.Wecom.ItemsAgents:input_type -> wecom.EmptyReq
0, // 6: wecom.Wecom.CreateUser:output_type -> wecom.Response 1, // 6: wecom.Wecom.Types:input_type -> wecom.EmptyReq
0, // 7: wecom.Wecom.UpdateUser:output_type -> wecom.Response 0, // 7: wecom.Wecom.ItemsUsers:output_type -> wecom.Response
0, // 8: wecom.Wecom.StatusUser:output_type -> wecom.Response 0, // 8: wecom.Wecom.CreateUser:output_type -> wecom.Response
0, // 9: wecom.Wecom.DeleteUser:output_type -> wecom.Response 0, // 9: wecom.Wecom.UpdateUser:output_type -> wecom.Response
5, // [5:10] is the sub-list for method output_type 0, // 10: wecom.Wecom.StatusUser:output_type -> wecom.Response
0, // [0:5] is the sub-list for method input_type 0, // 11: wecom.Wecom.DeleteUser:output_type -> wecom.Response
0, // 12: wecom.Wecom.ItemsAgents:output_type -> wecom.Response
0, // 13: wecom.Wecom.Types:output_type -> wecom.Response
7, // [7:14] is the sub-list for method output_type
0, // [0:7] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name 0, // [0:0] is the sub-list for field type_name
@@ -527,7 +572,7 @@ func file_wecom_wecom_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_wecom_wecom_proto_rawDesc), len(file_wecom_wecom_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_wecom_wecom_proto_rawDesc), len(file_wecom_wecom_proto_rawDesc)),
NumEnums: 0, NumEnums: 0,
NumMessages: 6, NumMessages: 7,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },
+81 -5
View File
@@ -19,11 +19,13 @@ import (
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion9
const ( const (
Wecom_ItemsUsers_FullMethodName = "/wecom.Wecom/ItemsUsers" Wecom_ItemsUsers_FullMethodName = "/wecom.Wecom/ItemsUsers"
Wecom_CreateUser_FullMethodName = "/wecom.Wecom/CreateUser" Wecom_CreateUser_FullMethodName = "/wecom.Wecom/CreateUser"
Wecom_UpdateUser_FullMethodName = "/wecom.Wecom/UpdateUser" Wecom_UpdateUser_FullMethodName = "/wecom.Wecom/UpdateUser"
Wecom_StatusUser_FullMethodName = "/wecom.Wecom/StatusUser" Wecom_StatusUser_FullMethodName = "/wecom.Wecom/StatusUser"
Wecom_DeleteUser_FullMethodName = "/wecom.Wecom/DeleteUser" Wecom_DeleteUser_FullMethodName = "/wecom.Wecom/DeleteUser"
Wecom_ItemsAgents_FullMethodName = "/wecom.Wecom/ItemsAgents"
Wecom_Types_FullMethodName = "/wecom.Wecom/Types"
) )
// WecomClient is the client API for Wecom service. // WecomClient is the client API for Wecom service.
@@ -35,6 +37,8 @@ type WecomClient interface {
UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Response, error) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Response, error)
StatusUser(ctx context.Context, in *StatusUserReq, opts ...grpc.CallOption) (*Response, error) StatusUser(ctx context.Context, in *StatusUserReq, opts ...grpc.CallOption) (*Response, error)
DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*Response, error) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*Response, error)
ItemsAgents(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error)
Types(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error)
} }
type wecomClient struct { type wecomClient struct {
@@ -95,6 +99,26 @@ func (c *wecomClient) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ..
return out, nil return out, nil
} }
func (c *wecomClient) ItemsAgents(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Wecom_ItemsAgents_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *wecomClient) Types(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, Wecom_Types_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// WecomServer is the server API for Wecom service. // WecomServer is the server API for Wecom service.
// All implementations must embed UnimplementedWecomServer // All implementations must embed UnimplementedWecomServer
// for forward compatibility. // for forward compatibility.
@@ -104,6 +128,8 @@ type WecomServer interface {
UpdateUser(context.Context, *UpdateUserReq) (*Response, error) UpdateUser(context.Context, *UpdateUserReq) (*Response, error)
StatusUser(context.Context, *StatusUserReq) (*Response, error) StatusUser(context.Context, *StatusUserReq) (*Response, error)
DeleteUser(context.Context, *DeleteUserReq) (*Response, error) DeleteUser(context.Context, *DeleteUserReq) (*Response, error)
ItemsAgents(context.Context, *EmptyReq) (*Response, error)
Types(context.Context, *EmptyReq) (*Response, error)
mustEmbedUnimplementedWecomServer() mustEmbedUnimplementedWecomServer()
} }
@@ -129,6 +155,12 @@ func (UnimplementedWecomServer) StatusUser(context.Context, *StatusUserReq) (*Re
func (UnimplementedWecomServer) DeleteUser(context.Context, *DeleteUserReq) (*Response, error) { func (UnimplementedWecomServer) DeleteUser(context.Context, *DeleteUserReq) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteUser not implemented") return nil, status.Error(codes.Unimplemented, "method DeleteUser not implemented")
} }
func (UnimplementedWecomServer) ItemsAgents(context.Context, *EmptyReq) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method ItemsAgents not implemented")
}
func (UnimplementedWecomServer) Types(context.Context, *EmptyReq) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method Types not implemented")
}
func (UnimplementedWecomServer) mustEmbedUnimplementedWecomServer() {} func (UnimplementedWecomServer) mustEmbedUnimplementedWecomServer() {}
func (UnimplementedWecomServer) testEmbeddedByValue() {} func (UnimplementedWecomServer) testEmbeddedByValue() {}
@@ -240,6 +272,42 @@ func _Wecom_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Wecom_ItemsAgents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WecomServer).ItemsAgents(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Wecom_ItemsAgents_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WecomServer).ItemsAgents(ctx, req.(*EmptyReq))
}
return interceptor(ctx, in, info, handler)
}
func _Wecom_Types_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WecomServer).Types(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Wecom_Types_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WecomServer).Types(ctx, req.(*EmptyReq))
}
return interceptor(ctx, in, info, handler)
}
// Wecom_ServiceDesc is the grpc.ServiceDesc for Wecom service. // Wecom_ServiceDesc is the grpc.ServiceDesc for Wecom service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@@ -267,6 +335,14 @@ var Wecom_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeleteUser", MethodName: "DeleteUser",
Handler: _Wecom_DeleteUser_Handler, Handler: _Wecom_DeleteUser_Handler,
}, },
{
MethodName: "ItemsAgents",
Handler: _Wecom_ItemsAgents_Handler,
},
{
MethodName: "Types",
Handler: _Wecom_Types_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "wecom/wecom.proto", Metadata: "wecom/wecom.proto",
Binary file not shown.
+18 -2
View File
@@ -35,6 +35,20 @@ service Wecom {
body: "*" body: "*"
}; };
} }
rpc ItemsAgents(EmptyReq) returns (Response) {
option (google.api.http) = {
get: "/admin/v3/wecom/agent"
body: "*"
};
}
rpc Types(EmptyReq) returns (Response) {
option (google.api.http) = {
get: "/admin/v3/wecom/types"
body: "*"
};
}
} }
message Response { message Response {
@@ -43,12 +57,14 @@ message Response {
string data = 3; string data = 3;
} }
message EmptyReq {}
message ItemsUserReq { message ItemsUserReq {
uint32 page = 1; uint32 page = 1;
uint32 page_size = 2; uint32 page_size = 2;
string name = 3; string name = 3;
uint32 type = 4; // 1: 管理员,2: 销售 uint32 type = 4;
uint32 status = 5; // 1: 启用,2: 禁用 uint32 status = 5;
} }
message CreateUserReq { message CreateUserReq {
+19
View File
@@ -0,0 +1,19 @@
package dao
import "lone-services/pkg/utils"
// WecomAgent 企业微信应用
type WecomAgent struct {
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Name string `gorm:"column:name" json:"name"`
AgentId int64 `gorm:"column:agent_id" json:"agent_id"`
CreatedAt utils.CustomTime `gorm:"column:created_at" json:"created_at"`
}
// AgentListItem 应用列表项
type AgentListItem struct {
Id int64 `json:"id"`
Name string `json:"name"`
AgentId int64 `json:"agent_id"`
CreatedAt string `json:"created_at"`
}
+6
View File
@@ -39,3 +39,9 @@ type UserListItem struct {
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
} }
// UserTypeOption 用户类型选项(前端下拉)
type UserTypeOption struct {
Value uint8 `json:"value"`
Label string `json:"label"`
}
+7
View File
@@ -31,6 +31,13 @@ func typeText(t uint8) string {
} }
} }
func userTypeOptions() []dao.UserTypeOption {
return []dao.UserTypeOption{
{Value: dao.UserTypeAdmin, Label: "管理员"},
{Value: dao.UserTypeSale, Label: "销售"},
}
}
func resolveStatus(reqStatus uint32, current uint8) uint8 { func resolveStatus(reqStatus uint32, current uint8) uint8 {
if reqStatus == uint32(dao.StatusEnabled) || reqStatus == uint32(dao.StatusDisabled) { if reqStatus == uint32(dao.StatusEnabled) || reqStatus == uint32(dao.StatusDisabled) {
return uint8(reqStatus) return uint8(reqStatus)
@@ -0,0 +1,49 @@
package logic
import (
"context"
"lone-services/pkg/modelbase"
"lone-services/pkg/utils"
wecom "lone-services/rpc/wecom/pb"
"lone-services/services/wecom/internal/dao"
"lone-services/services/wecom/internal/model"
"lone-services/services/wecom/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)
type ItemsAgentsLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewItemsAgentsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemsAgentsLogic {
return &ItemsAgentsLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// ItemsAgents 企业微信应用列表
func (l *ItemsAgentsLogic) ItemsAgents(_ *wecom.EmptyReq) (*wecom.Response, error) {
var rows []dao.WecomAgent
m := model.AgentModel{}.Init()
if err := m.Items(modelbase.Params{Order: "id desc"}, &rows); err != nil {
l.Errorf("wecom items agents: %v", err)
return failResponse(utils.Fail), nil
}
items := make([]dao.AgentListItem, 0, len(rows))
for _, row := range rows {
items = append(items, dao.AgentListItem{
Id: row.Id,
Name: row.Name,
AgentId: row.AgentId,
CreatedAt: row.CreatedAt.Format(),
})
}
return okResponse(items), nil
}
@@ -57,7 +57,7 @@ func (l *ItemsUsersLogic) ItemsUsers(in *wecom.ItemsUserReq) (*wecom.Response, e
if req.Type > utils.NumberZero { if req.Type > utils.NumberZero {
w.Eq["type"] = strconv.FormatUint(uint64(req.Type), utils.NumberTen) w.Eq["type"] = strconv.FormatUint(uint64(req.Type), utils.NumberTen)
} }
w.Eq["status"] = strconv.FormatUint(uint64(dao.StatusEnabled), utils.NumberTen) // w.Eq["status"] = strconv.FormatUint(uint64(dao.StatusEnabled), utils.NumberTen)
if req.Name != utils.StringEmpty { if req.Name != utils.StringEmpty {
w.Like["name LIKE ?"] = "%" + req.Name + "%" w.Like["name LIKE ?"] = "%" + req.Name + "%"
} }
@@ -0,0 +1,29 @@
package logic
import (
"context"
wecom "lone-services/rpc/wecom/pb"
"lone-services/services/wecom/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)
type TypesLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewTypesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TypesLogic {
return &TypesLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// Types 用户类型选项(管理员 / 销售)
func (l *TypesLogic) Types(_ *wecom.EmptyReq) (*wecom.Response, error) {
return okResponse(userTypeOptions()), nil
}
+18
View File
@@ -0,0 +1,18 @@
package model
import (
"lone-services/pkg/modelbase"
)
type AgentModel struct {
modelbase.Base
}
func (m AgentModel) TableName() string {
return modelbase.Prefix() + "agents"
}
func (m AgentModel) Init() AgentModel {
m.Table = m.TableName()
return m
}
@@ -47,3 +47,13 @@ func (s *WecomServer) DeleteUser(ctx context.Context, in *wecom.DeleteUserReq) (
l := logic.NewDeleteUserLogic(ctx, s.svcCtx) l := logic.NewDeleteUserLogic(ctx, s.svcCtx)
return l.DeleteUser(in) return l.DeleteUser(in)
} }
func (s *WecomServer) ItemsAgents(ctx context.Context, in *wecom.EmptyReq) (*wecom.Response, error) {
l := logic.NewItemsAgentsLogic(ctx, s.svcCtx)
return l.ItemsAgents(in)
}
func (s *WecomServer) Types(ctx context.Context, in *wecom.EmptyReq) (*wecom.Response, error) {
l := logic.NewTypesLogic(ctx, s.svcCtx)
return l.Types(in)
}
+13
View File
@@ -0,0 +1,13 @@
-- 企业微信应用表(库:dms-wecom,前缀为空时表名为 agents
CREATE TABLE IF NOT EXISTS `agents` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL DEFAULT '' COMMENT '应用名称',
`agent_id` bigint NOT NULL DEFAULT 0 COMMENT '企业微信 AgentId',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_agent_id` (`agent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='企业微信应用';
INSERT INTO `agents` (`id`, `name`, `agent_id`, `created_at`) VALUES
(1, '审核通知', 100003, '2026-05-22 16:14:31'),
(2, '消息通知', 100004, '2026-05-22 16:14:33');
+13
View File
@@ -16,6 +16,7 @@ import (
type ( type (
CreateUserReq = wecom.CreateUserReq CreateUserReq = wecom.CreateUserReq
DeleteUserReq = wecom.DeleteUserReq DeleteUserReq = wecom.DeleteUserReq
EmptyReq = wecom.EmptyReq
ItemsUserReq = wecom.ItemsUserReq ItemsUserReq = wecom.ItemsUserReq
Response = wecom.Response Response = wecom.Response
StatusUserReq = wecom.StatusUserReq StatusUserReq = wecom.StatusUserReq
@@ -27,6 +28,8 @@ type (
UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Response, error) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Response, error)
StatusUser(ctx context.Context, in *StatusUserReq, opts ...grpc.CallOption) (*Response, error) StatusUser(ctx context.Context, in *StatusUserReq, opts ...grpc.CallOption) (*Response, error)
DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*Response, error) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*Response, error)
ItemsAgents(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error)
Types(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error)
} }
defaultWecom struct { defaultWecom struct {
@@ -64,3 +67,13 @@ func (m *defaultWecom) DeleteUser(ctx context.Context, in *DeleteUserReq, opts .
client := wecom.NewWecomClient(m.cli.Conn()) client := wecom.NewWecomClient(m.cli.Conn())
return client.DeleteUser(ctx, in, opts...) return client.DeleteUser(ctx, in, opts...)
} }
func (m *defaultWecom) ItemsAgents(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) {
client := wecom.NewWecomClient(m.cli.Conn())
return client.ItemsAgents(ctx, in, opts...)
}
func (m *defaultWecom) Types(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*Response, error) {
client := wecom.NewWecomClient(m.cli.Conn())
return client.Types(ctx, in, opts...)
}