This commit is contained in:
lzh
2025-07-14 13:38:45 +08:00
parent b4c7ab9f2c
commit 5356eb4199
2 changed files with 4 additions and 8 deletions

View File

@@ -57,10 +57,8 @@ func (r *Response) SetCode(code int) *Response {
func (r *Response) SetMessage(msg any) *Response { func (r *Response) SetMessage(msg any) *Response {
if str, ok := msg.(string); ok { if str, ok := msg.(string); ok {
r.Msg = str r.Msg = str
} else { } else if err, ok := msg.(error); ok {
if err, ok := msg.(error); ok {
r.Msg = err.Error() r.Msg = err.Error()
} }
}
return r return r
} }

View File

@@ -121,11 +121,9 @@ func (t *TaskJob) InitCronHandle() error {
func (t *TaskJob) EditStatus(status bool) error { func (t *TaskJob) EditStatus(status bool) error {
if t.Cron != nil && !status { if t.Cron != nil && !status {
t.Cron.Stop() t.Cron.Stop()
} else { } else if err := t.InitCronHandle(); err != nil {
if err := t.InitCronHandle(); err != nil {
return err return err
} }
}
t.TaskConfig.Enable = status t.TaskConfig.Enable = status
return nil return nil
} }