|
@@ -10,6 +10,11 @@ import (
|
|
|
"github.com/gin-gonic/gin"
|
|
|
)
|
|
|
|
|
|
+const (
|
|
|
+ FeedCategoryDeleteKey = "feed_delete"
|
|
|
+ CowCategoryDeleteKey = "cow_delete"
|
|
|
+)
|
|
|
+
|
|
|
// DistributeFeedFormula 饲料配方下发
|
|
|
func DistributeFeedFormula(c *gin.Context) {
|
|
|
appG := app.Gin{C: c}
|
|
@@ -146,7 +151,25 @@ func ForageCategoryDistribute(c *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func CattleCategoryDistribute(c *gin.Context) {
|
|
|
+func ForageCategoryDelete(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+ var req models.CategoryDeleteRequest
|
|
|
+ if err := c.BindJSON(&req); err != nil {
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if err := group.CategoryDeleteService(FeedCategoryDeleteKey, &req); err != nil {
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_GET_S_FAIL, map[string]interface{}{
|
|
|
+ "error": err,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, map[string]bool{
|
|
|
+ "success": true,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func CowCategoryDistribute(c *gin.Context) {
|
|
|
appG := app.Gin{C: c}
|
|
|
var req models.CategoryRequest
|
|
|
if err := c.BindJSON(&req); err != nil {
|
|
@@ -163,3 +186,21 @@ func CattleCategoryDistribute(c *gin.Context) {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+func CowCategoryDelete(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+ var req models.CategoryDeleteRequest
|
|
|
+ if err := c.BindJSON(&req); err != nil {
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if err := group.CategoryDeleteService(CowCategoryDeleteKey, &req); err != nil {
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_GET_S_FAIL, map[string]interface{}{
|
|
|
+ "error": err,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, map[string]bool{
|
|
|
+ "success": true,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|