소스 검색

system: 更新msg

Yi 3 달 전
부모
커밋
0db7a93031

+ 1 - 1
go.mod

@@ -3,7 +3,7 @@ module kpt-pasture
 go 1.17
 
 require (
-	gitee.com/xuyiping_admin/go_proto v0.0.0-20250115062928-2823e210486d
+	gitee.com/xuyiping_admin/go_proto v0.0.0-20250120024815-cc7c8bda185b
 	gitee.com/xuyiping_admin/pkg v0.0.0-20241108060137-caea58c59f5b
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
 	github.com/eclipse/paho.mqtt.golang v1.4.3

+ 4 - 0
go.sum

@@ -120,6 +120,10 @@ gitee.com/xuyiping_admin/go_proto v0.0.0-20250107064743-4115ed6f2a73 h1:M53fn2/v
 gitee.com/xuyiping_admin/go_proto v0.0.0-20250107064743-4115ed6f2a73/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20250115062928-2823e210486d h1:qcqBgZFyNXyrg5090MnkbJY5CM5ps8ANzIWNNlwkxEs=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20250115062928-2823e210486d/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20250120023506-4fdfb4191bff h1:YwLd4ZpvvnPgdTiHdIIBW36B6guGXATLSar/u0bjPJA=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20250120023506-4fdfb4191bff/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20250120024815-cc7c8bda185b h1:iMNohD0Qg7balckYvv3FFhKaxpjaH6UkSSqzpjpqYeo=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20250120024815-cc7c8bda185b/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
 gitee.com/xuyiping_admin/pkg v0.0.0-20241108060137-caea58c59f5b h1:w05MxH7yqveRlaRbxHhbif5YjPrJFodRPfOjYhXn7Zk=
 gitee.com/xuyiping_admin/pkg v0.0.0-20241108060137-caea58c59f5b/go.mod h1:8tF25X6pE9WkFCczlNAC0K2mrjwKvhhp02I7o0HtDxY=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=

+ 1 - 1
http/handler/upload/upload.go

@@ -57,7 +57,7 @@ func Photos(c *gin.Context) {
 		}
 		filePaths[i] = urlPath
 	}
-	c.JSON(http.StatusOK, gin.H{"code": http.StatusOK, "message": "ok", "data": filePaths})
+	c.JSON(http.StatusOK, gin.H{"code": http.StatusOK, "Msg": "ok", "data": filePaths})
 }
 
 func Files(c *gin.Context) {

+ 16 - 0
model/cow.go

@@ -475,3 +475,19 @@ func (c CowSlice) WeightRangeToPB(penMap map[int32]*Pen) []*pasturePb.CowList {
 	}
 	return res
 }
+
+// CowBehaviorCurveResponse 脖环行为数据
+type CowBehaviorCurveResponse struct {
+	Code int32                 `json:"code"`
+	Msg  string                `json:"msg"`
+	Data *CowBehaviorCurveData `json:"data"`
+}
+
+type CowBehaviorCurveData struct {
+	OriginalDataList []int32             `json:"originalDataList"` // 原始行为数据
+	ChangeDataList   []int32             `json:"changeDataList"`   // 变化数据
+	SumDataList      []int32             `json:"sumDataList"`      // 累计24小时数据
+	DataTimeList     []string            `json:"dataTimeList"`     // 时间数据
+	EstrusList       []string            `json:"estrusList"`       // 发情预警
+	EventList        map[string][]string `json:"eventList"`        // 事件数据
+}

+ 6 - 6
model/event_mating.go

@@ -251,9 +251,9 @@ func (e EventMatingSlice) ToPB2() []*pasturePb.CowList {
 }
 
 type MatingTimelyResponse struct {
-	Code    int32             `json:"code"`
-	Message string            `json:"message"`
-	Data    *MatingTimelyData `json:"data"`
+	Code int32             `json:"code"`
+	Msg  string            `json:"msg"`
+	Data *MatingTimelyData `json:"data"`
 }
 
 type MatingTimelyData struct {
@@ -270,9 +270,9 @@ type CowMatingChart struct {
 
 // MultiFactorPregnancyRateResponse 多维度受胎率
 type MultiFactorPregnancyRateResponse struct {
-	Code    int32                         `json:"code"`
-	Message string                        `json:"message"`
-	Data    *MultiFactorPregnancyRateData `json:"data"`
+	Code int32                         `json:"code"`
+	Msg  string                        `json:"msg"`
+	Data *MultiFactorPregnancyRateData `json:"data"`
 }
 
 // MultiFactorPregnancyRateList 多维度受胎率分析

+ 3 - 3
model/neck_active_habit.go

@@ -100,14 +100,14 @@ func NewNeckActiveHabit(data *NeckRingOriginalMerge) *NeckActiveHabit {
 
 type NeckActiveHabitSlice []*NeckActiveHabit
 
-func (n NeckActiveHabitSlice) ToPB(curveName string) *pasturePb.CowBehaviorCurveData {
-	res := &pasturePb.CowBehaviorCurveData{
+func (n NeckActiveHabitSlice) ToPB(curveName string) *CowBehaviorCurveData {
+	res := &CowBehaviorCurveData{
 		OriginalDataList: make([]int32, 0),
 		ChangeDataList:   make([]int32, 0),
 		SumDataList:      make([]int32, 0),
 		DataTimeList:     make([]string, 0),
 		EstrusList:       make([]string, 0),
-		EventList:        make(map[string]string),
+		EventList:        make(map[string][]int32),
 	}
 
 	for _, v := range n {

+ 18 - 18
module/backend/analysis.go

@@ -80,8 +80,8 @@ func (s *StoreEntry) GrowthCurve(ctx context.Context, req *pasturePb.SearchGrowt
 
 	// 返回数据
 	return &pasturePb.GrowthCurvesResponse{
-		Code:    http.StatusOK,
-		Message: "success",
+		Code: http.StatusOK,
+		Msg:  "success",
 		Data: &pasturePb.GrowthCurveData{
 			Table:  cowData,
 			Charts: chartsList,
@@ -129,8 +129,8 @@ func (s *StoreEntry) WeightRange(ctx context.Context, req *pasturePb.WeightRange
 
 	if len(cowWeightRange) == 0 {
 		return &pasturePb.WeightRangeResponse{
-			Code:    http.StatusOK,
-			Message: "ok",
+			Code: http.StatusOK,
+			Msg:  "ok",
 			Data: &pasturePb.WeightRangeData{
 				CowList: make([]*pasturePb.CowList, 0),
 				WeightBarChart: &pasturePb.WeightBarChart{
@@ -164,8 +164,8 @@ func (s *StoreEntry) WeightRange(ctx context.Context, req *pasturePb.WeightRange
 
 	penMap := s.PenMap(ctx, currentUser.PastureId)
 	return &pasturePb.WeightRangeResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.WeightRangeData{
 			CowList: model.CowSlice(cowList).WeightRangeToPB(penMap),
 			WeightBarChart: &pasturePb.WeightBarChart{
@@ -223,8 +223,8 @@ func (s *StoreEntry) MatingTimely(ctx context.Context, req *pasturePb.MatingTime
 	}
 	if len(matingTimelyChart) == 0 {
 		return &model.MatingTimelyResponse{
-			Code:    http.StatusOK,
-			Message: "ok",
+			Code: http.StatusOK,
+			Msg:  "ok",
 			Data: &model.MatingTimelyData{
 				CowList: make([]*pasturePb.CowList, 0),
 				Chart:   chart,
@@ -262,8 +262,8 @@ func (s *StoreEntry) MatingTimely(ctx context.Context, req *pasturePb.MatingTime
 	}
 
 	return &model.MatingTimelyResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &model.MatingTimelyData{
 			CowList: model.EventMatingSlice(eventMatingList).ToPB2(),
 			Chart:   chart,
@@ -304,8 +304,8 @@ func (s *StoreEntry) PenWeight(ctx context.Context, req *pasturePb.PenWeightRequ
 	}
 	if len(penWeightList) <= 0 {
 		return &pasturePb.PenWeightResponse{
-			Code:    http.StatusOK,
-			Message: "ok",
+			Code: http.StatusOK,
+			Msg:  "ok",
 			Data: &pasturePb.PenWeightData{
 				CowList: make([]*pasturePb.CowList, 0),
 				Chart:   chart,
@@ -331,8 +331,8 @@ func (s *StoreEntry) PenWeight(ctx context.Context, req *pasturePb.PenWeightRequ
 
 	penMap := s.PenMap(ctx, currentUser.PastureId)
 	return &pasturePb.PenWeightResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.PenWeightData{
 			CowList:  model.CowSlice(cowList).ToPB2(penMap, penWeightList),
 			Total:    int32(count),
@@ -428,8 +428,8 @@ func (s *StoreEntry) AbortionRate(ctx context.Context, req *pasturePb.AbortionRa
 	}
 
 	return &pasturePb.AbortionRateResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.AbortionRateData{
 			Chart: chart,
 			Table: table,
@@ -504,8 +504,8 @@ func (s *StoreEntry) TwentyOnePregnantRate(ctx context.Context, req *pasturePb.T
 	}
 
 	return &pasturePb.TwentyOnePregnantRateResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.TwentyOnePregnantRateData{
 			Chart: chart,
 			Table: &pasturePb.TwentyOnePregnantRateTable{

+ 4 - 4
module/backend/analysis_breed.go

@@ -94,8 +94,8 @@ func (s *StoreEntry) SingleFactorInfantSurvivalRateAnalysis(ctx context.Context,
 	}
 
 	return &pasturePb.SingleFactorPregnancyRateResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SingleFactorPregnancyRateData{
 			Total: int32(len(list)),
 			List:  list,
@@ -695,8 +695,8 @@ func (s *StoreEntry) MultipleFactorAnalysis(ctx context.Context, req *pasturePb.
 	chart.Header = util.RemoveDuplicates(chart.Header)
 	chart.KepMap = util.RemoveDuplicates(chart.KepMap)
 	return &model.MultiFactorPregnancyRateResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &model.MultiFactorPregnancyRateData{
 			Total: int32(len(list)),
 			List:  list,

+ 8 - 8
module/backend/analysis_other.go

@@ -44,8 +44,8 @@ func (s *StoreEntry) PregnancyReport(ctx context.Context, req *pasturePb.Pregnan
 	pregnantCheckResultMap := s.PregnantCheckResultMap()
 	pregnantCheckMethodMap := s.PregnantCheckMethodMap()
 	return &pasturePb.PregnancyReportResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.PregnancyReportData{
 			List:     model.EventPregnantCheckSlice(eventPregnantCheckList).ToPB3(pregnantCheckResultMap, pregnantCheckMethodMap),
 			Total:    int32(count),
@@ -158,8 +158,8 @@ func (s *StoreEntry) CalvingReport(ctx context.Context, req *pasturePb.CalvingRe
 	}
 
 	return &pasturePb.CalvingReportResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.CalvingReportData{
 			List:  eventCalving1,
 			Total: int32(len(eventCalving1)),
@@ -250,8 +250,8 @@ func (s *StoreEntry) DiseaseCureReport(ctx context.Context, req *pasturePb.Disea
 	}
 
 	return &pasturePb.DiseaseCureRateResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.DiseaseCureRateData{
 			List:  diseaseCureRateList1,
 			Chart: chart,
@@ -425,8 +425,8 @@ func (s *StoreEntry) SaleCowReport(ctx context.Context, req *pasturePb.SaleCowRe
 	}
 
 	return &pasturePb.SaleCowReportResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SaleCowReportData{
 			Chart: chart,
 			List:  list,

+ 19 - 0
module/backend/app_pasture.go

@@ -0,0 +1,19 @@
+package backend
+
+import (
+	"context"
+	"kpt-pasture/model"
+
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+)
+
+func (s *StoreEntry) FindPastureByFarmId(ctx context.Context, pastureId int64) *model.AppPastureList {
+	res := &model.AppPastureList{}
+	if err := s.DB.Table(new(model.AppPastureList).TableName()).
+		Where("id = ?", pastureId).
+		Where("is_show = ?", pasturePb.IsShow_Ok).
+		First(res).Error; err != nil {
+		return nil
+	}
+	return res
+}

+ 17 - 17
module/backend/calendar.go

@@ -63,8 +63,8 @@ func (s *StoreEntry) CalendarToDoList(ctx context.Context, req *pasturePb.Calend
 	calendarMap := CalendarTypeMap()
 
 	return &pasturePb.CalendarToDoResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.CalendarToDoData{
 			List:     model.EventItemSlice(eventItem).ToPB(penMap, calendarMap),
 			Total:    int32(count),
@@ -89,9 +89,9 @@ func (s *StoreEntry) CalendarList(ctx context.Context, req *pasturePb.CalendarRe
 		return nil, xerr.WithStack(err)
 	}
 	return &pasturePb.CalendarResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.CalendarSlice(calendarList).ToPB(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.CalendarSlice(calendarList).ToPB(),
 	}, nil
 }
 
@@ -197,8 +197,8 @@ func (s *StoreEntry) ImmunisationCowList(ctx context.Context, req *pasturePb.Ite
 	}
 
 	return &pasturePb.ImmunizationItemsResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.ImmunizationItemsData{
 			Total:    int32(count),
 			Page:     pagination.Page,
@@ -256,8 +256,8 @@ func (s *StoreEntry) SameTimeCowList(ctx context.Context, req *pasturePb.ItemsRe
 	penMap := s.PenMap(ctx, int64(req.PastureId))
 	sameTimeTypeMap := s.SameTimeTypeMap()
 	return &pasturePb.SameTimeItemResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SameTimeItemsData{
 			Total:    int32(count),
 			Page:     pagination.Page,
@@ -321,8 +321,8 @@ func (s *StoreEntry) PregnancyCheckCowList(ctx context.Context, req *pasturePb.I
 	}
 
 	return &pasturePb.PregnancyCheckItemsResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.PregnancyCheckItemsData{
 			Total:    int32(count),
 			Page:     pagination.Page,
@@ -377,8 +377,8 @@ func (s *StoreEntry) WeaningCowList(ctx context.Context, req *pasturePb.ItemsReq
 	}
 
 	return &pasturePb.WeaningItemsResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.WeaningItemsData{
 			Total:    int32(count),
 			Page:     pagination.Page,
@@ -428,8 +428,8 @@ func (s *StoreEntry) MatingCowList(ctx context.Context, req *pasturePb.ItemsRequ
 	}
 
 	return &pasturePb.MatingItemsResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.MatingItemsData{
 			Total:    int32(count),
 			Page:     pagination.Page,
@@ -487,8 +487,8 @@ func (s *StoreEntry) CalvingCowList(ctx context.Context, req *pasturePb.ItemsReq
 	}
 
 	return &pasturePb.CalvingItemsResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.CalvingItemsData{
 			Total:    int32(count),
 			Page:     pagination.Page,

+ 12 - 12
module/backend/cow.go

@@ -84,8 +84,8 @@ func (s *StoreEntry) List(ctx context.Context, req *pasturePb.SearchEventRequest
 	admissionStatusMap := s.AdmissionStatusMap()
 	healthStatusMap := s.HealthStatusMap()
 	return &pasturePb.SearchCowListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchCowData{
 			List: model.CowSlice(cowList).ToPB(penMap, cowTypeMap, breedStatusMap,
 				cowKindMap, cowSourceMap, admissionStatusMap, healthStatusMap),
@@ -135,8 +135,8 @@ func (s *StoreEntry) EventList(ctx context.Context, req *pasturePb.SearchCowEven
 	eventCategoryMap := s.EventCategoryMap()
 
 	return &pasturePb.CowEventListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.CowEventData{
 			List:     model.EventCowLogSlice(eventCowLogList).ToPB(eventCategoryMap),
 			Total:    int32(len(eventCowLogList)),
@@ -146,7 +146,7 @@ func (s *StoreEntry) EventList(ctx context.Context, req *pasturePb.SearchCowEven
 	}, nil
 }
 
-func (s *StoreEntry) BehaviorCurve(ctx context.Context, req *pasturePb.CowBehaviorCurveRequest) (*pasturePb.CowBehaviorCurveResponse, error) {
+func (s *StoreEntry) BehaviorCurve(ctx context.Context, req *pasturePb.CowBehaviorCurveRequest) (*model.CowBehaviorCurveResponse, error) {
 	currentUser, err := s.GetCurrentSystemUser(ctx)
 	if err != nil {
 		return nil, xerr.Custom("当前用户信息错误,请退出重新登录")
@@ -189,7 +189,7 @@ func (s *StoreEntry) BehaviorCurve(ctx context.Context, req *pasturePb.CowBehavi
 	data := model.NeckActiveHabitSlice(neckActiveHabitList).ToPB(req.CurveName)
 	for _, v := range eventLogList {
 		eventAt := time.Unix(v.EventAt, 0)
-		data.EventList[eventAt.Format(model.LayoutDate2)] = v.EventTypeName
+		data.EventList[v.EventTypeName] = append(data.EventList[v.EventTypeName], eventAt.Format(model.LayoutDate2))
 	}
 
 	// 发情数据
@@ -197,8 +197,8 @@ func (s *StoreEntry) BehaviorCurve(ctx context.Context, req *pasturePb.CowBehavi
 	if err = s.DB.Table(new(model.EventEstrus).TableName()).
 		Where("cow_id = ?", cowInfo.Id).
 		Where("pasture_id = ?", currentUser.PastureId).
-		Where("estrus_start_date >= ?", nowTime.Format(model.LayoutTime)).
-		Where("estrus_start_date <= ?", nowTime.AddDate(0, 0, -30).Format(model.LayoutTime)).
+		Where("estrus_start_date >= ?", startDataTime).
+		Where("estrus_start_date <= ?", endDataTime).
 		Order("estrus_start_date").
 		Find(&estrusList).Error; err != nil {
 		return nil, xerr.WithStack(err)
@@ -208,9 +208,9 @@ func (s *StoreEntry) BehaviorCurve(ctx context.Context, req *pasturePb.CowBehavi
 		data.EstrusList = append(data.EstrusList, v.EstrusStartDate)
 	}
 
-	return &pasturePb.CowBehaviorCurveResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    data,
+	return &model.CowBehaviorCurveResponse{
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: data,
 	}, nil
 }

+ 2 - 2
module/backend/dashboard.go

@@ -26,8 +26,8 @@ func (s *StoreEntry) Bar(ctx context.Context) (*pasturePb.BarCowStructResponse,
 		count += v.Number
 	}
 	return &pasturePb.BarCowStructResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.BarCowStructData{
 			List:  model.BarCowStructSlice(barCowStructList).ToPB(cowTypeMap, count),
 			Total: 38563,

+ 39 - 39
module/backend/enum_options.go

@@ -13,9 +13,9 @@ import (
 
 func (s *StoreEntry) BarnTypeOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    s.BarnTypeEnumList(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: s.BarnTypeEnumList(),
 	}, nil
 }
 
@@ -31,9 +31,9 @@ func (s *StoreEntry) BarnListOptions(ctx context.Context, penType int, isAll str
 	}
 
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.PenSlice(penList).ToPB2(s.BarnTypeEnumList(), isAll),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.PenSlice(penList).ToPB2(s.BarnTypeEnumList(), isAll),
 	}, nil
 }
 
@@ -53,9 +53,9 @@ func (s *StoreEntry) DiseaseTypeOptions(ctx context.Context, isChildren string)
 	}
 
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB2(diseaseList),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB2(diseaseList),
 	}, nil
 }
 
@@ -68,9 +68,9 @@ func (s *StoreEntry) DiseaseOptions(ctx context.Context) (*pasturePb.ConfigOptio
 		return nil, xerr.WithStack(err)
 	}
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.DiseaseSlice(diseaseList).ToPB2(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.DiseaseSlice(diseaseList).ToPB2(),
 	}, nil
 }
 
@@ -83,48 +83,48 @@ func (s *StoreEntry) PrescriptionOptions(ctx context.Context) (*pasturePb.Config
 		return nil, xerr.WithStack(err)
 	}
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.PrescriptionSlice(prescriptionList).ToPB2(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.PrescriptionSlice(prescriptionList).ToPB2(),
 	}, nil
 }
 
 func (s *StoreEntry) BreedStatusOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    s.BreedStatusEnumList(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: s.BreedStatusEnumList(),
 	}, nil
 }
 func (s *StoreEntry) CowKindOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    s.CowKindEnumList(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: s.CowKindEnumList(),
 	}, nil
 }
 
 func (s *StoreEntry) CowSourceOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    s.CowSourceEnumList(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: s.CowSourceEnumList(),
 	}, nil
 }
 
 func (s *StoreEntry) CowTypeOptions(ctx context.Context, optionName, isAll string) (*pasturePb.ConfigOptionsListResponse, error) {
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    s.CowTypeEnumList(optionName, isAll),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: s.CowTypeEnumList(optionName, isAll),
 	}, nil
 }
 
 func (s *StoreEntry) CowTransferPenReasonOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    s.TransferPenEnumList(""),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: s.TransferPenEnumList(""),
 	}, nil
 }
 
@@ -147,9 +147,9 @@ func (s *StoreEntry) SystemUserOptions(ctx context.Context, depId int) (*pasture
 		return nil, xerr.WithStack(err)
 	}
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.SystemUserSlice(systemUserList).ToPB2(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.SystemUserSlice(systemUserList).ToPB2(),
 	}, nil
 }
 
@@ -160,9 +160,9 @@ func (s *StoreEntry) BullOptions(ctx context.Context) (*pasturePb.BullOptionsLis
 	}
 
 	return &pasturePb.BullOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    s.BullNumberEnumList("", currentUser),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: s.BullNumberEnumList("", currentUser),
 	}, nil
 }
 
@@ -224,8 +224,8 @@ func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName, i
 	}
 
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    configOptions,
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: configOptions,
 	}, nil
 }

+ 8 - 8
module/backend/event_base.go

@@ -66,8 +66,8 @@ func (s *StoreEntry) EnterList(ctx context.Context, req *pasturePb.SearchEventRe
 	cowKindMap := s.CowKindMap()
 
 	return &pasturePb.SearchEnterEventResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchEnterEventData{
 			List:     model.EventEnterSlice(eventEnterList).ToPB(penMap, breedStatusMap, cowSourceMap, cowTypeMap, cowKindMap),
 			Total:    int32(count),
@@ -129,8 +129,8 @@ func (s *StoreEntry) GroupTransferList(ctx context.Context, req *pasturePb.Searc
 	}
 
 	return &pasturePb.SearchTransferGroupEventResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchTransferGroupEventData{
 			List:     eventGroupTransferList,
 			Total:    int32(count),
@@ -213,8 +213,8 @@ func (s *StoreEntry) BodyScoreList(ctx context.Context, req *pasturePb.SearchEve
 	}
 
 	return &pasturePb.SearchBodyScoreEventResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBodyScoreData{
 			List:     bodyScoreList,
 			Total:    int32(count),
@@ -271,8 +271,8 @@ func (s *StoreEntry) WeightList(ctx context.Context, req *pasturePb.SearchEventR
 	}
 
 	return &pasturePb.SearchWeightEventResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchWeightData{
 			List:     weightList,
 			Total:    int32(count),

+ 8 - 8
module/backend/event_breed.go

@@ -55,8 +55,8 @@ func (s *StoreEntry) CalvingList(ctx context.Context, req *pasturePb.SearchEvent
 	}
 
 	return &pasturePb.SearchLavingEventResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchLavingData{
 			List:     model.EventCalvingListSlice(lavingList).ToPB(calvingCalfList),
 			Total:    int32(count),
@@ -299,8 +299,8 @@ func (s *StoreEntry) SameTimeList(
 
 	sameTimeTypeMap := s.SameTimeTypeMap()
 	return &pasturePb.SearchSameTimeResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SameTimeData{
 			List:     model.EventCowSameTimeSlice(cowSameTimeList).ToPB(sameTimeTypeMap),
 			Total:    int32(count),
@@ -345,8 +345,8 @@ func (s *StoreEntry) EstrusList(ctx context.Context, req *pasturePb.EstrusItemsR
 	getCowInfoByCowId := GetCowInfoByCowId
 	getCowLastEvent := GetCowLastEvent
 	return &pasturePb.EstrusItemsResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.EstrusItemsData{
 			List:     model.EstrusSlice(estrusList).ToPB(s.DB, getCowInfoByCowId, getCowLastEvent),
 			Total:    int32(count),
@@ -460,8 +460,8 @@ func (s *StoreEntry) MatingList(ctx context.Context, req *pasturePb.SearchEventR
 
 	exposeEstrusTypeMap := s.ExposeEstrusTypeMap()
 	return &pasturePb.MatingEventResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchMatingData{
 			List:     model.EventMatingSlice(matingList).ToPB(exposeEstrusTypeMap),
 			Total:    int32(count),

+ 4 - 4
module/backend/event_breed_more.go

@@ -41,8 +41,8 @@ func (s *StoreEntry) PregnantCheckList(ctx context.Context, req *pasturePb.Searc
 	pregnantCheckResultMap := s.PregnantCheckResultMap()
 	pregnantCheckMethodMap := s.PregnantCheckMethodMap()
 	return &pasturePb.PregnantCheckEventResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchPregnantCheckData{
 			List:     model.EventPregnantCheckSlice(pregnantCheckList).ToPB(pregnantCheckResultMap, pregnantCheckMethodMap),
 			Total:    int32(count),
@@ -250,8 +250,8 @@ func (s *StoreEntry) AbortionList(
 	}
 
 	return &pasturePb.EventAbortionResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.EventAbortionData{
 			List:     model.AbortionSlice(abortionList).ToPB(),
 			Total:    int32(count),

+ 7 - 7
module/backend/event_health.go

@@ -213,8 +213,8 @@ func (s *StoreEntry) CowDiseaseList(ctx context.Context, req *pasturePb.SearchEv
 
 	healthStatusMap := s.HealthStatusMap()
 	return &pasturePb.EventCowDiseaseResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.EventCowDiseaseData{
 			List:     model.EventCowDiseaseSlice(cowDiseaseList).ToPB(healthStatusMap),
 			Total:    int32(count),
@@ -435,9 +435,9 @@ func (s *StoreEntry) DiseaseSuggestPrescription(ctx context.Context, diseaseId i
 	}
 
 	return &pasturePb.ConfigOptionsListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    res,
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: res,
 	}, nil
 
 }
@@ -490,8 +490,8 @@ func (s *StoreEntry) CowDiseaseTreatmentDetail(
 	}
 
 	return &pasturePb.EventCowTreatmentDetailResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.EventCowTreatmentDetail{
 			List:     model.EventCowTreatmentSlice(eventCowTreatmentList).ToPB(eventCowDiseaseList),
 			Total:    int32(count),

+ 12 - 12
module/backend/goods.go

@@ -43,8 +43,8 @@ func (s *StoreEntry) DrugsList(ctx context.Context, req *pasturePb.SearchDrugsRe
 	}
 
 	return &pasturePb.SearchDrugsResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchDrugsData{
 			List:     model.DrugsSlice(drugsList).ToPB(),
 			Total:    int32(count),
@@ -99,8 +99,8 @@ func (s *StoreEntry) MedicalEquipmentList(ctx context.Context, req *pasturePb.Se
 
 	unitMap := s.UnitMap()
 	return &pasturePb.SearchMedicalEquipmentResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchMedicalEquipmentData{
 			List:     model.MedicalEquipmentSlice(medicalEquipmentList).ToPB(unitMap),
 			Total:    int32(count),
@@ -257,8 +257,8 @@ func (s *StoreEntry) NeckRingList(ctx context.Context, req *pasturePb.SearchNeck
 
 	neckRingStatusMap := s.NeckRingStatusMap()
 	return &pasturePb.SearchNeckRingResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchNeckRingData{
 			List:     model.NeckRingSlice(neckRingLogList).ToPB(neckRingStatusMap, s.DB, GetCowPenInfoByCowId),
 			Total:    int32(count),
@@ -427,8 +427,8 @@ func (s *StoreEntry) OutboundList(ctx context.Context, req *pasturePb.SearchOutb
 	auditStatusMap := s.AuditStatusMap()
 
 	return &pasturePb.SearchOutboundApplyResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchOutboundApplyData{
 			List:     model.OutboundSlice(outboundList).ToPB(outTypeMap, auditStatusMap),
 			Total:    int32(count),
@@ -533,8 +533,8 @@ func (s *StoreEntry) OutboundDetail(ctx context.Context, id int64) (*pasturePb.O
 		examineAtFormat = time.Unix(outbound.ExamineAt, 0).Format(model.LayoutTime)
 	}
 	return &pasturePb.OutboundDetailResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.OutboundApplyDetail{
 			Id:                int32(outbound.Id),
 			Number:            outbound.Number,
@@ -612,8 +612,8 @@ func (s *StoreEntry) FrozenSemenList(ctx context.Context, req *pasturePb.FrozenS
 	unitMap := s.UnitMap()
 
 	return &pasturePb.FrozenSemenResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchFrozenSemenData{
 			List:     model.FrozenSemenSlice(frozenSemenList).ToPB(frozenSemenTypeMap, unitMap),
 			Total:    int32(count),

+ 1 - 1
module/backend/interface.go

@@ -211,7 +211,7 @@ type EventService interface {
 type CowService interface {
 	List(ctx context.Context, req *pasturePb.SearchEventRequest, pagination *pasturePb.PaginationModel) (*pasturePb.SearchCowListResponse, error)
 	EventList(ctx context.Context, req *pasturePb.SearchCowEventListRequest, pagination *pasturePb.PaginationModel) (*pasturePb.CowEventListResponse, error)
-	BehaviorCurve(ctx context.Context, req *pasturePb.CowBehaviorCurveRequest) (*pasturePb.CowBehaviorCurveResponse, error)
+	BehaviorCurve(ctx context.Context, req *pasturePb.CowBehaviorCurveRequest) (*model.CowBehaviorCurveResponse, error)
 }
 
 //go:generate mockgen -destination mock/GoodsService.go -package kptservicemock kpt-pasture/module/backend GoodsService

+ 16 - 16
module/backend/pasture.go

@@ -33,8 +33,8 @@ func (s *StoreEntry) SearchBarnList(ctx context.Context, req *pasturePb.SearchNa
 	}
 
 	return &pasturePb.SearchBarnResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBarnData{
 			List:     model.PenSlice(penList).ToPB(configBarnTypeList),
 			Total:    int32(count),
@@ -94,8 +94,8 @@ func (s *StoreEntry) SearchBarnTypeList(ctx context.Context, req *pasturePb.Sear
 	}
 
 	return &pasturePb.SearchBaseConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
 			List:     model.ConfigBarnTypeSlice(barnTypeList).ToPB(),
 			Total:    int32(count),
@@ -142,8 +142,8 @@ func (s *StoreEntry) SearchBreedStatusList(ctx context.Context, req *pasturePb.S
 	}
 
 	return &pasturePb.SearchBaseConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
 			List:     model.ConfigBreedStatusSlice(breedStatusList).ToPB(),
 			Total:    int32(count),
@@ -190,8 +190,8 @@ func (s *StoreEntry) SearchCowKindList(ctx context.Context, req *pasturePb.Searc
 	}
 
 	return &pasturePb.SearchBaseConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
 			List:     model.ConfigCowKindSlice(configCowKindList).ToPB(),
 			Total:    int32(count),
@@ -238,8 +238,8 @@ func (s *StoreEntry) SearchCowStatusList(ctx context.Context, req *pasturePb.Sea
 	}
 
 	return &pasturePb.SearchBaseConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
 			List:     model.ConfigCowStatusSlice(configCowStatusList).ToPB(),
 			Total:    int32(count),
@@ -286,8 +286,8 @@ func (s *StoreEntry) SearchCowTypeList(ctx context.Context, req *pasturePb.Searc
 	}
 
 	return &pasturePb.SearchBaseConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
 			List:     model.ConfigCowTypeSlice(configCowTypeList).ToPB(),
 			Total:    int32(count),
@@ -334,8 +334,8 @@ func (s *StoreEntry) SearchTransferPenReasonList(ctx context.Context, req *pastu
 	}
 
 	return &pasturePb.SearchBaseConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
 			List:     model.ConfigTransferPenReasonSlice(configTransferPenReasonList).ToPB(),
 			Total:    int32(count),
@@ -382,8 +382,8 @@ func (s *StoreEntry) SearchCowSourceList(ctx context.Context, req *pasturePb.Sea
 	}
 
 	return &pasturePb.SearchBaseConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
 			List:     model.ConfigCowSourceSlice(configCowSourceList).ToPB(),
 			Total:    int32(count),

+ 14 - 14
module/backend/prescription.go

@@ -58,8 +58,8 @@ func (s *StoreEntry) SearchSameTimeList(ctx context.Context, req *pasturePb.Sear
 	sameTimeCowTypeMap := s.SameTimeCowTypeMap()
 	systemUser, _ := s.SystemUserList(ctx)
 	return &pasturePb.SameTimeResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchSameTimeData{
 			List:     model.SameTimeSlice(semeTimeList).ToPB(weekMap, sameTimeCowTypeMap, systemUser),
 			Total:    int32(count),
@@ -111,8 +111,8 @@ func (s *StoreEntry) SearchDiseaseList(ctx context.Context, req *pasturePb.Searc
 	diseaseTypeList, _ := s.DiseaseTypeList(ctx)
 
 	return &pasturePb.SearchDiseaseResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchDiseaseData{
 			List:     model.DiseaseSlice(diseaseList).ToPB(systemUserList, diseaseTypeList),
 			Total:    int32(count),
@@ -163,8 +163,8 @@ func (s *StoreEntry) SearchDiseaseTypeList(ctx context.Context, req *pasturePb.S
 	}
 
 	return &pasturePb.SearchBaseConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
 			List:     model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB(),
 			Total:    int32(count),
@@ -226,8 +226,8 @@ func (s *StoreEntry) SearchPrescriptionList(ctx context.Context, req *pasturePb.
 
 	diseaseMaps, _ := s.DiseaseMaps(ctx)
 	return &pasturePb.SearchPrescriptionResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchPrescriptionData{
 			List:     model.PrescriptionSlice(prescriptionList).ToPB(prescriptionDrugs, diseaseMaps),
 			Total:    int32(count),
@@ -351,8 +351,8 @@ func (s *StoreEntry) PrescriptionDetail(ctx context.Context, id int64) (*pasture
 	}
 
 	return &pasturePb.PrescriptionDetailResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.PrescriptionRequest{
 			Id:                   prescriptionData.Id,
 			Name:                 prescriptionData.Name,
@@ -387,8 +387,8 @@ func (s *StoreEntry) ImmunizationList(ctx context.Context, req *pasturePb.Immuni
 	CowTypeOptions := s.ImmunizationCowTypeEnumList("")
 	conditionsOptions := s.ImmunizationConditionsEnumList("")
 	return &pasturePb.SearchImmunizationResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchImmunizationData{
 			List:     model.ImmunizationPlanSlice(immunizationList).ToPB(CowTypeOptions, conditionsOptions),
 			Total:    int32(count),
@@ -494,8 +494,8 @@ func (s *StoreEntry) SystemBasicList(ctx context.Context) (*pasturePb.SearchBase
 		return nil, xerr.WithStack(err)
 	}
 	return &pasturePb.SearchBaseDataConfigResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchBaseDataConfigData{
 			List:  model.SystemBasicSlice(systemBasicList).ToPb(),
 			Total: int32(len(systemBasicList)),

+ 32 - 27
module/backend/system_service.go

@@ -57,9 +57,14 @@ func (s *StoreEntry) Login(ctx context.Context, req *pasturePb.SearchUserRequest
 	}
 
 	expires := time.Now().Add(time.Duration(s.Cfg.JwtExpireTime) * time.Second).Format(util.LayoutTime)
+	farmData := s.FindPastureByFarmId(ctx, systemUser.PastureId)
+	if farmData == nil || farmData.FarmId == "" {
+		return nil, xerr.Custom("获取牧场信息错误")
+	}
+
 	return &pasturePb.SystemUserResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SystemUserData{
 			AccessToken:  token,
 			Expires:      expires,
@@ -67,7 +72,7 @@ func (s *StoreEntry) Login(ctx context.Context, req *pasturePb.SearchUserRequest
 			Username:     systemUser.Name,
 			Roles:        []string{systemRole.Name},
 			Avatar:       systemUser.Avatar,
-			PastureId:    int32(systemUser.PastureId),
+			FarmId:       farmData.FarmId,
 		},
 	}, nil
 }
@@ -110,8 +115,8 @@ func (s *StoreEntry) SearchSystemUserList(ctx context.Context, req *pasturePb.Se
 	}
 
 	return &pasturePb.SearchUserResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchUserData{
 			List:     model.SystemUserSlice(systemUserList).ToPB(deptList, roleList),
 			Total:    int32(count),
@@ -236,9 +241,9 @@ func (s *StoreEntry) SystemUserRole(ctx context.Context, userId int64) (*pasture
 	}
 
 	return &pasturePb.SystemUserRoleResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    int32(systemUser.RoleId),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: int32(systemUser.RoleId),
 	}, nil
 }
 
@@ -304,9 +309,9 @@ func (s *StoreEntry) GetSystemUserMenu(ctx context.Context) (*pasturePb.SystemUs
 
 	// 获取菜单权限
 	return &pasturePb.SystemUserMenuTreeResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.SystemMenuSlice(systemMenuList).ToTree(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.SystemMenuSlice(systemMenuList).ToTree(),
 	}, nil
 }
 
@@ -390,8 +395,8 @@ func (s *StoreEntry) SearchSystemRoleList(ctx context.Context, req *pasturePb.Se
 	}
 
 	return &pasturePb.SearchRoleResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchRoleData{
 			Page:     pagination.Page,
 			Total:    int32(count),
@@ -434,9 +439,9 @@ func (s *StoreEntry) GetRoleMenuList(ctx context.Context, roleId int64) (*pastur
 		zaplog.Error("GetSystemRoleMenuList", zap.Any("Err", err))
 	}
 	return &pasturePb.SystemRoleMenuResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.SystemRoleMenuSlice(menuList).ToPB(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.SystemRoleMenuSlice(menuList).ToPB(),
 	}, nil
 
 }
@@ -485,9 +490,9 @@ func (s *StoreEntry) SystemRoleList(ctx context.Context) (*pasturePb.GetRoleList
 	}
 
 	return &pasturePb.GetRoleListResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.SystemRoleSlice(systemRoleList).ToPB(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.SystemRoleSlice(systemRoleList).ToPB(),
 	}, nil
 }
 
@@ -540,9 +545,9 @@ func (s *StoreEntry) SystemMenuTree(ctx context.Context) (*pasturePb.SystemMenuT
 		return nil, xerr.WithStack(err)
 	}
 	return &pasturePb.SystemMenuTreeResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.SystemMenuSlice(systemMenuList).ToPB(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.SystemMenuSlice(systemMenuList).ToPB(),
 	}, nil
 }
 
@@ -559,8 +564,8 @@ func (s *StoreEntry) SearchSystemMenuList(ctx context.Context, req *pasturePb.Se
 	}
 
 	return &pasturePb.SearchMenuResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchMenuData{
 			Page:     pagination.Page,
 			Total:    int32(count),
@@ -606,9 +611,9 @@ func (s *StoreEntry) SearchSystemDeptList(ctx context.Context, req *pasturePb.Se
 	systemUserList, _ := s.SystemUserList(ctx)
 
 	return &pasturePb.SearchDeptResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
-		Data:    model.SystemDeptSlice(deptList).ToPB(systemUserList),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: model.SystemDeptSlice(deptList).ToPB(systemUserList),
 	}, nil
 }
 

+ 4 - 4
module/backend/work.go

@@ -57,8 +57,8 @@ func (s *StoreEntry) OrderList(ctx context.Context, req *pasturePb.SearchWorkOrd
 	weekMap := s.WeekMap()
 	monthMap := s.MonthMap()
 	return &pasturePb.SearchWorkOrderResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.SearchWorkOrderData{
 			List:     model.WorkOrderMasterSlice(workOrderList).ToPB(priorityMap, frequencyMap, subscribeUnitMap, weekMap, monthMap),
 			Total:    int32(count),
@@ -278,8 +278,8 @@ func (s *StoreEntry) UserWorkOrderList(ctx context.Context, workOrderStatus past
 	priorityMap := s.WorkOrderPriorityMap()
 
 	return &pasturePb.UserWorkOrderResponse{
-		Code:    http.StatusOK,
-		Message: "ok",
+		Code: http.StatusOK,
+		Msg:  "ok",
 		Data: &pasturePb.UserWorkOrderData{
 			List:     model.WorkOrderSubSlice(userWorkOrderList).ToPB(mMap, priorityMap),
 			Total:    0,

+ 0 - 17
module/crontab/neck_ring_handle.go

@@ -281,23 +281,6 @@ func (e *Entry) EntryUpdateActiveHabit(pastureId int64) (err error) {
 	return nil
 }
 
-// CurrentMaxXFrameId 当前最大frameid
-func (e *Entry) CurrentMaxXFrameId(neckRingNumber, activeDate string) (frameid int32) {
-	type Fm struct {
-		Frameid int32
-	}
-	maxFx := &Fm{}
-	if err := e.DB.Model(new(model.NeckRingOriginal)).
-		Select("frameid").
-		Where("neck_ring_number = ?", neckRingNumber).
-		Where("active_date = ?", activeDate).
-		Order("frameid DESC").First(maxFx).Error; err != nil {
-		zaplog.Error("CurrentMaxXFrameId", zap.Any("err", err))
-		return 0
-	}
-	return maxFx.Frameid
-}
-
 // FirstFilterUpdate 首次更新活动滤波
 func (e *Entry) FirstFilterUpdate(pastureId int64, xToDay *XToday) (err error) {
 	newNeckActiveHabitList := make([]*model.NeckActiveHabit, 0)