优化返回包装类和首页不做判断

This commit is contained in:
李寻欢 2021-08-20 15:24:39 +08:00
parent 42b9a3ac5a
commit fea7f324af
2 changed files with 8 additions and 3 deletions

View File

@ -28,9 +28,9 @@ func R(ctx *gin.Context) *rs {
// Result 手动组装返回结果 // Result 手动组装返回结果
func (r rs) Result(code int, data interface{}, msg string) { func (r rs) Result(code int, data interface{}, msg string) {
if data == nil { //if data == nil {
data = map[string]interface{}{} // data = map[string]interface{}{}
} //}
r.ctx.JSON(code, response{ r.ctx.JSON(code, response{
code, code,
data, data,

View File

@ -14,6 +14,11 @@ import (
// CheckDeviceId 检查是否存在设备指纹 // CheckDeviceId 检查是否存在设备指纹
func CheckDeviceId() gin.HandlerFunc { func CheckDeviceId() gin.HandlerFunc {
return func(ctx *gin.Context) { return func(ctx *gin.Context) {
p := ctx.Request.URL.Path
if p == "/" {
ctx.Next()
return
}
// 取出设备指纹 // 取出设备指纹
deviceId := ctx.Request.Header.Get("di") deviceId := ctx.Request.Header.Get("di")
if deviceId == "" { if deviceId == "" {