From f74be2a96c9b2f2ab48354f58eab83f26469c9a2 Mon Sep 17 00:00:00 2001 From: aarongao Date: Fri, 28 Feb 2020 13:33:29 +0800 Subject: [PATCH] .. --- API/Item.go | 15 +++++++++++++++ API/Scenic.go | 9 ++++----- API/Sms.go | 18 +++++++++--------- API/User.go | 2 +- Lib/Token/token.go | 2 +- README.md | 6 +++--- main.go | 9 +++++++-- 7 files changed, 40 insertions(+), 21 deletions(-) diff --git a/API/Item.go b/API/Item.go index 433f4a4..0ef4029 100644 --- a/API/Item.go +++ b/API/Item.go @@ -3,6 +3,7 @@ package Api import ( "encoding/json" "github.com/aarongao/tools" + "github.com/davecgh/go-spew/spew" "github.com/gin-gonic/gin" "gopkg.in/mgo.v2/bson" "letu/DB" @@ -160,6 +161,20 @@ func AllItemTime(c *gin.Context) { c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) c.Header("Access-Control-Allow-Credentials", "true") + + Device := DB.SDevice{ + c.Request.Header.Get("DeviceId"), + c.Request.Header.Get("Mac"), + c.Request.Header.Get("UDID"), + c.Request.Header.Get("SystemVersion"), + c.Request.Header.Get("SystemModel"), + c.Request.Header.Get("AppVersion"), + c.Request.Header.Get("AppVersion"), + c.Request.Header.Get("DeviceToken"), + } + spew.Dump(Device) + + var ItemTime map[string]string json.Unmarshal([]byte(c.PostForm("items")), &ItemTime) diff --git a/API/Scenic.go b/API/Scenic.go index 9cf5653..3bd8d8f 100644 --- a/API/Scenic.go +++ b/API/Scenic.go @@ -103,22 +103,21 @@ func UpdateScenic(c *gin.Context) { } -func initScenic(id string){ - +func initScenic(id string) { DB.CTags.Insert(DB.STag{ id, "type", "服务设施", - },DB.STag{ + }, DB.STag{ id, "type", "游乐设施", - },DB.STag{ + }, DB.STag{ id, "type", "餐饮", - },DB.STag{ + }, DB.STag{ id, "type", "购物", diff --git a/API/Sms.go b/API/Sms.go index ed39595..ee24787 100644 --- a/API/Sms.go +++ b/API/Sms.go @@ -38,14 +38,14 @@ func Send(c *gin.Context) { return } - cacheCode := DB.Redis.Get("code_"+c.PostForm("Mobile")) - if cacheCode != nil { - c.JSON(200, tools.ResponseError{ - 1, - "code没有过期", - }) - return - } + //cacheCode := DB.Redis.Get("code_"+c.PostForm("Mobile")) + //if cacheCode != nil { + // c.JSON(200, tools.ResponseError{ + // 1, + // "code没有过期", + // }) + // return + //} code := Lib.SmsCode(6) @@ -67,7 +67,7 @@ func Send(c *gin.Context) { } else { reserr = response.Code if response.Code == "OK" { - DB.Redis.Set("code_"+c.PostForm("Mobile"), code, time.Second*60) + DB.Redis.Set("code_"+c.PostForm("Mobile"), code, time.Second*60*5) } } diff --git a/API/User.go b/API/User.go index 0386115..34ad9e8 100644 --- a/API/User.go +++ b/API/User.go @@ -210,7 +210,7 @@ func UserInfo(c *gin.Context) { // @Param Token wgergejfwe string true "用户token" // @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}" // @Failure 500 {object} tools.ResponseError "{"errcode":401,"errmsg":"token过期"}" -// @Router /CheckToken? [get] +// @Router /CheckToken? [post] func CheckToken(c *gin.Context) { c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) c.Header("Access-Control-Allow-Credentials", "true") diff --git a/Lib/Token/token.go b/Lib/Token/token.go index 4586a02..7215e1a 100644 --- a/Lib/Token/token.go +++ b/Lib/Token/token.go @@ -14,5 +14,5 @@ func GetToken(mobile string) string { } func SaveToken(mobile, token string) { - DB.Redis.Set("token_"+mobile, token, time.Second*3600*24*7) + DB.Redis.Set("token_"+mobile, token, time.Second*3600*24*365) } diff --git a/README.md b/README.md index bf4181b..d4c13e5 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ 1. [所有景区基础信息](#allscenic-get) 1. [标签 - 所有标签](#alltag-get) 1. [标签 - 按照标签分组查看所有标签](#alltaggroup-get) -1. [用户管理 - 检查Token是否过期](#checktoken-get) +1. [用户管理 - 检查Token是否过期](#checktoken-post) 1. [查询商品信息](#commodityinfo-get) 1. [投诉 - 增加投诉](#createcomplaint-post) 1. [查询用户的定时提醒](#dealymessage-info-get) @@ -177,9 +177,9 @@ - + -#### /CheckToken (GET) +#### /CheckToken (POST) 用户管理 - 检查Token是否过期 diff --git a/main.go b/main.go index b4803e3..e6cba24 100644 --- a/main.go +++ b/main.go @@ -114,7 +114,7 @@ func main() { r.GET("/Icon/All", Api.AllIcons) r.GET("/Icon/Info", Api.IconInfo) r.POST("/CheckToken", Api.CheckToken) - r.GET("/Tiles", Api.Tiles) + //r.GET("/Tiles", Api.Tiles) r.POST("/TopMenus/Update", Api.UpdateTopMenus) r.GET("/TopMenus/All", Api.AllTopMenus) r.POST("/RegisterDevice", Api.RegisterDevice) @@ -123,7 +123,12 @@ func main() { r.Static("/Upload", "./Upload") r.Static("/Console", "./Console") r.Static("/Policy", dir+"/Policy") - r.Static("/tiles2", dir+"/tiles") + + + r.GET("MP_verify_R9xuhLXYcVbdDDNk.txt", func(c *gin.Context) { + c.String(200, "R9xuhLXYcVbdDDNk") + }) + //r.Static("/tiles2", dir+"/tiles") // go Ws.Manager.Start() // 创建延迟消息 -- libgit2 0.21.0