Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/develop' into develop

yuliang1112 1 gadu atpakaļ
vecāks
revīzija
677ea98603
1 mainītis faili ar 21 papildinājumiem un 11 dzēšanām
  1. 21 11
      service/selection_service/selection.go

+ 21 - 11
service/selection_service/selection.go

@@ -25,13 +25,13 @@ type selection struct {
 
 func (*selection) Create(ctx context.Context, request http_model.CreateSelectionRequest, enterpriseId string) (*http_model.CreateSelectionData, error) {
 	// 1. 检查该企业id和商品id有无选品
-	selectionInfo, err := db.GetSelectionByEnterpiseIdAndProductId(ctx, enterpriseId, conv.MustInt(request.ProductId, 0))
-	if err != nil {
-		return nil, err
-	}
-	if selectionInfo != nil {
-		return nil, errors.New("该商品下选品已存在")
-	}
+	//selectionInfo, err := db.GetSelectionByEnterpiseIdAndProductId(ctx, enterpriseId, conv.MustInt(request.ProductId, 0))
+	//if err != nil {
+	//	return nil, err
+	//}
+	//if selectionInfo != nil {
+	//	return nil, errors.New("该商品下选品已存在")
+	//}
 
 	// 2. 数据准备
 	// a) 生成选品id
@@ -48,6 +48,8 @@ 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)
 	newSelection := gorm_model.YounggeeSelectionInfo{
 		SelectionID:      selectionId,
 		SelectionName:    selectionName,
@@ -56,8 +58,17 @@ 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(),
+		CreatedAt:        time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC),
+		SubmitAt:         time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC),
+		PassAt:           time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC),
+		PayAt:            time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC),
+		FinishAt:         time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC),
+		TaskDdl:          taskDdl,
+		EstimatedCost:    "0",
+		TaskReward:       "0",
+		SettlementAmount: "0",
 	}
+	//Selection := gorm_model.YounggeeSelectionInfo{}
 	err = db.CreateSelection(ctx, newSelection)
 	if err != nil {
 		return nil, err
@@ -98,9 +109,8 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
 	estimatedCostToString, _ := conv.String(estimatedCost)
 	// d) 任务截止时间
 	taskDdl := time.Time{} //赋零值
-	if request.TaskDdl != "" {
-		taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", request.TaskDdl, time.Local)
-	}
+
+	taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", request.TaskDdl, time.Local)
 
 	updateSelection := gorm_model.YounggeeSelectionInfo{
 		SelectionID:      request.SelectionID,