Kaynağa Gözat

selection_logistic_condition

Xingyu Xian 3 hafta önce
ebeveyn
işleme
9a4c9fdbb0

+ 2 - 0
model/gorm_model/selection_task_info.go

@@ -49,6 +49,8 @@ type YounggeeSecTaskInfo struct {
 	OpenID                 string     `gorm:"column:open_id;size:255" json:"open_id" comment:"账号唯一标识"`
 	WxNum                  string     `gorm:"column:wx_num;size:255" json:"wx_num" comment:"微信号"`
 	BOperator              string     `gorm:"column:b_operator;size:255" json:"b_operator" comment:"ID"`
+	CreateLogisticUserType int        `gorm:"column:create_logistic_user_type"` // 创建快递单类型
+	CreateLogisticUserId   string     `gorm:"column:create_logistic_user_id"`   // 创建快递单ID
 }
 
 func (m *YounggeeSecTaskInfo) TableName() string {

+ 2 - 0
model/http_model/CreateSecTaskLogistics.go

@@ -8,6 +8,8 @@ type CreateSecTaskLogisticsRequest struct {
 	ExplorestoreEndtime   string `json:"explorestore_endtime"`   // 线下探店-探店结束时间
 	ExplorestorePeriod    string `json:"explorestore_period"`    // 线下探店-探店持续时间
 	ThingsType            int    `json:"things_type"`            // 产品类型 1:实物, 3:线下探店
+	EnterpriseId          string `json:"enterprise_id"`          // 商家ID
+	SubAccountId          int    `json:"sub_account_id"`         // 子账号ID
 }
 
 type CreateSecTaskLogisticsData struct {

+ 3 - 3
model/http_model/logistics_create.go

@@ -1,7 +1,7 @@
 package http_model
 
 type CreateLogisticsRequest struct {
-	StrategyID            int64  `json:"strategy_id"`             //招募策略id
+	StrategyID            int64  `json:"strategy_id"`             // 招募策略id
 	LogisticsID           int64  `json:"logistics_id"`            // 货物-id
 	CompanyName           string `json:"company_name"`            // 实物商品-物流公司名称
 	LogisticsNumber       string `json:"logistics_number"`        // 实物商品-物流单号
@@ -11,8 +11,8 @@ type CreateLogisticsRequest struct {
 	CouponCodeInformation string `json:"coupon_code_information"` // 虚拟产品-券码信息
 	TaskID                string `json:"task_id"`                 // 任务id
 	DeliveryTime          string `json:"delivery_time"`           // 发货时间
-	ThingsType            int    `json:"things_type"`             //产品类型 1:实物, 2:虚拟产品,3:线下探店
-	IsUpdate              int    `json:"is_update"`               //更新标志位 0:不更新 1:更新
+	ThingsType            int    `json:"things_type"`             // 产品类型 1:实物, 2:虚拟产品,3:线下探店
+	IsUpdate              int    `json:"is_update"`               // 更新标志位 0:不更新 1:更新
 }
 
 type CreateLogisticsData struct {

+ 3 - 0
service/logistics.go

@@ -73,6 +73,7 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 		logrus.WithContext(ctx).Errorf("[project service] call UpdateLogisticsNumber error,err:%+v", err)
 		return nil, err
 	}
+
 	// 修改task_info中发货状态
 	err = db.UpdateLogisticsStatus(ctx, Logistics.TaskID, 2)
 	if err != nil {
@@ -86,6 +87,7 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 		logrus.WithContext(ctx).Errorf("[logistics service] call UpdateLogisticsDate error,err:%+v", err)
 		return nil, err
 	}
+
 	// 修改task_info中任务阶段
 	err = db.UpdateTaskStageByTaskId(ctx, Logistics.TaskID, 2, 5) //修改为待传初稿
 	if err != nil {
@@ -111,6 +113,7 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 	res := &http_model.CreateLogisticsData{
 		LogisticsID: *logisticsID,
 	}
+
 	return res, nil
 }
 

+ 18 - 5
service/sectask_service/logistics.go

@@ -2,6 +2,7 @@ package sectask_service
 
 import (
 	"context"
+	"github.com/issue9/conv"
 	"github.com/sirupsen/logrus"
 	"time"
 	"youngee_b_api/db"
@@ -41,13 +42,25 @@ func (*logistics) Create(ctx context.Context, request http_model.CreateSecTaskLo
 		return nil, err
 	}
 
+	var createLogisticUserType int
+	var createLogisticUserId string
+	if request.SubAccountId == 0 {
+		createLogisticUserType = 1
+		createLogisticUserId = request.EnterpriseId
+	} else if request.SubAccountId != 0 {
+		createLogisticUserType = 2
+		createLogisticUserId = conv.MustString(request.SubAccountId)
+	}
+
 	// 修改task_info中发货时间、任务阶段
 	updatdSecTask := gorm_model.YounggeeSecTaskInfo{
-		TaskID:          request.TaskID,
-		LogisticsStatus: 2,
-		TaskStage:       8,
-		DeliveryDate:    time.Now(),
-		FreeStage:       4,
+		TaskID:                 request.TaskID,
+		LogisticsStatus:        2,
+		TaskStage:              8,
+		DeliveryDate:           time.Now(),
+		FreeStage:              4,
+		CreateLogisticUserId:   createLogisticUserId,
+		CreateLogisticUserType: createLogisticUserType,
 	}
 
 	_, err = db.UpdateSecTask(ctx, updatdSecTask)