“liushuai” 1 år sedan
förälder
incheckning
45b177bc52
3 ändrade filer med 38 tillägg och 94 borttagningar
  1. 15 77
      .idea/workspace.xml
  2. 7 6
      model/http_model/UpdateSelectionRequest.go
  3. 16 11
      service/selection.go

+ 15 - 77
.idea/workspace.xml

@@ -5,69 +5,7 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="8dde75a1-d1c1-4fc1-81a0-4db9a43a6250" name="更改" comment="">
-      <change beforePath="$PROJECT_DIR$/.history/db/Settle_20230409143823.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/Settle_20230409145238.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/Settle_20230409154616.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/Settle_20230409154618.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/Settle_20230409154646.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/Settle_20230409154651.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/Settle_20230409154652.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/Settle_20230409160253.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/number_info_20230408160507.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/number_info_20230408223420.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/db/number_info_20230408223440.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/SpecialTaskDataList_20230408160507.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/SpecialTaskDataList_20230409142026.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/SpecialTaskDataList_20230409142031.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/SpecialTaskDataList_20230409142144.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/SpecialTaskDataList_20230409142154.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/SpecialTaskDataList_20230409142300.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/getSpecialSettleNumber_20230408221028.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/getSpecialSettleNumber_20230408221059.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/getSpecialSettleNumber_20230408221432.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/getSpecialSettleNumber_20230408221554.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/specialTaskSettleList_20230409141710.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/handler/specialTaskSettleList_20230409153734.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/common_model/talent_condition_20230408160507.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/common_model/talent_condition_20230409150405.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/SpecialTaskSettleList_20230409142613.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/SpecialTaskSettleList_20230409142759.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/SpecialTaskSettleList_20230409142857.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/SpecialTaskSettleList_20230409142918.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/SpecialTaskSettleList_20230409142920.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/SpecialTaskSettleList_20230409150325.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/SpecialTaskSettleList_20230409150554.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/getSpecialSettleNumber_20230408221230.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/getSpecialSettleNumber_20230408221426.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/model/http_model/getSpecialSettleNumber_20230408221548.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/pack/special_task_settle_list_20230409153856.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/pack/special_task_settle_list_20230409154145.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/pack/special_task_settle_list_20230409154146.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/pack/special_task_settle_list_condition_20230409150222.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/pack/special_task_settle_list_condition_20230409150439.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/route/init_20230408160508.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/route/init_20230409135907.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/route/init_20230409140943.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/route/init_20230409141000.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/route/init_20230409141016.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/route/init_20230409153621.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/SpecialTask_20230408160508.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/SpecialTask_20230409143447.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/SpecialTask_20230409155535.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/auto_task_20230408211730.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/auto_task_20230408215853.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/data_20230408160508.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/data_20230408215043.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/number_info_20230408160508.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.history/service/number_info_20230408223501.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/go.imports.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/watcherTasks.xml" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/model/http_model/CreateSelectionRequest.go" beforeDir="false" afterPath="$PROJECT_DIR$/model/http_model/CreateSelectionRequest.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/model/http_model/FindAllSelectionRequest.go" beforeDir="false" afterPath="$PROJECT_DIR$/model/http_model/FindAllSelectionRequest.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/model/http_model/UpdateSelectionRequest.go" beforeDir="false" afterPath="$PROJECT_DIR$/model/http_model/UpdateSelectionRequest.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/service/auto_task.go" beforeDir="false" afterPath="$PROJECT_DIR$/service/auto_task.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -83,21 +21,21 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "RunOnceActivity.OpenProjectViewOnStart": "true",
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "RunOnceActivity.go.formatter.settings.were.checked": "true",
-    "RunOnceActivity.go.migrated.go.modules.settings": "true",
-    "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
-    "WebServerToolWindowFactoryState": "false",
-    "go.import.settings.migrated": "true",
-    "go.sdk.automatically.set": "true",
-    "last_opened_file_path": "C:/Users/ls",
-    "node.js.detected.package.eslint": "true",
-    "node.js.selected.package.eslint": "(autodetect)"
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.go.formatter.settings.were.checked&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.go.migrated.go.modules.settings&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.go.modules.go.list.on.any.changes.was.set&quot;: &quot;true&quot;,
+    &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
+    &quot;go.import.settings.migrated&quot;: &quot;true&quot;,
+    &quot;go.sdk.automatically.set&quot;: &quot;true&quot;,
+    &quot;last_opened_file_path&quot;: &quot;C:/Users/ls&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;
   }
-}]]></component>
+}</component>
   <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
   <component name="TypeScriptGeneratedFilesManager">
     <option name="version" value="3" />

+ 7 - 6
model/http_model/UpdateSelectionRequest.go

@@ -3,6 +3,7 @@ package http_model
 type UpdateSelectionRequest struct {
 	EnterpriseId     string            `json:"enterprise_id"`
 	SelectionID      string            `json:"selection_id"` // 选品项目id
+	SelectionStatus  string            `json:"selection_status"`
 	Platform         int               `json:"platform"`
 	ProductId        string            `json:"product_id"`
 	ContentType      int               `json:"content_type"`
@@ -23,15 +24,15 @@ type UpdateSelectionRequest struct {
 }
 
 type SecBriefInfo struct {
-	FileUrl  string `json:"file_url"`
-	FileUid  string `json:"file_uid"`
-	FileName string `json:"file_name"`
+	PhotoUrl string `json:"photo_url"`
+	PhotoUid string `json:"photo_uid"`
+	Name     string `json:"name"`
 }
 
 type SecExampleInfo struct {
-	FileUrl  string `json:"file_url"`
-	FileUid  string `json:"file_uid"`
-	FileName string `json:"file_name"`
+	PhotoUrl string `json:"photo_url"`
+	PhotoUid string `json:"photo_uid"`
+	Name     string `json:"name"`
 }
 
 type UpdateSelectionData struct {

+ 16 - 11
service/selection.go

@@ -4,8 +4,6 @@ import (
 	"context"
 	"encoding/json"
 	"errors"
-	"github.com/gin-gonic/gin"
-	"github.com/sirupsen/logrus"
 	"reflect"
 	"time"
 	"youngee_m_api/db"
@@ -15,6 +13,9 @@ import (
 	"youngee_m_api/pack"
 	"youngee_m_api/util"
 
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+
 	"github.com/caixw/lib.go/conv"
 )
 
@@ -102,24 +103,21 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
 	productPhotosToJson, _ := json.Marshal(productPhotos)
 	// b) 选品名称
 	selectionName := product.BrandName + "-" + product.ProductName
-	// c) 计算预估成本(如果有)
-	var estimatedCost float64
-	if conv.MustInt(request.TaskMode, 0) == 1 {
-		estimatedCost = conv.MustFloat64(request.TaskReward, 0) * conv.MustFloat64(request.SampleNum, 0)
-	}
-	estimatedCostToString, _ := conv.String(estimatedCost)
 	// d) 任务截止时间
 	taskDdl := time.Time{} //赋零值
-
 	taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", request.TaskDdl, time.Local)
 
+	if request.SelectionStatus != "2" && request.SelectionStatus != "7" {
+		request.SelectionStatus = "1"
+	}
+
 	updateSelection := gorm_model.YounggeeSelectionInfo{
 		SelectionID:      request.SelectionID,
 		SelectionName:    selectionName,
 		EnterpriseID:     enterpriseId,
 		ProductID:        conv.MustInt(request.ProductId, 0),
 		ContentType:      conv.MustInt(request.ContentType, 0),
-		SelectionStatus:  1,
+		SelectionStatus:  selectionInfo.SelectionStatus,
 		TaskMode:         conv.MustInt(request.TaskMode, 0),
 		Platform:         conv.MustInt(request.Platform, 0),
 		SampleMode:       conv.MustInt(request.SampleMode, 0),
@@ -129,7 +127,7 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
 		CommissionRate:   conv.MustInt(request.CommissionRate, 0),
 		TaskReward:       conv.MustString(request.TaskReward, "0"),
 		SettlementAmount: conv.MustString(request.SettlementAmount, "0"),
-		EstimatedCost:    estimatedCostToString,
+		EstimatedCost:    selectionInfo.EstimatedCost,
 		SampleCondition:  request.SampleCondition,
 		RewardCondition:  request.RewardCondition,
 		TaskDdl:          taskDdl,
@@ -148,6 +146,13 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
 		updateSelection = v.Interface().(gorm_model.YounggeeSelectionInfo)
 		//fmt.Println(p)
 	}
+	// c) 计算预估成本(如果有)
+	var estimatedCost float64
+	if conv.MustInt(request.TaskMode, 0) == 1 {
+		estimatedCost = conv.MustFloat64(request.TaskReward, 0) * conv.MustFloat64(request.SampleNum, 0)
+	}
+	estimatedCostToString, _ := conv.String(estimatedCost)
+	updateSelection.EstimatedCost = estimatedCostToString
 
 	// 3. 更新选品
 	err = db.UpdateSelection(ctx, updateSelection)