Blame view

API/SystemInfo.go 1.02 KB
025a2fc1   aarongao   .
1
2
3
4
5
package Api

import (
	"github.com/aarongao/tools"
	"github.com/gin-gonic/gin"
025a2fc1   aarongao   .
6
7
8
9
10
11
12
	"letu/DB"
)

// @Title 查询系统信息接口
// @Description 查询系统信息接口
// @Accept  json
// @Produce  json
869149fa   aarongao   ..
13
// @Success 200 {object} tools.ResponseSeccess "ApiVersion=最新的api版本号SupportVersion=支持最低的app版本号UpdateLocationInterval上报位置时间间隔(秒)"
025a2fc1   aarongao   .
14
15
16
17
18
19
20
// @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{})
869149fa   aarongao   ..
21
22
	ApiVersion := DB.Redis.Get("ApiVersion")
	info["ApiVersion"] = ApiVersion
483ade81   aarongao   v1.1
23

869149fa   aarongao   ..
24
25
	SupportVersion := DB.Redis.Get("SupportVersion")
	info["SupportVersion"] = SupportVersion
483ade81   aarongao   v1.1
26

025a2fc1   aarongao   .
27
28
29
30
31
32
33
34
	UpdateLocationInterval := DB.Redis.Get("UpdateLocationInterval")
	info["UpdateLocationInterval"] = UpdateLocationInterval

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

483ade81   aarongao   v1.1
35
}