conflict-test-feat-20240117-001 #88
|
@ -737,14 +737,14 @@ func (m *Mysql) GetWithdrawOrdersByMid(ctx *gin.Context, tx *sqlx.Tx, mid, st, e
|
|||
}
|
||||
|
||||
// 获取指定任务中所有已经执行成功的xxl_job任务
|
||||
func (m *Mysql) GetSuccessXxlJobLogs(ctx *gin.Context, tx *sqlx.Tx, jobId int64, errorPrefix string) (list []*dbstruct.XxlJobLog, err error) {
|
||||
func (m *Mysql) GetSuccessXxlJobLogs(ctx *gin.Context, tx *sqlx.Tx, jobIdsStr string, errorPrefix string) (list []*dbstruct.XxlJobLog, err error) {
|
||||
list = make([]*dbstruct.XxlJobLog, 0)
|
||||
sqlStr := fmt.Sprintf("select * from %s where job_id = ? and trigger_code = 200 and handle_code = 200 and trigger_msg not like (?%%)", TableXxlJobLog)
|
||||
sqlStr := fmt.Sprintf("select * from %s where job_id in (%s) and trigger_code = 200 and handle_code = 200 and trigger_msg not like ?", TableXxlJobLog, jobIdsStr)
|
||||
if tx != nil {
|
||||
err = tx.SelectContext(ctx, &list, sqlStr, jobId, errorPrefix)
|
||||
err = tx.SelectContext(ctx, &list, sqlStr, "%"+errorPrefix)
|
||||
} else {
|
||||
db := m.getDBXxlJob()
|
||||
err = db.SelectContext(ctx, &list, sqlStr, jobId, errorPrefix)
|
||||
err = db.SelectContext(ctx, &list, sqlStr, "%"+errorPrefix)
|
||||
}
|
||||
if err == sql.ErrNoRows {
|
||||
err = nil
|
||||
|
@ -758,7 +758,10 @@ func (m *Mysql) GetSuccessXxlJobLogs(ctx *gin.Context, tx *sqlx.Tx, jobId int64,
|
|||
|
||||
// 删除指定任务中所有已经执行成功的xxl_job任务
|
||||
func (m *Mysql) DeleteSuccessXxlJobLogs(ctx *gin.Context, tx *sqlx.Tx, ids []int64) (err error) {
|
||||
sqlStr := fmt.Sprintf("delete * from %s where id in (%s)", TableXxlJobLog, util.Convert2SqlArr(ids))
|
||||
if len(ids) == 0 {
|
||||
return
|
||||
}
|
||||
sqlStr := fmt.Sprintf("delete from %s where id in (%s)", TableXxlJobLog, util.Convert2SqlArr(ids))
|
||||
if tx != nil {
|
||||
_, err = tx.ExecContext(ctx, sqlStr)
|
||||
} else {
|
||||
|
|
|
@ -25,11 +25,11 @@ func NewXxlJob(store *dao.Store, cfg *configcenter.XxlJobConfig) (x *XxlJob) {
|
|||
}
|
||||
}
|
||||
|
||||
func (x *XxlJob) ClearSuccXxlJobLogs(ctx *gin.Context, jobId int64, errorPrefix string) (err error) {
|
||||
func (x *XxlJob) ClearSuccXxlJobLogs(ctx *gin.Context, jobIdsStr string, errorPrefix string) (err error) {
|
||||
// 查出当天所有已成功的日志
|
||||
list, err := x.store.GetSuccessXxlJobLogs(ctx, nil, jobId, errorPrefix)
|
||||
list, err := x.store.GetSuccessXxlJobLogs(ctx, nil, jobIdsStr, errorPrefix)
|
||||
if err != nil {
|
||||
logger.Error("GetSuccessXxlJobLogs fail, err: %v, jodId: %v, errorPrefix: %v", err, jobId, errorPrefix)
|
||||
logger.Error("GetSuccessXxlJobLogs fail, err: %v, jodId: %v, errorPrefix: %v", err, jobIdsStr, errorPrefix)
|
||||
return
|
||||
}
|
||||
ids := make([]int64, 0)
|
||||
|
|
|
@ -15,7 +15,6 @@ import (
|
|||
"service/library/contentaudit/textaudit"
|
||||
"service/library/logger"
|
||||
"service/library/redis"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -187,15 +186,10 @@ func (s *CronService) ClearContentAuditBatchExecutionLogs(ctx context.Context, p
|
|||
if len(inParams) < 2 {
|
||||
return "Wrong executor params format!"
|
||||
}
|
||||
jobId := inParams[0]
|
||||
jobIdsStr := inParams[0]
|
||||
errorPrefix := inParams[1]
|
||||
|
||||
jobIdVal, err := strconv.Atoi(jobId)
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
|
||||
err = _DefaultXxlJob.ClearSuccXxlJobLogs(&gin.Context{}, int64(jobIdVal), errorPrefix)
|
||||
err := _DefaultXxlJob.ClearSuccXxlJobLogs(&gin.Context{}, jobIdsStr, errorPrefix)
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
|
|
|
@ -98,4 +98,4 @@ xxl_job:
|
|||
executor_ip: "127.0.0.1"
|
||||
executor_port: "9801"
|
||||
registry_key: "golang-jobs-executor"
|
||||
log_path: "/Users/erwin/log/wishpal-ironfan/xxl_job"
|
||||
log_path: "/app/ironfan/log/xxl_job/"
|
Loading…
Reference in New Issue