Commit f74be2a96c9b2f2ab48354f58eab83f26469c9a2

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

..

API/Item.go
... ... @@ -3,6 +3,7 @@ package Api
3 3 import (
4 4 "encoding/json"
5 5 "github.com/aarongao/tools"
  6 + "github.com/davecgh/go-spew/spew"
6 7 "github.com/gin-gonic/gin"
7 8 "gopkg.in/mgo.v2/bson"
8 9 "letu/DB"
... ... @@ -160,6 +161,20 @@ func AllItemTime(c *gin.Context) {
160 161 c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin"))
161 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 178 var ItemTime map[string]string
164 179 json.Unmarshal([]byte(c.PostForm("items")), &ItemTime)
165 180  
... ...
API/Scenic.go
... ... @@ -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 108 DB.CTags.Insert(DB.STag{
110 109 id,
111 110 "type",
112 111 "服务设施",
113   - },DB.STag{
  112 + }, DB.STag{
114 113 id,
115 114 "type",
116 115 "游乐设施",
117   - },DB.STag{
  116 + }, DB.STag{
118 117 id,
119 118 "type",
120 119 "餐饮",
121   - },DB.STag{
  120 + }, DB.STag{
122 121 id,
123 122 "type",
124 123 "购物",
... ...
API/Sms.go
... ... @@ -38,14 +38,14 @@ func Send(c *gin.Context) {
38 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 50 code := Lib.SmsCode(6)
51 51  
... ... @@ -67,7 +67,7 @@ func Send(c *gin.Context) {
67 67 } else {
68 68 reserr = response.Code
69 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  
... ...
API/User.go
... ... @@ -210,7 +210,7 @@ func UserInfo(c *gin.Context) {
210 210 // @Param Token wgergejfwe string true "用户token"
211 211 // @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}"
212 212 // @Failure 500 {object} tools.ResponseError "{"errcode":401,"errmsg":"token过期"}"
213   -// @Router /CheckToken? [get]
  213 +// @Router /CheckToken? [post]
214 214 func CheckToken(c *gin.Context) {
215 215 c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin"))
216 216 c.Header("Access-Control-Allow-Credentials", "true")
... ...
Lib/Token/token.go
... ... @@ -14,5 +14,5 @@ func GetToken(mobile string) string {
14 14 }
15 15  
16 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 }
... ...
README.md
... ... @@ -16,7 +16,7 @@
16 16 1. [所有景区基础信息](#allscenic-get)
17 17 1. [标签 - 所有标签](#alltag-get)
18 18 1. [标签 - 按照标签分组查看所有标签](#alltaggroup-get)
19   -1. [用户管理 - 检查Token是否过期](#checktoken-get)
  19 +1. [用户管理 - 检查Token是否过期](#checktoken-post)
20 20 1. [查询商品信息](#commodityinfo-get)
21 21 1. [投诉 - 增加投诉](#createcomplaint-post)
22 22 1. [查询用户的定时提醒](#dealymessage-info-get)
... ... @@ -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 185 用户管理 - 检查Token是否过期
... ...
main.go
... ... @@ -114,7 +114,7 @@ func main() {
114 114 r.GET("/Icon/All", Api.AllIcons)
115 115 r.GET("/Icon/Info", Api.IconInfo)
116 116 r.POST("/CheckToken", Api.CheckToken)
117   - r.GET("/Tiles", Api.Tiles)
  117 + //r.GET("/Tiles", Api.Tiles)
118 118 r.POST("/TopMenus/Update", Api.UpdateTopMenus)
119 119 r.GET("/TopMenus/All", Api.AllTopMenus)
120 120 r.POST("/RegisterDevice", Api.RegisterDevice)
... ... @@ -123,7 +123,12 @@ func main() {
123 123 r.Static("/Upload", "./Upload")
124 124 r.Static("/Console", "./Console")
125 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 132 // go Ws.Manager.Start()
128 133  
129 134 // 创建延迟消息
... ...