Prechádzať zdrojové kódy

feed_template: 增加版本号

Yi 1 rok pred
rodič
commit
1ce0a532a6
3 zmenil súbory, kde vykonal 10 pridanie a 14 odobranie
  1. 1 1
      go.mod
  2. 2 0
      go.sum
  3. 7 13
      service/group/feed_template.go

+ 1 - 1
go.mod

@@ -3,7 +3,7 @@ module tmr-watch
 go 1.17
 
 require (
-	gitee.com/xuyiping_admin/go_proto v0.0.0-20231020013852-ef9fae121231
+	gitee.com/xuyiping_admin/go_proto v0.0.0-20231020024751-e01ca61df346
 	gitee.com/xuyiping_admin/pkg v0.0.0-20230816061144-c1f079802584
 	github.com/360EntSecGroup-Skylar/excelize v1.4.1
 	github.com/Anderson-Lu/gofasion v0.0.0-20190530065914-6a05b679ee48

+ 2 - 0
go.sum

@@ -13,6 +13,8 @@ gitee.com/xuyiping_admin/go_proto v0.0.0-20231018084013-d0e29bb3008f h1:Nk4irm5K
 gitee.com/xuyiping_admin/go_proto v0.0.0-20231018084013-d0e29bb3008f/go.mod h1:x47UOU+lOkZnrtAENAsOGd7mZ5I8D2JRkMKMqLLRlVw=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20231020013852-ef9fae121231 h1:4GeaRjSIwoUaW0iIaceCr+6QXUHI958qkDlosYM91Pw=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20231020013852-ef9fae121231/go.mod h1:x47UOU+lOkZnrtAENAsOGd7mZ5I8D2JRkMKMqLLRlVw=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20231020024751-e01ca61df346 h1:XZR4WvMVxk6fNbraGsReW7onWxR5O6TMLTAmPWnphm8=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20231020024751-e01ca61df346/go.mod h1:x47UOU+lOkZnrtAENAsOGd7mZ5I8D2JRkMKMqLLRlVw=
 gitee.com/xuyiping_admin/pkg v0.0.0-20230816061144-c1f079802584 h1:5RE5yrMMvnDITrnoX821mFl7dNYfsFA1osDobUV/TDo=
 gitee.com/xuyiping_admin/pkg v0.0.0-20230816061144-c1f079802584/go.mod h1:VQ7WztVDQRlXE1dUu/Yqo3ZdhKsfv7IGJtV+vqNqJVw=
 github.com/360EntSecGroup-Skylar/excelize v1.4.1 h1:l55mJb6rkkaUzOpSsgEeKYtS6/0gHwBYyfo5Jcjv/Ks=

+ 7 - 13
service/group/feed_template.go

@@ -2,14 +2,11 @@ package group
 
 import (
 	"context"
-	"encoding/json"
 	"net/http"
 	"tmr-watch/models"
 	"tmr-watch/module"
-	"tmr-watch/pkg/logger/zaplog"
 
 	feedPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/pasture"
-	"go.uber.org/zap"
 )
 
 func SearchFeedTemplateList(ctx context.Context, req *feedPb.SearchFeedTemplateRequest) (*feedPb.SearchFeedTemplateResponse, error) {
@@ -60,21 +57,18 @@ func GetFeetTemplateVersion(ctx context.Context, pastureId, feedTemplateId int)
 	res := &feedPb.GetFeetTemplateVersionResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: make([]*feedPb.FeetTemplateVersionData, 0),
+		Data: &feedPb.FeetTemplateVersionData{
+			Version: int32(newFeedTemplateDetailVersion.Id),
+			List:    make([]*feedPb.FeetTemplateVersionList, 0),
+		},
 	}
 
-	b, _ := json.Marshal(newFeedTemplateDetailVersionLogList)
-	c, _ := json.Marshal(historyFeedTemplateDetailList)
-	zaplog.Info("newFeedTemplateDetailVersionLogList", zap.String("ok", string(b)))
-	zaplog.Info("historyFeedTemplateDetailList", zap.String("ok", string(c)))
-
 	// 比例两个配方饲料的不同
 	for _, n := range newFeedTemplateDetailVersionLogList {
-
 		// 更新
 		for _, v := range historyFeedTemplateDetailList {
 			if v.FName == n.ForageName {
-				res.Data = append(res.Data, &feedPb.FeetTemplateVersionData{
+				res.Data.List = append(res.Data.List, &feedPb.FeetTemplateVersionList{
 					ForageName:             v.FName,
 					ForageGroupNameOld:     n.ForageName,
 					ForageGroupName:        v.FeedGroup,
@@ -104,7 +98,7 @@ func GetFeetTemplateVersion(ctx context.Context, pastureId, feedTemplateId int)
 		}
 
 		if !insertInfo {
-			res.Data = append(res.Data, &feedPb.FeetTemplateVersionData{
+			res.Data.List = append(res.Data.List, &feedPb.FeetTemplateVersionList{
 				ForageName:          n.ForageName,
 				ForageGroupName:     n.ForageGroupName,
 				Weight:              float32(n.Weight),
@@ -127,7 +121,7 @@ func GetFeetTemplateVersion(ctx context.Context, pastureId, feedTemplateId int)
 			}
 		}
 		if !deleteInfo {
-			res.Data = append(res.Data, &feedPb.FeetTemplateVersionData{
+			res.Data.List = append(res.Data.List, &feedPb.FeetTemplateVersionList{
 				ForageName:          v.FName,
 				ForageGroupName:     v.FeedGroup,
 				Weight:              float32(v.LWeight),