feat:解决冲突

This commit is contained in:
bx1834938347-prog 2025-12-18 11:32:24 +08:00
commit 60d141d892
10 changed files with 2520 additions and 3 deletions

1802
api/cron/cron.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,129 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: pb/cron.proto
package cron
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
func (this *CommonIDRequest) Validate() error {
return nil
}
func (this *CommonResponse) Validate() error {
return nil
}
func (this *ScheduleTask) Validate() error {
if this.TaskDetail != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TaskDetail); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("TaskDetail", err)
}
}
for _, item := range this.ExecutionRecords {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ExecutionRecords", err)
}
}
}
return nil
}
func (this *ExecutionRecord) Validate() error {
for _, item := range this.ExecutionResults {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ExecutionResults", err)
}
}
}
return nil
}
func (this *ExecutionResult) Validate() error {
return nil
}
func (this *TaskDetail) Validate() error {
for _, item := range this.Artists {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Artists", err)
}
}
}
return nil
}
func (this *ArtistInfo) Validate() error {
return nil
}
func (this *CreateScheduleTaskRequest) Validate() error {
if this.TaskDetail != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TaskDetail); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("TaskDetail", err)
}
}
return nil
}
func (this *TaskDetailRequest) Validate() error {
for _, item := range this.Artists {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Artists", err)
}
}
}
return nil
}
func (this *CreateScheduleTaskResponse) Validate() error {
if this.Data != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
return nil
}
func (this *GetListScheduleTaskRequest) Validate() error {
return nil
}
func (this *GetListScheduleTaskResponse) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}
func (this *GetListExecutionRecordRequest) Validate() error {
return nil
}
func (this *GetListExecutionRecordResponse) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}
func (this *GetListExecutionResultRequest) Validate() error {
return nil
}
func (this *GetListExecutionResultResponse) Validate() error {
for _, item := range this.Data {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
}
return nil
}

417
api/cron/cron_triple.pb.go Normal file
View File

@ -0,0 +1,417 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.5
// - protoc v6.32.0
// source: pb/cron.proto
package cron
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// CronClient is the client API for Cron service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type CronClient interface {
CreateScheduleTask(ctx context.Context, in *CreateScheduleTaskRequest, opts ...grpc_go.CallOption) (*CreateScheduleTaskResponse, common.ErrorWithAttachment)
GetListScheduleTask(ctx context.Context, in *GetListScheduleTaskRequest, opts ...grpc_go.CallOption) (*GetListScheduleTaskResponse, common.ErrorWithAttachment)
GetListExecutionRecord(ctx context.Context, in *GetListExecutionRecordRequest, opts ...grpc_go.CallOption) (*GetListExecutionRecordResponse, common.ErrorWithAttachment)
GetListExecutionResult(ctx context.Context, in *GetListExecutionResultRequest, opts ...grpc_go.CallOption) (*GetListExecutionResultResponse, common.ErrorWithAttachment)
PauseScheduleTask(ctx context.Context, in *CommonIDRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
StartScheduleTask(ctx context.Context, in *CommonIDRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
DeleteScheduleTask(ctx context.Context, in *CommonIDRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
}
type cronClient struct {
cc *triple.TripleConn
}
type CronClientImpl struct {
CreateScheduleTask func(ctx context.Context, in *CreateScheduleTaskRequest) (*CreateScheduleTaskResponse, error)
GetListScheduleTask func(ctx context.Context, in *GetListScheduleTaskRequest) (*GetListScheduleTaskResponse, error)
GetListExecutionRecord func(ctx context.Context, in *GetListExecutionRecordRequest) (*GetListExecutionRecordResponse, error)
GetListExecutionResult func(ctx context.Context, in *GetListExecutionResultRequest) (*GetListExecutionResultResponse, error)
PauseScheduleTask func(ctx context.Context, in *CommonIDRequest) (*CommonResponse, error)
StartScheduleTask func(ctx context.Context, in *CommonIDRequest) (*CommonResponse, error)
DeleteScheduleTask func(ctx context.Context, in *CommonIDRequest) (*CommonResponse, error)
}
func (c *CronClientImpl) GetDubboStub(cc *triple.TripleConn) CronClient {
return NewCronClient(cc)
}
func (c *CronClientImpl) XXX_InterfaceName() string {
return "cron.Cron"
}
func NewCronClient(cc *triple.TripleConn) CronClient {
return &cronClient{cc}
}
func (c *cronClient) CreateScheduleTask(ctx context.Context, in *CreateScheduleTaskRequest, opts ...grpc_go.CallOption) (*CreateScheduleTaskResponse, common.ErrorWithAttachment) {
out := new(CreateScheduleTaskResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateScheduleTask", in, out)
}
func (c *cronClient) GetListScheduleTask(ctx context.Context, in *GetListScheduleTaskRequest, opts ...grpc_go.CallOption) (*GetListScheduleTaskResponse, common.ErrorWithAttachment) {
out := new(GetListScheduleTaskResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetListScheduleTask", in, out)
}
func (c *cronClient) GetListExecutionRecord(ctx context.Context, in *GetListExecutionRecordRequest, opts ...grpc_go.CallOption) (*GetListExecutionRecordResponse, common.ErrorWithAttachment) {
out := new(GetListExecutionRecordResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetListExecutionRecord", in, out)
}
func (c *cronClient) GetListExecutionResult(ctx context.Context, in *GetListExecutionResultRequest, opts ...grpc_go.CallOption) (*GetListExecutionResultResponse, common.ErrorWithAttachment) {
out := new(GetListExecutionResultResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetListExecutionResult", in, out)
}
func (c *cronClient) PauseScheduleTask(ctx context.Context, in *CommonIDRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/PauseScheduleTask", in, out)
}
func (c *cronClient) StartScheduleTask(ctx context.Context, in *CommonIDRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/StartScheduleTask", in, out)
}
func (c *cronClient) DeleteScheduleTask(ctx context.Context, in *CommonIDRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DeleteScheduleTask", in, out)
}
// CronServer is the server API for Cron service.
// All implementations must embed UnimplementedCronServer
// for forward compatibility
type CronServer interface {
CreateScheduleTask(context.Context, *CreateScheduleTaskRequest) (*CreateScheduleTaskResponse, error)
GetListScheduleTask(context.Context, *GetListScheduleTaskRequest) (*GetListScheduleTaskResponse, error)
GetListExecutionRecord(context.Context, *GetListExecutionRecordRequest) (*GetListExecutionRecordResponse, error)
GetListExecutionResult(context.Context, *GetListExecutionResultRequest) (*GetListExecutionResultResponse, error)
PauseScheduleTask(context.Context, *CommonIDRequest) (*CommonResponse, error)
StartScheduleTask(context.Context, *CommonIDRequest) (*CommonResponse, error)
DeleteScheduleTask(context.Context, *CommonIDRequest) (*CommonResponse, error)
mustEmbedUnimplementedCronServer()
}
// UnimplementedCronServer must be embedded to have forward compatible implementations.
type UnimplementedCronServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedCronServer) CreateScheduleTask(context.Context, *CreateScheduleTaskRequest) (*CreateScheduleTaskResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateScheduleTask not implemented")
}
func (UnimplementedCronServer) GetListScheduleTask(context.Context, *GetListScheduleTaskRequest) (*GetListScheduleTaskResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetListScheduleTask not implemented")
}
func (UnimplementedCronServer) GetListExecutionRecord(context.Context, *GetListExecutionRecordRequest) (*GetListExecutionRecordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetListExecutionRecord not implemented")
}
func (UnimplementedCronServer) GetListExecutionResult(context.Context, *GetListExecutionResultRequest) (*GetListExecutionResultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetListExecutionResult not implemented")
}
func (UnimplementedCronServer) PauseScheduleTask(context.Context, *CommonIDRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PauseScheduleTask not implemented")
}
func (UnimplementedCronServer) StartScheduleTask(context.Context, *CommonIDRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method StartScheduleTask not implemented")
}
func (UnimplementedCronServer) DeleteScheduleTask(context.Context, *CommonIDRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteScheduleTask not implemented")
}
func (s *UnimplementedCronServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedCronServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedCronServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &Cron_ServiceDesc
}
func (s *UnimplementedCronServer) XXX_InterfaceName() string {
return "cron.Cron"
}
func (UnimplementedCronServer) mustEmbedUnimplementedCronServer() {}
// UnsafeCronServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CronServer will
// result in compilation errors.
type UnsafeCronServer interface {
mustEmbedUnimplementedCronServer()
}
func RegisterCronServer(s grpc_go.ServiceRegistrar, srv CronServer) {
s.RegisterService(&Cron_ServiceDesc, srv)
}
func _Cron_CreateScheduleTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateScheduleTaskRequest)
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("CreateScheduleTask", 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 _Cron_GetListScheduleTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetListScheduleTaskRequest)
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("GetListScheduleTask", 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 _Cron_GetListExecutionRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetListExecutionRecordRequest)
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("GetListExecutionRecord", 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 _Cron_GetListExecutionResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetListExecutionResultRequest)
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("GetListExecutionResult", 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 _Cron_PauseScheduleTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CommonIDRequest)
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("PauseScheduleTask", 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 _Cron_StartScheduleTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CommonIDRequest)
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("StartScheduleTask", 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 _Cron_DeleteScheduleTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CommonIDRequest)
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("DeleteScheduleTask", 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)
}
// Cron_ServiceDesc is the grpc_go.ServiceDesc for Cron service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var Cron_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "cron.Cron",
HandlerType: (*CronServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "CreateScheduleTask",
Handler: _Cron_CreateScheduleTask_Handler,
},
{
MethodName: "GetListScheduleTask",
Handler: _Cron_GetListScheduleTask_Handler,
},
{
MethodName: "GetListExecutionRecord",
Handler: _Cron_GetListExecutionRecord_Handler,
},
{
MethodName: "GetListExecutionResult",
Handler: _Cron_GetListExecutionResult_Handler,
},
{
MethodName: "PauseScheduleTask",
Handler: _Cron_PauseScheduleTask_Handler,
},
{
MethodName: "StartScheduleTask",
Handler: _Cron_StartScheduleTask_Handler,
},
{
MethodName: "DeleteScheduleTask",
Handler: _Cron_DeleteScheduleTask_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "pb/cron.proto",
}

View File

@ -57,6 +57,9 @@ dubbo:
AyrshareClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.ayrshare
FieeCronClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.cron
logger:
zap-config:
level: error # 日志级别

View File

@ -59,6 +59,9 @@ dubbo:
AyrshareClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.ayrshare
FieeCronClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.cron
logger:
zap-config:
level: error # 日志级别

View File

@ -57,6 +57,9 @@ dubbo:
AyrshareClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.ayrshare
FieeCronClientImpl:
protocol: tri
interface: com.fontree.microservices.fiee.cron
logger:
zap-config:
level: error # 日志级别

23
pkg/router/cron.go Normal file
View File

@ -0,0 +1,23 @@
package router
import (
cronService "fonchain-fiee/pkg/service/cron"
"github.com/gin-gonic/gin"
)
func cronRouter(r *gin.RouterGroup) {
auth := r.Group("")
//auth.Use(middleware.CheckWebLogin(service.AccountProvider))
cron := auth.Group("cron")
{
cron.POST("createScheduleTask", cronService.CreateScheduleTask)
cron.POST("pauseScheduleTask", cronService.PauseScheduleTask)
cron.POST("startScheduleTask", cronService.StartScheduleTask)
cron.POST("deleteScheduleTask", cronService.DeleteScheduleTask)
cron.GET("getListScheduleTask", cronService.GetListScheduleTask)
cron.GET("getListExecutionResult", cronService.GetListExecutionResult)
cron.GET("getListExecutionRecord", cronService.GetListExecutionRecord)
}
}

View File

@ -59,6 +59,7 @@ func NewRouter() *gin.Engine {
AnalysisRouter(privateGroup)
SecFilingRouter(privateGroup)
app.MediaAppRouter(privateGroup)
cronRouter(privateGroup)
{
v1.POST("version", version.Version) //版本号公共
}

135
pkg/service/cron/cron.go Normal file
View File

@ -0,0 +1,135 @@
package cron
import (
"context"
"errors"
"fonchain-fiee/api/cron"
"fonchain-fiee/pkg/service"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
func CreateScheduleTask(c *gin.Context) {
var req cron.CreateScheduleTaskRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, errors.New("参数错误"))
return
}
res, err := service.CronProvider.CreateScheduleTask(context.Background(), &req)
if err != nil {
service.Error(c, errors.New("网络超时,请重试"))
return
}
if res.Code != 200 {
service.Error(c, errors.New(res.Message))
return
}
service.Success(c, res)
}
func GetListScheduleTask(c *gin.Context) {
var req cron.GetListScheduleTaskRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, errors.New("参数错误"))
return
}
res, err := service.CronProvider.GetListScheduleTask(context.Background(), &req)
if err != nil {
service.Error(c, errors.New("网络超时,请重试"))
return
}
if res.Code != 200 {
service.Error(c, errors.New(res.Message))
return
}
service.Success(c, res)
}
func GetListExecutionRecord(c *gin.Context) {
var req cron.GetListExecutionRecordRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, errors.New("参数错误"))
return
}
res, err := service.CronProvider.GetListExecutionRecord(context.Background(), &req)
if err != nil {
service.Error(c, errors.New("网络超时,请重试"))
return
}
if res.Code != 200 {
service.Error(c, errors.New(res.Message))
return
}
service.Success(c, res)
}
func GetListExecutionResult(c *gin.Context) {
var req cron.GetListExecutionResultRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, errors.New("参数错误"))
return
}
res, err := service.CronProvider.GetListExecutionResult(context.Background(), &req)
if err != nil {
service.Error(c, errors.New("网络超时,请重试"))
return
}
if res.Code != 200 {
service.Error(c, errors.New(res.Message))
return
}
service.Success(c, res)
}
func StartScheduleTask(c *gin.Context) {
var req cron.CommonIDRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, errors.New("参数错误"))
return
}
res, err := service.CronProvider.StartScheduleTask(context.Background(), &req)
if err != nil {
service.Error(c, errors.New("网络超时,请重试"))
return
}
if res.Code != 200 {
service.Error(c, errors.New(res.Message))
return
}
service.Success(c, res)
}
func PauseScheduleTask(c *gin.Context) {
var req cron.CommonIDRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, errors.New("参数错误"))
return
}
res, err := service.CronProvider.PauseScheduleTask(context.Background(), &req)
if err != nil {
service.Error(c, errors.New("网络超时,请重试"))
return
}
if res.Code != 200 {
service.Error(c, errors.New(res.Message))
return
}
service.Success(c, res)
}
func DeleteScheduleTask(c *gin.Context) {
var req cron.CommonIDRequest
if err := c.ShouldBindJSON(&req); err != nil {
service.Error(c, errors.New("参数错误"))
return
}
res, err := service.CronProvider.DeleteScheduleTask(context.Background(), &req)
if err != nil {
service.Error(c, errors.New("网络超时,请重试"))
return
}
if res.Code != 200 {
service.Error(c, errors.New(res.Message))
return
}
service.Success(c, res)
}

View File

@ -8,6 +8,7 @@ import (
"fonchain-fiee/api/bundle"
"fonchain-fiee/api/cast"
"fonchain-fiee/api/emailAlerts"
"fonchain-fiee/api/cron"
"fonchain-fiee/api/files"
"fonchain-fiee/api/governance"
"fonchain-fiee/api/members"
@ -39,6 +40,7 @@ var ReportsProvider = new(reports.ReportsClientImpl)
var EmailAlertsProvider = new(emailAlerts.EmailAlertsClientImpl)
var MembersProvider = new(members.MembersClientImpl)
var AyrshareProvider = new(aryshare.AyrshareClientImpl)
var CronProvider = new(cron.CronClientImpl)
func init() {
config.SetConsumerService(BundleProvider)
@ -55,9 +57,8 @@ func init() {
config.SetConsumerService(EmailAlertsProvider)
config.SetConsumerService(MembersProvider)
config.SetConsumerService(AyrshareProvider)
config.SetConsumerService(FilesProvider)
config.SetConsumerService(GovernanceProvider)
config.SetConsumerService(PressReleasesProvider)
config.SetConsumerService(CronProvider)
if err := config.Load(); err != nil {
panic(err)
}