Преглед изворни кода

修改专项新增物流信息api

“liushuai” пре 2 година
родитељ
комит
137d6762d9
2 измењених фајлова са 11 додато и 4 уклоњено
  1. 5 4
      service/auto_task.go
  2. 6 0
      service/logistics.go

+ 5 - 4
service/auto_task.go

@@ -2,14 +2,15 @@ package service
 
 import (
 	"context"
-	"github.com/caixw/lib.go/conv"
-	"github.com/robfig/cron/v3"
-	"github.com/sirupsen/logrus"
 	"log"
 	"time"
 	"youngee_m_api/consts"
 	"youngee_m_api/db"
 	"youngee_m_api/model/gorm_model"
+
+	"github.com/caixw/lib.go/conv"
+	"github.com/robfig/cron/v3"
+	"github.com/sirupsen/logrus"
 )
 
 func AutoTask() error {
@@ -205,7 +206,7 @@ func AutoTask() error {
 	//定时任务
 	//spec := "*/30 * * * * ?" //cron表达式,每30秒一次
 	spec := "0 */1 * * * ?" //cron表达式,每一分钟执行一次
-	//spec := "0 0 * * * *" //每小时执行
+	// spec := "0 0 * * * *" //每小时执行
 	// 添加定时任务,
 	_, err := crontab.AddFunc("0 0 * * * *", taskKDStatus)
 	//_, err := crontab.AddFunc("*/30 * * * * ?", taskKDStatus)

+ 6 - 0
service/logistics.go

@@ -148,6 +148,12 @@ func (l *logistics) CreateSpecialLogistics(ctx context.Context, newLogistics htt
 		logrus.WithContext(ctx).Errorf("[logistics service] call UpdateLogisticsDate error,err:%+v", err)
 		return nil, err
 	}
+	// 修改task_info中发货状态
+	err = db.UpdateLogisticsStatus(ctx, Logistics.TaskID, 2)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[logistics service] call UpdateLogisticsStatus error,err:%+v", err)
+		return nil, err
+	}
 	// 修改task_info中任务阶段
 	err = db.UpdateTaskStageByTaskId(ctx, Logistics.TaskID, 2, 5) //修改为待传初稿
 	if err != nil {