|
@@ -21,7 +21,7 @@ type logistics struct {
|
|
|
// 在物流信息表插入记录
|
|
|
func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogisticsRequest) (*http_model.CreateLogisticsData, error) {
|
|
|
ThingsType := newLogistics.ThingsType
|
|
|
- RecruitStrategyID := newLogistics.RecruitStrategyID
|
|
|
+ StrategyID := newLogistics.StrategyID
|
|
|
Logistics := gorm_model.YoungeeTaskLogistics{
|
|
|
LogisticsID: newLogistics.LogisticsID,
|
|
|
TaskID: newLogistics.TaskID,
|
|
@@ -46,15 +46,30 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
|
|
|
Logistics.CouponCodeInformation = newLogistics.CouponCodeInformation
|
|
|
}
|
|
|
|
|
|
- logisticsID, err := db.CreateLogistics(ctx, Logistics, RecruitStrategyID)
|
|
|
+ logisticsID, err := db.CreateLogistics(ctx, Logistics, StrategyID)
|
|
|
if err != nil {
|
|
|
logrus.WithContext(ctx).Errorf("[logistics service] call CreateLogistics error,err:%+v", err)
|
|
|
return nil, err
|
|
|
}
|
|
|
- // 修改招募策略中已发货待发货数量
|
|
|
- err = db.UpdateLogisticsNumber(ctx, RecruitStrategyID, 1, -1, 0)
|
|
|
+
|
|
|
+ projectId, err1 := db.GetProjectIdByTaskId(ctx, newLogistics.TaskID)
|
|
|
+ if err1 != nil {
|
|
|
+ logrus.WithContext(ctx).Errorf("[project service] call GetProjectIdByTaskId error,err:%+v", err1)
|
|
|
+ return nil, err1
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询StrategyID 通过 StrategyID 和 projectId
|
|
|
+ RecruitStrategyId, err2 := db.GetRecruitStrategyIdByTS(ctx, *projectId, StrategyID)
|
|
|
+ if err2 != nil {
|
|
|
+ logrus.WithContext(ctx).Errorf("[project service] call GetStrategyIDByTS error,err:%+v", err1)
|
|
|
+ return nil, err2
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println("RecruitStrategyId: ", *RecruitStrategyId)
|
|
|
+ // 修改招募策略中已签收数量
|
|
|
+ err = db.UpdateLogisticsNumber(ctx, *RecruitStrategyId, 1, -1, 0)
|
|
|
if err != nil {
|
|
|
- logrus.WithContext(ctx).Errorf("[logistics service] call UpdateLogisticsNumber error,err:%+v", err)
|
|
|
+ logrus.WithContext(ctx).Errorf("[project service] call UpdateLogisticsNumber error,err:%+v", err)
|
|
|
return nil, err
|
|
|
}
|
|
|
// 修改task_info中发货状态
|
|
@@ -129,15 +144,15 @@ func (*logistics) SignForReceipt(ctx *gin.Context, data http_model.SignForReceip
|
|
|
return err1
|
|
|
}
|
|
|
|
|
|
- // 查询recruitStrategyID 通过 StrategyID 和 projectId
|
|
|
- recruitStrategyId, err2 := db.GetRecruitStrategyIdByTS(ctx, *projectId, strategyId)
|
|
|
+ // 查询StrategyID 通过 StrategyID 和 projectId
|
|
|
+ StrategyID, err2 := db.GetRecruitStrategyIdByTS(ctx, *projectId, strategyId)
|
|
|
if err2 != nil {
|
|
|
- logrus.WithContext(ctx).Errorf("[project service] call GetRecruitStrategyIdByTS error,err:%+v", err1)
|
|
|
+ logrus.WithContext(ctx).Errorf("[project service] call GetStrategyIDByTS error,err:%+v", err1)
|
|
|
return err2
|
|
|
}
|
|
|
|
|
|
// 修改招募策略中已签收数量
|
|
|
- err = db.UpdateLogisticsNumber(ctx, *recruitStrategyId, 0, 0, 1)
|
|
|
+ err = db.UpdateLogisticsNumber(ctx, *StrategyID, 0, 0, 1)
|
|
|
if err != nil {
|
|
|
logrus.WithContext(ctx).Errorf("[project service] call UpdateLogisticsNumber error,err:%+v", err)
|
|
|
return err
|