Compare commits

..

No commits in common. "bbad976a2fbc9874b73d6e2ddedabd8b03dde8c6" and "266e1a077edf88928f2c1533a32bf0ffabb901fe" have entirely different histories.

11 changed files with 94 additions and 265 deletions

View File

@ -80,5 +80,6 @@ func (c *ScheduleTaskController) CreateScheduleTask(req CreateScheduleTaskReques
if err := c.Logic.CreateScheduleTask(task); err != nil {
return Error(500, err.Error())
}
return Success(task)
}

View File

@ -1,8 +1,6 @@
package controller
import (
"fiee-cron/cmd/model"
)
import "fiee-cron/cmd/model"
type UpdateScheduleTaskRequest struct {
TaskID uint64
@ -15,15 +13,7 @@ type UpdateScheduleTaskRequest struct {
ExecuteStartTime string
ExecuteEndTime string
Remark string
TaskDetail UpdateScheduleTaskRequestTaskDetail
}
type UpdateScheduleTaskRequestTaskDetail struct {
ID int32
TaskID uint64
Artists []ArtistInfo
ArtistCount int32
Num int32
ContentType int32
TaskDetail TaskDetailRequest
}
// UpdateScheduleTask 更新定时任务
@ -37,12 +27,10 @@ func (c *ScheduleTaskController) UpdateScheduleTask(req UpdateScheduleTaskReques
ExecuteEndTime: req.ExecuteEndTime,
Remark: req.Remark,
TaskDetail: model.TaskDetail{
TaskID: uint(req.TaskDetail.TaskID),
ContentType: req.TaskDetail.ContentType,
Num: req.TaskDetail.Num,
},
}
task.TaskDetail.ID = uint(req.TaskDetail.ID)
// 设置自定义日期
customDays, err := task.StringMarshalJSON(req.CustomDays)

View File

@ -26,9 +26,7 @@ func (s *ServicesProvider) UpdateScheduleTask(ctx context.Context, req *cron.Upd
}
if req.TaskDetail != nil {
updateReq.TaskDetail = controller.UpdateScheduleTaskRequestTaskDetail{
ID: req.TaskDetail.Id,
TaskID: uint64(req.TaskDetail.TaskId),
updateReq.TaskDetail = controller.TaskDetailRequest{
ArtistCount: req.TaskDetail.ArtistCount,
Num: req.TaskDetail.Num,
ContentType: req.TaskDetail.ContentType,

View File

@ -10,24 +10,11 @@ import (
// Create 创建定时任务
func (d *ScheduleTaskDao) Create(task *model.ScheduleTask) error {
if err := db.CronDB.Create(task).Error; err != nil {
return err
}
return nil
return db.CronDB.Create(task).Error
}
func (d *ScheduleTaskDao) Update(task *model.ScheduleTask) error {
tx := db.CronDB.Begin()
if err := tx.Updates(task).Error; err != nil {
tx.Rollback()
return err
}
if err := tx.Model(&model.TaskDetail{}).Where("id=?", task.TaskDetail.ID).Updates(&task.TaskDetail).Error; err != nil {
tx.Rollback()
return err
}
tx.Commit()
return nil
return db.CronDB.Updates(task).Error
}
// List 分页查询定时任务列表

View File

@ -3,8 +3,6 @@ package logic
import (
"errors"
"fiee-cron/cmd/model"
"fiee-cron/pkg/cron"
"fiee-cron/pkg/db"
"fiee-cron/pkg/log"
"fiee-cron/pkg/utils"
"fmt"
@ -124,22 +122,5 @@ func (l *ScheduleTaskLogic) CreateScheduleTask(task *model.ScheduleTask) error {
log.GetLogger().Error("创建失败", zap.Error(err))
return errors.New("创建失败")
}
tx := db.CronDB.Begin()
if err := l.dao.UpdateStatusTx(tx, uint64(task.ID), model.ScheduleTaskStatusRunning); err != nil {
tx.Rollback()
log.GetLogger().Error("更新任务状态为正在执行失败", zap.Uint64("task_id", uint64(task.ID)), zap.Error(err))
return fmt.Errorf(task.TaskTitle + "更新任务状态为正在执行失败")
}
if task.PeriodType != model.ScheduleTaskPeriodWeekly {
tx.Commit()
return nil
}
//启动定时任务
if err := cron.GetCronManager().AddTask(int64(task.ID), task.CronExpression, func() { l.RunScheduleTask(uint64(task.ID)) }); err != nil {
tx.Rollback()
log.GetLogger().Error("启动定时任务失败", zap.Uint64("task_id", uint64(task.ID)), zap.Error(err))
return fmt.Errorf(task.TaskTitle + "启动定时任务失败")
}
tx.Commit()
return nil
}

View File

@ -14,7 +14,7 @@ func (c *ScheduleTaskLogic) PollScheduleTask() {
now := time.Now()
log.GetLogger().Info("开始查询执行记录", zap.Time("时间", now))
if err := db.CronDB.Model(&model.ExecutionRecord{}).
Where("execute_end_time = ?", time.Now().Format("2006-01-02 15:04")).
Where("execute_end_time = ?", time.Now().Format("2006-01-02 03:04")).
Where("status = ?", model.ExecutionRecordStatusInProgress).
Find(&executionRecords).Error; err != nil {
log.GetLogger().Error("查询执行记录失败", zap.Error(err))

View File

@ -94,7 +94,7 @@ func (c *ScheduleTaskLogic) ScheduleTask(task *model.ScheduleTask) {
return
}
if t1.After(t2) {
executeEndTime = nowData.AddDate(0, 0, 1).Format("2006-01-02") + " " + task.ExecuteEndTime
executeEndTime = nowData.AddDate(0, 1, 1).Format("2006-01-02") + " " + task.ExecuteEndTime
}
executionRecord := model.ExecutionRecord{
TaskID: task.ID,

View File

@ -3,7 +3,6 @@ package logic
import (
"errors"
"fiee-cron/cmd/model"
"fiee-cron/pkg/cron"
"fiee-cron/pkg/db"
"fiee-cron/pkg/log"
"fmt"
@ -71,24 +70,7 @@ func (l *ScheduleTaskLogic) UpdateScheduleTask(taskID uint64, task *model.Schedu
log.GetLogger().Error("更新失败", zap.Error(err))
return errors.New("更新失败")
}
//更新定时任务
tx := db.CronDB.Begin()
if err := l.dao.UpdateStatusTx(tx, uint64(task.ID), model.ScheduleTaskStatusRunning); err != nil {
tx.Rollback()
log.GetLogger().Error("更新任务状态为正在执行失败", zap.Uint64("task_id", uint64(task.ID)), zap.Error(err))
return fmt.Errorf(task.TaskTitle + "更新任务状态为正在执行失败")
}
if task.PeriodType != model.ScheduleTaskPeriodWeekly {
tx.Commit()
return nil
}
//启动定时任务
if err := cron.GetCronManager().AddTask(int64(task.ID), task.CronExpression, func() { l.RunScheduleTask(uint64(task.ID)) }); err != nil {
tx.Rollback()
log.GetLogger().Error("启动定时任务失败", zap.Uint64("task_id", uint64(task.ID)), zap.Error(err))
return fmt.Errorf(task.TaskTitle + "启动定时任务失败")
}
tx.Commit()
// 返回成功
return nil
}

View File

@ -2,6 +2,8 @@ syntax = "proto3";
package cron;
import "google/protobuf/empty.proto";
option go_package = "./cron";
// -----------------------------------------------
@ -149,16 +151,7 @@ message UpdateScheduleTaskRequest {
string execute_start_time = 8; //
string execute_end_time = 9; //
string remark = 10; //
UpdateScheduleTaskRequestTaskDetail task_detail = 11; //
}
message UpdateScheduleTaskRequestTaskDetail {
int32 id=5;
int32 task_id=6;
int32 artist_count = 1; //
repeated ArtistInfo artists = 2; //
int32 num = 3; //
int32 content_type = 4; //
TaskDetailRequest task_detail = 11; //
}
message UpdateScheduleTaskResponse {

View File

@ -9,6 +9,7 @@ package cron
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
@ -1038,18 +1039,18 @@ func (x *CreateScheduleTaskResponse) GetData() *ScheduleTask {
}
type UpdateScheduleTaskRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
TaskId uint64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id"` // 任务ID用于标识需要更新的任务
TaskTitle string `protobuf:"bytes,2,opt,name=task_title,json=taskTitle,proto3" json:"task_title"` // 任务标题
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description"` // 描述
PeriodType int32 `protobuf:"varint,4,opt,name=period_type,json=periodType,proto3" json:"period_type"` // 周期类型
Weekdays []int32 `protobuf:"varint,5,rep,packed,name=weekdays,proto3" json:"weekdays"` // 每周任务的星期几
CustomDays []string `protobuf:"bytes,6,rep,name=custom_days,json=customDays,proto3" json:"custom_days"` // 自定义日期
StartDate string `protobuf:"bytes,7,opt,name=start_date,json=startDate,proto3" json:"start_date"` // 开始日期
ExecuteStartTime string `protobuf:"bytes,8,opt,name=execute_start_time,json=executeStartTime,proto3" json:"execute_start_time"` // 执行开始时间
ExecuteEndTime string `protobuf:"bytes,9,opt,name=execute_end_time,json=executeEndTime,proto3" json:"execute_end_time"` // 执行结束时间
Remark string `protobuf:"bytes,10,opt,name=remark,proto3" json:"remark"` // 备注
TaskDetail *UpdateScheduleTaskRequestTaskDetail `protobuf:"bytes,11,opt,name=task_detail,json=taskDetail,proto3" json:"task_detail"` // 任务详情
state protoimpl.MessageState `protogen:"open.v1"`
TaskId uint64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id"` // 任务ID用于标识需要更新的任务
TaskTitle string `protobuf:"bytes,2,opt,name=task_title,json=taskTitle,proto3" json:"task_title"` // 任务标题
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description"` // 描述
PeriodType int32 `protobuf:"varint,4,opt,name=period_type,json=periodType,proto3" json:"period_type"` // 周期类型
Weekdays []int32 `protobuf:"varint,5,rep,packed,name=weekdays,proto3" json:"weekdays"` // 每周任务的星期几
CustomDays []string `protobuf:"bytes,6,rep,name=custom_days,json=customDays,proto3" json:"custom_days"` // 自定义日期
StartDate string `protobuf:"bytes,7,opt,name=start_date,json=startDate,proto3" json:"start_date"` // 开始日期
ExecuteStartTime string `protobuf:"bytes,8,opt,name=execute_start_time,json=executeStartTime,proto3" json:"execute_start_time"` // 执行开始时间
ExecuteEndTime string `protobuf:"bytes,9,opt,name=execute_end_time,json=executeEndTime,proto3" json:"execute_end_time"` // 执行结束时间
Remark string `protobuf:"bytes,10,opt,name=remark,proto3" json:"remark"` // 备注
TaskDetail *TaskDetailRequest `protobuf:"bytes,11,opt,name=task_detail,json=taskDetail,proto3" json:"task_detail"` // 任务详情
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@ -1154,97 +1155,13 @@ func (x *UpdateScheduleTaskRequest) GetRemark() string {
return ""
}
func (x *UpdateScheduleTaskRequest) GetTaskDetail() *UpdateScheduleTaskRequestTaskDetail {
func (x *UpdateScheduleTaskRequest) GetTaskDetail() *TaskDetailRequest {
if x != nil {
return x.TaskDetail
}
return nil
}
type UpdateScheduleTaskRequestTaskDetail struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int32 `protobuf:"varint,5,opt,name=id,proto3" json:"id"`
TaskId int32 `protobuf:"varint,6,opt,name=task_id,json=taskId,proto3" json:"task_id"`
ArtistCount int32 `protobuf:"varint,1,opt,name=artist_count,json=artistCount,proto3" json:"artist_count"` // 艺人数量
Artists []*ArtistInfo `protobuf:"bytes,2,rep,name=artists,proto3" json:"artists"` // 艺人信息列表
Num int32 `protobuf:"varint,3,opt,name=num,proto3" json:"num"` // 任务数量
ContentType int32 `protobuf:"varint,4,opt,name=content_type,json=contentType,proto3" json:"content_type"` // 内容类型
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UpdateScheduleTaskRequestTaskDetail) Reset() {
*x = UpdateScheduleTaskRequestTaskDetail{}
mi := &file_pb_cron_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UpdateScheduleTaskRequestTaskDetail) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateScheduleTaskRequestTaskDetail) ProtoMessage() {}
func (x *UpdateScheduleTaskRequestTaskDetail) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[11]
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 UpdateScheduleTaskRequestTaskDetail.ProtoReflect.Descriptor instead.
func (*UpdateScheduleTaskRequestTaskDetail) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{11}
}
func (x *UpdateScheduleTaskRequestTaskDetail) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *UpdateScheduleTaskRequestTaskDetail) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
func (x *UpdateScheduleTaskRequestTaskDetail) GetArtistCount() int32 {
if x != nil {
return x.ArtistCount
}
return 0
}
func (x *UpdateScheduleTaskRequestTaskDetail) GetArtists() []*ArtistInfo {
if x != nil {
return x.Artists
}
return nil
}
func (x *UpdateScheduleTaskRequestTaskDetail) GetNum() int32 {
if x != nil {
return x.Num
}
return 0
}
func (x *UpdateScheduleTaskRequestTaskDetail) GetContentType() int32 {
if x != nil {
return x.ContentType
}
return 0
}
type UpdateScheduleTaskResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code"` // 响应码
@ -1256,7 +1173,7 @@ type UpdateScheduleTaskResponse struct {
func (x *UpdateScheduleTaskResponse) Reset() {
*x = UpdateScheduleTaskResponse{}
mi := &file_pb_cron_proto_msgTypes[12]
mi := &file_pb_cron_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1268,7 +1185,7 @@ func (x *UpdateScheduleTaskResponse) String() string {
func (*UpdateScheduleTaskResponse) ProtoMessage() {}
func (x *UpdateScheduleTaskResponse) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[12]
mi := &file_pb_cron_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1281,7 +1198,7 @@ func (x *UpdateScheduleTaskResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateScheduleTaskResponse.ProtoReflect.Descriptor instead.
func (*UpdateScheduleTaskResponse) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{12}
return file_pb_cron_proto_rawDescGZIP(), []int{11}
}
func (x *UpdateScheduleTaskResponse) GetCode() int32 {
@ -1322,7 +1239,7 @@ type GetListScheduleTaskRequest struct {
func (x *GetListScheduleTaskRequest) Reset() {
*x = GetListScheduleTaskRequest{}
mi := &file_pb_cron_proto_msgTypes[13]
mi := &file_pb_cron_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1334,7 +1251,7 @@ func (x *GetListScheduleTaskRequest) String() string {
func (*GetListScheduleTaskRequest) ProtoMessage() {}
func (x *GetListScheduleTaskRequest) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[13]
mi := &file_pb_cron_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1347,7 +1264,7 @@ func (x *GetListScheduleTaskRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetListScheduleTaskRequest.ProtoReflect.Descriptor instead.
func (*GetListScheduleTaskRequest) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{13}
return file_pb_cron_proto_rawDescGZIP(), []int{12}
}
func (x *GetListScheduleTaskRequest) GetPage() int32 {
@ -1427,7 +1344,7 @@ type GetListScheduleTaskResponse struct {
func (x *GetListScheduleTaskResponse) Reset() {
*x = GetListScheduleTaskResponse{}
mi := &file_pb_cron_proto_msgTypes[14]
mi := &file_pb_cron_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1439,7 +1356,7 @@ func (x *GetListScheduleTaskResponse) String() string {
func (*GetListScheduleTaskResponse) ProtoMessage() {}
func (x *GetListScheduleTaskResponse) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[14]
mi := &file_pb_cron_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1452,7 +1369,7 @@ func (x *GetListScheduleTaskResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetListScheduleTaskResponse.ProtoReflect.Descriptor instead.
func (*GetListScheduleTaskResponse) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{14}
return file_pb_cron_proto_rawDescGZIP(), []int{13}
}
func (x *GetListScheduleTaskResponse) GetCode() int32 {
@ -1513,7 +1430,7 @@ type GetListExecutionRecordRequest struct {
func (x *GetListExecutionRecordRequest) Reset() {
*x = GetListExecutionRecordRequest{}
mi := &file_pb_cron_proto_msgTypes[15]
mi := &file_pb_cron_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1525,7 +1442,7 @@ func (x *GetListExecutionRecordRequest) String() string {
func (*GetListExecutionRecordRequest) ProtoMessage() {}
func (x *GetListExecutionRecordRequest) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[15]
mi := &file_pb_cron_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1538,7 +1455,7 @@ func (x *GetListExecutionRecordRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetListExecutionRecordRequest.ProtoReflect.Descriptor instead.
func (*GetListExecutionRecordRequest) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{15}
return file_pb_cron_proto_rawDescGZIP(), []int{14}
}
func (x *GetListExecutionRecordRequest) GetPage() int32 {
@ -1611,7 +1528,7 @@ type GetListExecutionRecordResponse struct {
func (x *GetListExecutionRecordResponse) Reset() {
*x = GetListExecutionRecordResponse{}
mi := &file_pb_cron_proto_msgTypes[16]
mi := &file_pb_cron_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1623,7 +1540,7 @@ func (x *GetListExecutionRecordResponse) String() string {
func (*GetListExecutionRecordResponse) ProtoMessage() {}
func (x *GetListExecutionRecordResponse) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[16]
mi := &file_pb_cron_proto_msgTypes[15]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1636,7 +1553,7 @@ func (x *GetListExecutionRecordResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetListExecutionRecordResponse.ProtoReflect.Descriptor instead.
func (*GetListExecutionRecordResponse) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{16}
return file_pb_cron_proto_rawDescGZIP(), []int{15}
}
func (x *GetListExecutionRecordResponse) GetCode() int32 {
@ -1698,7 +1615,7 @@ type GetListExecutionResultRequest struct {
func (x *GetListExecutionResultRequest) Reset() {
*x = GetListExecutionResultRequest{}
mi := &file_pb_cron_proto_msgTypes[17]
mi := &file_pb_cron_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1710,7 +1627,7 @@ func (x *GetListExecutionResultRequest) String() string {
func (*GetListExecutionResultRequest) ProtoMessage() {}
func (x *GetListExecutionResultRequest) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[17]
mi := &file_pb_cron_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1723,7 +1640,7 @@ func (x *GetListExecutionResultRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetListExecutionResultRequest.ProtoReflect.Descriptor instead.
func (*GetListExecutionResultRequest) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{17}
return file_pb_cron_proto_rawDescGZIP(), []int{16}
}
func (x *GetListExecutionResultRequest) GetPage() int32 {
@ -1803,7 +1720,7 @@ type GetListExecutionResultResponse struct {
func (x *GetListExecutionResultResponse) Reset() {
*x = GetListExecutionResultResponse{}
mi := &file_pb_cron_proto_msgTypes[18]
mi := &file_pb_cron_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1815,7 +1732,7 @@ func (x *GetListExecutionResultResponse) String() string {
func (*GetListExecutionResultResponse) ProtoMessage() {}
func (x *GetListExecutionResultResponse) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[18]
mi := &file_pb_cron_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1828,7 +1745,7 @@ func (x *GetListExecutionResultResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetListExecutionResultResponse.ProtoReflect.Descriptor instead.
func (*GetListExecutionResultResponse) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{18}
return file_pb_cron_proto_rawDescGZIP(), []int{17}
}
func (x *GetListExecutionResultResponse) GetCode() int32 {
@ -1883,7 +1800,7 @@ type TaskStatus struct {
func (x *TaskStatus) Reset() {
*x = TaskStatus{}
mi := &file_pb_cron_proto_msgTypes[19]
mi := &file_pb_cron_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1895,7 +1812,7 @@ func (x *TaskStatus) String() string {
func (*TaskStatus) ProtoMessage() {}
func (x *TaskStatus) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[19]
mi := &file_pb_cron_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1908,7 +1825,7 @@ func (x *TaskStatus) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskStatus.ProtoReflect.Descriptor instead.
func (*TaskStatus) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{19}
return file_pb_cron_proto_rawDescGZIP(), []int{18}
}
func (x *TaskStatus) GetKey() int32 {
@ -1936,7 +1853,7 @@ type GetScheduleTaskStatusResponse struct {
func (x *GetScheduleTaskStatusResponse) Reset() {
*x = GetScheduleTaskStatusResponse{}
mi := &file_pb_cron_proto_msgTypes[20]
mi := &file_pb_cron_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1948,7 +1865,7 @@ func (x *GetScheduleTaskStatusResponse) String() string {
func (*GetScheduleTaskStatusResponse) ProtoMessage() {}
func (x *GetScheduleTaskStatusResponse) ProtoReflect() protoreflect.Message {
mi := &file_pb_cron_proto_msgTypes[20]
mi := &file_pb_cron_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1961,7 +1878,7 @@ func (x *GetScheduleTaskStatusResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetScheduleTaskStatusResponse.ProtoReflect.Descriptor instead.
func (*GetScheduleTaskStatusResponse) Descriptor() ([]byte, []int) {
return file_pb_cron_proto_rawDescGZIP(), []int{20}
return file_pb_cron_proto_rawDescGZIP(), []int{19}
}
func (x *GetScheduleTaskStatusResponse) GetCode() int32 {
@ -1989,7 +1906,7 @@ var File_pb_cron_proto protoreflect.FileDescriptor
const file_pb_cron_proto_rawDesc = "" +
"\n" +
"\rpb/cron.proto\x12\x04cron\"!\n" +
"\rpb/cron.proto\x12\x04cron\x1a\x1bgoogle/protobuf/empty.proto\"!\n" +
"\x0fCommonIDRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\rR\x02id\">\n" +
"\x0eCommonResponse\x12\x12\n" +
@ -2109,7 +2026,7 @@ const file_pb_cron_proto_rawDesc = "" +
"\x1aCreateScheduleTaskResponse\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12&\n" +
"\x04data\x18\x03 \x01(\v2\x12.cron.ScheduleTaskR\x04data\"\xae\x03\n" +
"\x04data\x18\x03 \x01(\v2\x12.cron.ScheduleTaskR\x04data\"\x9c\x03\n" +
"\x19UpdateScheduleTaskRequest\x12\x17\n" +
"\atask_id\x18\x01 \x01(\x04R\x06taskId\x12\x1d\n" +
"\n" +
@ -2125,16 +2042,9 @@ const file_pb_cron_proto_rawDesc = "" +
"\x12execute_start_time\x18\b \x01(\tR\x10executeStartTime\x12(\n" +
"\x10execute_end_time\x18\t \x01(\tR\x0eexecuteEndTime\x12\x16\n" +
"\x06remark\x18\n" +
" \x01(\tR\x06remark\x12J\n" +
"\vtask_detail\x18\v \x01(\v2).cron.UpdateScheduleTaskRequestTaskDetailR\n" +
"taskDetail\"\xd2\x01\n" +
"#UpdateScheduleTaskRequestTaskDetail\x12\x0e\n" +
"\x02id\x18\x05 \x01(\x05R\x02id\x12\x17\n" +
"\atask_id\x18\x06 \x01(\x05R\x06taskId\x12!\n" +
"\fartist_count\x18\x01 \x01(\x05R\vartistCount\x12*\n" +
"\aartists\x18\x02 \x03(\v2\x10.cron.ArtistInfoR\aartists\x12\x10\n" +
"\x03num\x18\x03 \x01(\x05R\x03num\x12!\n" +
"\fcontent_type\x18\x04 \x01(\x05R\vcontentType\"r\n" +
" \x01(\tR\x06remark\x128\n" +
"\vtask_detail\x18\v \x01(\v2\x17.cron.TaskDetailRequestR\n" +
"taskDetail\"r\n" +
"\x1aUpdateScheduleTaskResponse\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12&\n" +
@ -2223,30 +2133,29 @@ func file_pb_cron_proto_rawDescGZIP() []byte {
return file_pb_cron_proto_rawDescData
}
var file_pb_cron_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_pb_cron_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
var file_pb_cron_proto_goTypes = []any{
(*CommonIDRequest)(nil), // 0: cron.CommonIDRequest
(*CommonResponse)(nil), // 1: cron.CommonResponse
(*ScheduleTask)(nil), // 2: cron.ScheduleTask
(*TaskDetail)(nil), // 3: cron.TaskDetail
(*ArtistInfo)(nil), // 4: cron.ArtistInfo
(*ExecutionRecord)(nil), // 5: cron.ExecutionRecord
(*ExecutionResult)(nil), // 6: cron.ExecutionResult
(*CreateScheduleTaskRequest)(nil), // 7: cron.CreateScheduleTaskRequest
(*TaskDetailRequest)(nil), // 8: cron.TaskDetailRequest
(*CreateScheduleTaskResponse)(nil), // 9: cron.CreateScheduleTaskResponse
(*UpdateScheduleTaskRequest)(nil), // 10: cron.UpdateScheduleTaskRequest
(*UpdateScheduleTaskRequestTaskDetail)(nil), // 11: cron.UpdateScheduleTaskRequestTaskDetail
(*UpdateScheduleTaskResponse)(nil), // 12: cron.UpdateScheduleTaskResponse
(*GetListScheduleTaskRequest)(nil), // 13: cron.GetListScheduleTaskRequest
(*GetListScheduleTaskResponse)(nil), // 14: cron.GetListScheduleTaskResponse
(*GetListExecutionRecordRequest)(nil), // 15: cron.GetListExecutionRecordRequest
(*GetListExecutionRecordResponse)(nil), // 16: cron.GetListExecutionRecordResponse
(*GetListExecutionResultRequest)(nil), // 17: cron.GetListExecutionResultRequest
(*GetListExecutionResultResponse)(nil), // 18: cron.GetListExecutionResultResponse
(*TaskStatus)(nil), // 19: cron.TaskStatus
(*GetScheduleTaskStatusResponse)(nil), // 20: cron.GetScheduleTaskStatusResponse
nil, // 21: cron.GetListScheduleTaskRequest.SortsEntry
(*CommonIDRequest)(nil), // 0: cron.CommonIDRequest
(*CommonResponse)(nil), // 1: cron.CommonResponse
(*ScheduleTask)(nil), // 2: cron.ScheduleTask
(*TaskDetail)(nil), // 3: cron.TaskDetail
(*ArtistInfo)(nil), // 4: cron.ArtistInfo
(*ExecutionRecord)(nil), // 5: cron.ExecutionRecord
(*ExecutionResult)(nil), // 6: cron.ExecutionResult
(*CreateScheduleTaskRequest)(nil), // 7: cron.CreateScheduleTaskRequest
(*TaskDetailRequest)(nil), // 8: cron.TaskDetailRequest
(*CreateScheduleTaskResponse)(nil), // 9: cron.CreateScheduleTaskResponse
(*UpdateScheduleTaskRequest)(nil), // 10: cron.UpdateScheduleTaskRequest
(*UpdateScheduleTaskResponse)(nil), // 11: cron.UpdateScheduleTaskResponse
(*GetListScheduleTaskRequest)(nil), // 12: cron.GetListScheduleTaskRequest
(*GetListScheduleTaskResponse)(nil), // 13: cron.GetListScheduleTaskResponse
(*GetListExecutionRecordRequest)(nil), // 14: cron.GetListExecutionRecordRequest
(*GetListExecutionRecordResponse)(nil), // 15: cron.GetListExecutionRecordResponse
(*GetListExecutionResultRequest)(nil), // 16: cron.GetListExecutionResultRequest
(*GetListExecutionResultResponse)(nil), // 17: cron.GetListExecutionResultResponse
(*TaskStatus)(nil), // 18: cron.TaskStatus
(*GetScheduleTaskStatusResponse)(nil), // 19: cron.GetScheduleTaskStatusResponse
nil, // 20: cron.GetListScheduleTaskRequest.SortsEntry
}
var file_pb_cron_proto_depIdxs = []int32{
3, // 0: cron.ScheduleTask.task_detail:type_name -> cron.TaskDetail
@ -2256,19 +2165,18 @@ var file_pb_cron_proto_depIdxs = []int32{
8, // 4: cron.CreateScheduleTaskRequest.task_detail:type_name -> cron.TaskDetailRequest
4, // 5: cron.TaskDetailRequest.artists:type_name -> cron.ArtistInfo
2, // 6: cron.CreateScheduleTaskResponse.data:type_name -> cron.ScheduleTask
11, // 7: cron.UpdateScheduleTaskRequest.task_detail:type_name -> cron.UpdateScheduleTaskRequestTaskDetail
4, // 8: cron.UpdateScheduleTaskRequestTaskDetail.artists:type_name -> cron.ArtistInfo
2, // 9: cron.UpdateScheduleTaskResponse.data:type_name -> cron.ScheduleTask
21, // 10: cron.GetListScheduleTaskRequest.sorts:type_name -> cron.GetListScheduleTaskRequest.SortsEntry
2, // 11: cron.GetListScheduleTaskResponse.data:type_name -> cron.ScheduleTask
5, // 12: cron.GetListExecutionRecordResponse.data:type_name -> cron.ExecutionRecord
6, // 13: cron.GetListExecutionResultResponse.data:type_name -> cron.ExecutionResult
19, // 14: cron.GetScheduleTaskStatusResponse.data:type_name -> cron.TaskStatus
15, // [15:15] is the sub-list for method output_type
15, // [15:15] is the sub-list for method input_type
15, // [15:15] is the sub-list for extension type_name
15, // [15:15] is the sub-list for extension extendee
0, // [0:15] is the sub-list for field type_name
8, // 7: cron.UpdateScheduleTaskRequest.task_detail:type_name -> cron.TaskDetailRequest
2, // 8: cron.UpdateScheduleTaskResponse.data:type_name -> cron.ScheduleTask
20, // 9: cron.GetListScheduleTaskRequest.sorts:type_name -> cron.GetListScheduleTaskRequest.SortsEntry
2, // 10: cron.GetListScheduleTaskResponse.data:type_name -> cron.ScheduleTask
5, // 11: cron.GetListExecutionRecordResponse.data:type_name -> cron.ExecutionRecord
6, // 12: cron.GetListExecutionResultResponse.data:type_name -> cron.ExecutionResult
18, // 13: cron.GetScheduleTaskStatusResponse.data:type_name -> cron.TaskStatus
14, // [14:14] is the sub-list for method output_type
14, // [14:14] is the sub-list for method input_type
14, // [14:14] is the sub-list for extension type_name
14, // [14:14] is the sub-list for extension extendee
0, // [0:14] is the sub-list for field type_name
}
func init() { file_pb_cron_proto_init() }
@ -2282,7 +2190,7 @@ func file_pb_cron_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_cron_proto_rawDesc), len(file_pb_cron_proto_rawDesc)),
NumEnums: 0,
NumMessages: 22,
NumMessages: 21,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -7,6 +7,7 @@ import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/protobuf/types/known/emptypb"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
@ -96,16 +97,6 @@ func (this *UpdateScheduleTaskRequest) Validate() error {
}
return nil
}
func (this *UpdateScheduleTaskRequestTaskDetail) 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 *UpdateScheduleTaskResponse) Validate() error {
if this.Data != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil {