SystemInfo.go 1.02 KB
package Api

import (
	"github.com/aarongao/tools"
	"github.com/gin-gonic/gin"
	"letu/DB"
)

// @Title 查询系统信息接口
// @Description 查询系统信息接口
// @Accept  json
// @Produce  json
// @Success 200 {object} tools.ResponseSeccess "ApiVersion=最新的api版本号SupportVersion=支持最低的app版本号UpdateLocationInterval上报位置时间间隔(秒)"
// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}"
// @Router /SystemInfo? [get]
func SystemInfo(c *gin.Context) {
	c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin"))
	c.Header("Access-Control-Allow-Credentials", "true")

	info := make(map[string]interface{})
	ApiVersion := DB.Redis.Get("ApiVersion")
	info["ApiVersion"] = ApiVersion

	SupportVersion := DB.Redis.Get("SupportVersion")
	info["SupportVersion"] = SupportVersion

	UpdateLocationInterval := DB.Redis.Get("UpdateLocationInterval")
	info["UpdateLocationInterval"] = UpdateLocationInterval

	c.JSON(200, tools.ResponseSeccess{
		0,
		info,
	})

}