Commit f74be2a96c9b2f2ab48354f58eab83f26469c9a2

Authored by aarongao
1 parent 9a374051
Exists in v1.2 and in 2 other branches master, v1.1

..

@@ -3,6 +3,7 @@ package Api @@ -3,6 +3,7 @@ package Api
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
5 "github.com/aarongao/tools" 5 "github.com/aarongao/tools"
  6 + "github.com/davecgh/go-spew/spew"
6 "github.com/gin-gonic/gin" 7 "github.com/gin-gonic/gin"
7 "gopkg.in/mgo.v2/bson" 8 "gopkg.in/mgo.v2/bson"
8 "letu/DB" 9 "letu/DB"
@@ -160,6 +161,20 @@ func AllItemTime(c *gin.Context) { @@ -160,6 +161,20 @@ func AllItemTime(c *gin.Context) {
160 c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) 161 c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin"))
161 c.Header("Access-Control-Allow-Credentials", "true") 162 c.Header("Access-Control-Allow-Credentials", "true")
162 163
  164 +
  165 + Device := DB.SDevice{
  166 + c.Request.Header.Get("DeviceId"),
  167 + c.Request.Header.Get("Mac"),
  168 + c.Request.Header.Get("UDID"),
  169 + c.Request.Header.Get("SystemVersion"),
  170 + c.Request.Header.Get("SystemModel"),
  171 + c.Request.Header.Get("AppVersion"),
  172 + c.Request.Header.Get("AppVersion"),
  173 + c.Request.Header.Get("DeviceToken"),
  174 + }
  175 + spew.Dump(Device)
  176 +
  177 +
163 var ItemTime map[string]string 178 var ItemTime map[string]string
164 json.Unmarshal([]byte(c.PostForm("items")), &ItemTime) 179 json.Unmarshal([]byte(c.PostForm("items")), &ItemTime)
165 180
@@ -103,22 +103,21 @@ func UpdateScenic(c *gin.Context) { @@ -103,22 +103,21 @@ func UpdateScenic(c *gin.Context) {
103 103
104 } 104 }
105 105
106 -func initScenic(id string){  
107 - 106 +func initScenic(id string) {
108 107
109 DB.CTags.Insert(DB.STag{ 108 DB.CTags.Insert(DB.STag{
110 id, 109 id,
111 "type", 110 "type",
112 "服务设施", 111 "服务设施",
113 - },DB.STag{ 112 + }, DB.STag{
114 id, 113 id,
115 "type", 114 "type",
116 "游乐设施", 115 "游乐设施",
117 - },DB.STag{ 116 + }, DB.STag{
118 id, 117 id,
119 "type", 118 "type",
120 "餐饮", 119 "餐饮",
121 - },DB.STag{ 120 + }, DB.STag{
122 id, 121 id,
123 "type", 122 "type",
124 "购物", 123 "购物",
@@ -38,14 +38,14 @@ func Send(c *gin.Context) { @@ -38,14 +38,14 @@ func Send(c *gin.Context) {
38 return 38 return
39 } 39 }
40 40
41 - cacheCode := DB.Redis.Get("code_"+c.PostForm("Mobile"))  
42 - if cacheCode != nil {  
43 - c.JSON(200, tools.ResponseError{  
44 - 1,  
45 - "code没有过期",  
46 - })  
47 - return  
48 - } 41 + //cacheCode := DB.Redis.Get("code_"+c.PostForm("Mobile"))
  42 + //if cacheCode != nil {
  43 + // c.JSON(200, tools.ResponseError{
  44 + // 1,
  45 + // "code没有过期",
  46 + // })
  47 + // return
  48 + //}
49 49
50 code := Lib.SmsCode(6) 50 code := Lib.SmsCode(6)
51 51
@@ -67,7 +67,7 @@ func Send(c *gin.Context) { @@ -67,7 +67,7 @@ func Send(c *gin.Context) {
67 } else { 67 } else {
68 reserr = response.Code 68 reserr = response.Code
69 if response.Code == "OK" { 69 if response.Code == "OK" {
70 - DB.Redis.Set("code_"+c.PostForm("Mobile"), code, time.Second*60) 70 + DB.Redis.Set("code_"+c.PostForm("Mobile"), code, time.Second*60*5)
71 } 71 }
72 } 72 }
73 73
@@ -210,7 +210,7 @@ func UserInfo(c *gin.Context) { @@ -210,7 +210,7 @@ func UserInfo(c *gin.Context) {
210 // @Param Token wgergejfwe string true "用户token" 210 // @Param Token wgergejfwe string true "用户token"
211 // @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}" 211 // @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}"
212 // @Failure 500 {object} tools.ResponseError "{"errcode":401,"errmsg":"token过期"}" 212 // @Failure 500 {object} tools.ResponseError "{"errcode":401,"errmsg":"token过期"}"
213 -// @Router /CheckToken? [get] 213 +// @Router /CheckToken? [post]
214 func CheckToken(c *gin.Context) { 214 func CheckToken(c *gin.Context) {
215 c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) 215 c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin"))
216 c.Header("Access-Control-Allow-Credentials", "true") 216 c.Header("Access-Control-Allow-Credentials", "true")
Lib/Token/token.go
@@ -14,5 +14,5 @@ func GetToken(mobile string) string { @@ -14,5 +14,5 @@ func GetToken(mobile string) string {
14 } 14 }
15 15
16 func SaveToken(mobile, token string) { 16 func SaveToken(mobile, token string) {
17 - DB.Redis.Set("token_"+mobile, token, time.Second*3600*24*7) 17 + DB.Redis.Set("token_"+mobile, token, time.Second*3600*24*365)
18 } 18 }
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 1. [所有景区基础信息](#allscenic-get) 16 1. [所有景区基础信息](#allscenic-get)
17 1. [标签 - 所有标签](#alltag-get) 17 1. [标签 - 所有标签](#alltag-get)
18 1. [标签 - 按照标签分组查看所有标签](#alltaggroup-get) 18 1. [标签 - 按照标签分组查看所有标签](#alltaggroup-get)
19 -1. [用户管理 - 检查Token是否过期](#checktoken-get) 19 +1. [用户管理 - 检查Token是否过期](#checktoken-post)
20 1. [查询商品信息](#commodityinfo-get) 20 1. [查询商品信息](#commodityinfo-get)
21 1. [投诉 - 增加投诉](#createcomplaint-post) 21 1. [投诉 - 增加投诉](#createcomplaint-post)
22 1. [查询用户的定时提醒](#dealymessage-info-get) 22 1. [查询用户的定时提醒](#dealymessage-info-get)
@@ -177,9 +177,9 @@ @@ -177,9 +177,9 @@
177 177
178 178
179 179
180 -<a name="checktoken-get"></a> 180 +<a name="checktoken-post"></a>
181 181
182 -#### /CheckToken (GET) 182 +#### /CheckToken (POST)
183 183
184 184
185 用户管理 - 检查Token是否过期 185 用户管理 - 检查Token是否过期
@@ -114,7 +114,7 @@ func main() { @@ -114,7 +114,7 @@ func main() {
114 r.GET("/Icon/All", Api.AllIcons) 114 r.GET("/Icon/All", Api.AllIcons)
115 r.GET("/Icon/Info", Api.IconInfo) 115 r.GET("/Icon/Info", Api.IconInfo)
116 r.POST("/CheckToken", Api.CheckToken) 116 r.POST("/CheckToken", Api.CheckToken)
117 - r.GET("/Tiles", Api.Tiles) 117 + //r.GET("/Tiles", Api.Tiles)
118 r.POST("/TopMenus/Update", Api.UpdateTopMenus) 118 r.POST("/TopMenus/Update", Api.UpdateTopMenus)
119 r.GET("/TopMenus/All", Api.AllTopMenus) 119 r.GET("/TopMenus/All", Api.AllTopMenus)
120 r.POST("/RegisterDevice", Api.RegisterDevice) 120 r.POST("/RegisterDevice", Api.RegisterDevice)
@@ -123,7 +123,12 @@ func main() { @@ -123,7 +123,12 @@ func main() {
123 r.Static("/Upload", "./Upload") 123 r.Static("/Upload", "./Upload")
124 r.Static("/Console", "./Console") 124 r.Static("/Console", "./Console")
125 r.Static("/Policy", dir+"/Policy") 125 r.Static("/Policy", dir+"/Policy")
126 - r.Static("/tiles2", dir+"/tiles") 126 +
  127 +
  128 + r.GET("MP_verify_R9xuhLXYcVbdDDNk.txt", func(c *gin.Context) {
  129 + c.String(200, "R9xuhLXYcVbdDDNk")
  130 + })
  131 + //r.Static("/tiles2", dir+"/tiles")
127 // go Ws.Manager.Start() 132 // go Ws.Manager.Start()
128 133
129 // 创建延迟消息 134 // 创建延迟消息