tools.go
534 Bytes
package LeYouTu
import (
"github.com/aarongao/tools"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
)
func GetScenicId(c *gin.Context) (ScenicId string, error error) {
if c.Request.Method == "POST" {
ScenicId = c.PostForm("ScenicId")
}
if c.Request.Method == "GET" {
ScenicId = c.Query("ScenicId")
}
if ScenicId == "" || ScenicId == "undefined" {
c.JSON(200, tools.ResponseError{
1,
"缺少ScenicId(景区id)",
})
return "", errors.New("缺少ScenicId(景区id)")
} else {
return ScenicId, nil
}
}