Browse Source

pasture: 优化错误抛出

Yi 1 year ago
parent
commit
46d735ad68

+ 4 - 2
http/handle/group/feed_formula.go

@@ -47,8 +47,10 @@ func DistributeFeedFormula(c *gin.Context) {
 		return
 	}
 
-	c.JSON(http.StatusOK, map[string]bool{
-		"success": true,
+	ginutil.JSONResp(c, &operationPb.CommonOK{
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: &operationPb.Success{Success: true},
 	})
 }
 

+ 2 - 2
migration/v0001_feedtemplet.sql

@@ -1,7 +1,7 @@
 ALTER TABLE `feedtemplet`
     ADD COLUMN `is_modify` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否可修改 0 无效 1 是 2 否',
-    ADD COLUMN `group_data_id` bigint(11) unsigned NOT NULL DEFAULT '0' COMMENT '集端数据ID',
-    ADD COLUMN `group_version` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '集端版本号';
+    ADD COLUMN `group_data_id` bigint(11) unsigned NOT NULL DEFAULT '0' COMMENT '集端数据ID',
+    ADD COLUMN `group_version` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '集端版本号';
 
 ALTER TABLE ftdetail ADD COLUMN `is_show` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否显示 0 无效 1 显示 2 隐藏';
 

+ 1 - 1
models/feed_template.go

@@ -27,7 +27,6 @@ type FeedTemplate struct {
 	DryWeight    float64 `xorm:"dryweight" json:"dry_weight"`
 	IsDelete     int32   `xorm:"isdelete" json:"is_delete"`
 	Version      int64   `xorm:"version" json:"version"`
-	GroupVersion int64   `xorm:"group_version" json:"group_version"`
 	SaveTime     string  `xorm:"savetime" json:"save_time"`
 	IsIssue      int32   `xorm:"isissue" json:"is_issue"`
 	IssueVersion int32   `xorm:"issueversion" json:"issue_version"`
@@ -36,6 +35,7 @@ type FeedTemplate struct {
 	Backup2      string  `xorm:"backup2" json:"backup2"`
 	IsModify     int32   `xorm:"is_modify" json:"is_modify"`
 	GroupDataId  int64   `xorm:"group_data_id" json:"group_data_id"`
+	GroupVersion int64   `xorm:"group_version" json:"group_version"`
 
 	FeedFormulaDetail []*FeedTemplateDetail `xorm:"-" json:"feed_formula_detail"`
 }

+ 1 - 1
module/group.go

@@ -15,7 +15,7 @@ import (
 )
 
 // DistributeFeedFormula 接受集团饲料配方下发
-func DistributeFeedFormula(pastureId int64, feedTemplateList []*models.FeedTemplate) error {
+func DistributeFeedFormula(feedTemplateList []*models.FeedTemplate) error {
 	tx := restful.Engine.NewSession()
 	defer tx.Close()
 

+ 1 - 1
service/group/group.go

@@ -19,7 +19,7 @@ func DistributeFeedFormulaService(req *operationPb.DistributeDataRequest) error
 	for _, b := range req.FeedFormulaList {
 		feedTemplateList = append(feedTemplateList, models.NewFeedTemplateByGroup(b))
 	}
-	return module.DistributeFeedFormula(int64(req.PastureId), feedTemplateList)
+	return module.DistributeFeedFormula(feedTemplateList)
 }
 
 // CancelDistributeFeedFormulaService 取消饲料配方下发牧场端