animeic 2 years ago
parent
commit
5c558efd86
1 changed files with 7 additions and 7 deletions
  1. 7 7
      boxcost/api/product.go

+ 7 - 7
boxcost/api/product.go

@@ -31,31 +31,31 @@ func Product(r *GinRouter) {
 
 		JWT: true,
 		OnUpdate: func(c *gin.Context, apictx *ApiSession, entity interface{}) {
-			process := entity.(*model.Product)
-			process.UpdateTime = time.Now()
+			product := entity.(*model.Product)
+			product.UpdateTime = time.Now()
 		},
 		SearchProject: []string{"name", "unit", "norm", "price", "category", "remark"},
 	})
 }
 
 func ProductDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	processId := c.Param("id")
-	id, err := primitive.ObjectIDFromHex(processId)
+	productId := c.Param("id")
+	id, err := primitive.ObjectIDFromHex(productId)
 	if err != nil {
 		return nil, errors.New("非法id")
 	}
-	var process model.Product
+	var product model.Product
 	option := &repo.DocSearchOptions{
 		CollectName: repo.CollectionProduct,
 		Query:       repo.Map{"_id": id},
 	}
 
-	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), option, &process)
+	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), option, &product)
 	if !found || err != nil {
 		log.Info(err)
 		return nil, errors.New("数据未找到")
 	}
 
-	return process, nil
+	return product, nil
 
 }