tools.go 428 Bytes
package LeYouTu

import (
	"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" {
		return "", errors.New("缺少ScenicId(景区id)")
	} else {
		return ScenicId, nil
	}
}