CreateFoodRecipe添加可选参数:authorID
This commit is contained in:
@@ -88,7 +88,7 @@ func updateFoodRecipeItemAndStep(ctx *jxcontext.Context, db *dao.DaoDB, recipeID
|
||||
return err
|
||||
}
|
||||
|
||||
func CreateFoodRecipe(ctx *jxcontext.Context, foodRecipe *model.FoodRecipe, itemList []*FoodRecipeItemParam, stepList []*FoodRecipeStepParam) (err error) {
|
||||
func CreateFoodRecipe(ctx *jxcontext.Context, foodRecipe *model.FoodRecipe, itemList []*FoodRecipeItemParam, stepList []*FoodRecipeStepParam, authorID string) (err error) {
|
||||
if len(itemList) == 0 {
|
||||
return fmt.Errorf("必须要有配料")
|
||||
}
|
||||
@@ -107,7 +107,11 @@ func CreateFoodRecipe(ctx *jxcontext.Context, foodRecipe *model.FoodRecipe, item
|
||||
}
|
||||
}()
|
||||
|
||||
_, foodRecipe.AuthorID = ctx.GetMobileAndUserID()
|
||||
if authorID == "" {
|
||||
_, foodRecipe.AuthorID = ctx.GetMobileAndUserID()
|
||||
} else {
|
||||
foodRecipe.AuthorID = authorID
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(foodRecipe, ctx.GetUserName())
|
||||
if err = dao.CreateEntity(db, foodRecipe); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user