yuliang 1 سال پیش
والد
کامیت
dd70ca2017

+ 0 - 0
.idea/shelf/Uncommitted_changes_before_Update_at_2023_10_25_18_28_[更改]/shelved.patch


+ 0 - 4
.idea/shelf/Uncommitted_changes_before_Update_at_2023_10_25_18_28___.xml

@@ -1,4 +0,0 @@
-<changelist name="Uncommitted_changes_before_Update_at_2023_10_25_18_28_[更改]" date="1698229868485" recycled="true" deleted="true">
-  <option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2023_10_25_18_28_[更改]/shelved.patch" />
-  <option name="DESCRIPTION" value="Uncommitted changes before Update at 2023/10/25 18:28 [更改]" />
-</changelist>

+ 7 - 7
model/gorm_model/selection_info.go

@@ -23,17 +23,17 @@ type YounggeeSelectionInfo struct {
 	SampleCondition  string    `gorm:"column:sample_condition"`         // 领样条件
 	RewardCondition  string    `gorm:"column:reward_condition"`         // 返现悬赏条件
 	SettlementAmount string    `gorm:"column:settlement_amount"`        // 结算金额
-	TaskDdl          time.Time `gorm:"column:task_ddl"`                 // 招募截止时间
+	TaskDdl          *time.Time `gorm:"column:task_ddl"`                 // 招募截止时间
 	Detail           string    `gorm:"column:detail"`                   // 卖点总结
 	ProductSnap      string    `gorm:"column:product_snap"`             // 商品信息快照
 	ProductPhotoSnap string    `gorm:"column:product_photo_snap"`       // 商品图片快照
-	CreatedAt        time.Time `gorm:"column:created_at"`               // 创建时间
-	UpdatedAt        time.Time `gorm:"column:updated_at"`               // 修改时间
-	SubmitAt         time.Time `gorm:"column:submit_at"`                // 提交审核时间
-	PassAt           time.Time `gorm:"column:pass_at"`                  // 审核通过时间
+	CreatedAt        *time.Time `gorm:"column:created_at"`               // 创建时间
+	UpdatedAt        *time.Time `gorm:"column:updated_at"`               // 修改时间
+	SubmitAt         *time.Time `gorm:"column:submit_at"`                // 提交审核时间
+	PassAt           *time.Time `gorm:"column:pass_at"`                  // 审核通过时间
 	FailReason       int       `gorm:"column:fail_reason"`              // 失效原因,1、2分别表示逾期未支付、项目存在风险
-	PayAt            time.Time `gorm:"column:pay_at"`                   // 支付时间
-	FinishAt         time.Time `gorm:"column:finish_at"`                // 结案时间
+	PayAt            *time.Time `gorm:"column:pay_at"`                   // 支付时间
+	FinishAt         *time.Time `gorm:"column:finish_at"`                // 结案时间
 	IsRead           int       `gorm:"column:is_read"`                  // 是否已读
 }
 

+ 14 - 10
service/selection.go

@@ -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)