修复参数解析bug
This commit is contained in:
@@ -298,8 +298,13 @@ type FeedingPlanStep struct {
|
||||
|
||||
// Detail 获取饲料计划列细节
|
||||
func (c *Controller) Detail(ctx *gin.Context) {
|
||||
// 获取路径参数中的计划ID
|
||||
planIDStr := ctx.Param("id")
|
||||
// 获取查询参数中的计划ID
|
||||
planIDStr := ctx.Query("id")
|
||||
if planIDStr == "" {
|
||||
controller.SendErrorResponse(ctx, controller.InvalidParameterCode, "缺少计划ID参数")
|
||||
return
|
||||
}
|
||||
|
||||
planID, err := strconv.ParseUint(planIDStr, 10, 32)
|
||||
if err != nil {
|
||||
controller.SendErrorResponse(ctx, controller.InvalidParameterCode, "无效的计划ID")
|
||||
|
||||
Reference in New Issue
Block a user