|
@@ -50,9 +50,11 @@ func (*selection) Create(ctx context.Context, request http_model.CreateSelection
|
|
|
selectionName := product.BrandName + "-" + product.ProductName
|
|
|
|
|
|
// 3. 创建选品
|
|
|
- taskDdl := time.Time{} //赋零值
|
|
|
- taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", "2026-01-01 08:00:00", time.Local)
|
|
|
+ //taskDdl := time.Time{} //赋零值
|
|
|
+ //taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", "2026-01-01 08:00:00", time.Local)
|
|
|
+ t := time.Now()
|
|
|
newSelection := gorm_model.YounggeeSelectionInfo{
|
|
|
+ SelectionStatus: 1,
|
|
|
SelectionID: selectionId,
|
|
|
SelectionName: selectionName,
|
|
|
ProductID: conv.MustInt(request.ProductId, 0),
|
|
@@ -60,8 +62,8 @@ func (*selection) Create(ctx context.Context, request http_model.CreateSelection
|
|
|
Platform: conv.MustInt(request.Platform, 0),
|
|
|
ProductSnap: string(productInfoToJson),
|
|
|
ProductPhotoSnap: string(productPhotosToJson),
|
|
|
- CreatedAt: time.Now(),
|
|
|
- TaskDdl: taskDdl,
|
|
|
+ CreatedAt: &t,
|
|
|
+ UpdatedAt: &t,
|
|
|
EstimatedCost: "0",
|
|
|
TaskReward: "0",
|
|
|
SettlementAmount: "0",
|
|
@@ -107,6 +109,7 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
|
|
|
request.SelectionStatus = 1
|
|
|
}
|
|
|
|
|
|
+ t := time.Now()
|
|
|
updateSelection := gorm_model.YounggeeSelectionInfo{
|
|
|
SelectionID: request.SelectionID,
|
|
|
SelectionStatus: request.SelectionStatus,
|
|
@@ -126,13 +129,12 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
|
|
|
EstimatedCost: selectionInfo.EstimatedCost,
|
|
|
SampleCondition: request.SampleCondition,
|
|
|
RewardCondition: request.RewardCondition,
|
|
|
- TaskDdl: taskDdl,
|
|
|
+ TaskDdl: &taskDdl,
|
|
|
Detail: request.Detail,
|
|
|
ProductSnap: string(productInfoToJson),
|
|
|
ProductPhotoSnap: string(productPhotosToJson),
|
|
|
CreatedAt: selectionInfo.CreatedAt,
|
|
|
- UpdatedAt: time.Now(),
|
|
|
- SubmitAt: time.Now(),
|
|
|
+ UpdatedAt: &t,
|
|
|
}
|
|
|
// 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
|
|
|
result := util.MergeStructValue(&updateSelection, selectionInfo)
|
|
@@ -242,10 +244,11 @@ func (*selection) Pay(ctx context.Context, request http_model.PaySelectionReques
|
|
|
}
|
|
|
|
|
|
func (*selection) Submit(ctx context.Context, request http_model.SubmitSelectionRequest) (*http_model.SubmitSelectionData, error) {
|
|
|
+ t := time.Now()
|
|
|
updateSelection := gorm_model.YounggeeSelectionInfo{
|
|
|
SelectionID: request.SelectionId,
|
|
|
SelectionStatus: request.SelectionStatus,
|
|
|
- SubmitAt: time.Now(),
|
|
|
+ SubmitAt: &t,
|
|
|
}
|
|
|
|
|
|
err := db.UpdateSelection(ctx, updateSelection)
|
|
@@ -321,11 +324,12 @@ func (*selection) Review(ctx context.Context, request http_model.ReviewSelection
|
|
|
}
|
|
|
|
|
|
// 若审核通过则更新选品阶段为待支付,否则更新为失效并赋值失效原因
|
|
|
+ t := time.Now()
|
|
|
if request.IsPass == 1 {
|
|
|
updateSelection := gorm_model.YounggeeSelectionInfo{
|
|
|
SelectionID: request.SelectionId,
|
|
|
SelectionStatus: 4,
|
|
|
- PassAt: time.Now(),
|
|
|
+ PassAt: &t,
|
|
|
EstimatedCost: estimatedCostToString,
|
|
|
}
|
|
|
err = db.UpdateSelection(ctx, updateSelection)
|
|
@@ -338,7 +342,7 @@ func (*selection) Review(ctx context.Context, request http_model.ReviewSelection
|
|
|
SelectionID: request.SelectionId,
|
|
|
SelectionStatus: 7,
|
|
|
FailReason: 2,
|
|
|
- PassAt: time.Now(),
|
|
|
+ PassAt: &t,
|
|
|
EstimatedCost: estimatedCostToString,
|
|
|
}
|
|
|
err = db.UpdateSelection(ctx, updateSelection)
|