Commit 8553d477b587a5356a0814cf4a6a8fdd9cb5e045
1 parent
da5bf474
Exists in
v1.2
and in
2 other branches
..
Showing
9 changed files
with
305 additions
and
40 deletions
Show diff stats
API/Complaint.go
... | ... | @@ -52,7 +52,7 @@ func CreateComplaint(c *gin.Context) { |
52 | 52 | |
53 | 53 | |
54 | 54 | // 检查验证码 |
55 | - cacheCode := DB.Redis.Get(c.PostForm("Mobile")) | |
55 | + cacheCode := DB.Redis.Get("code_"+c.PostForm("Mobile")) | |
56 | 56 | if cacheCode != c.PostForm("Code") { |
57 | 57 | |
58 | 58 | c.JSON(200, tools.ResponseError{ | ... | ... |
API/DealyMessage.go
... | ... | @@ -5,6 +5,7 @@ import ( |
5 | 5 | "github.com/gin-gonic/gin" |
6 | 6 | "gopkg.in/mgo.v2/bson" |
7 | 7 | "letu/Lib/DelayMessage" |
8 | + "letu/Lib/Token" | |
8 | 9 | ) |
9 | 10 | |
10 | 11 | // @Title 查询用户的定时提醒 |
... | ... | @@ -12,6 +13,7 @@ import ( |
12 | 13 | // @Accept json |
13 | 14 | // @Produce json |
14 | 15 | // @Param UserId 5dfb03070a9ac17ac7a82054 string true "用户id" |
16 | +// @Param Token wgergejfwe string true "用户token" | |
15 | 17 | // @Success 200 {object} tools.ResponseSeccess "DelayTime=执行时间;Type=类型(0请求url地址1发送app通知);Fail失败次数;Title=通知标题;Content=通知内容;UDID=设备id" |
16 | 18 | // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" |
17 | 19 | // @Router /DealyMessage/Info? [get] |
... | ... | @@ -19,6 +21,22 @@ func DealyMessageInfo(c *gin.Context) { |
19 | 21 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
20 | 22 | c.Header("Access-Control-Allow-Credentials", "true") |
21 | 23 | |
24 | + if c.Query("Token") == "" || bson.IsObjectIdHex(c.Query("UserId")) == false { | |
25 | + c.JSON(200, tools.ResponseError{ | |
26 | + 1, | |
27 | + "参数不正确", | |
28 | + }) | |
29 | + return | |
30 | + } | |
31 | + | |
32 | + if Token.GetToken(c.Query("UserId")) != c.Query("Token") { | |
33 | + c.JSON(200, tools.ResponseError{ | |
34 | + 1, | |
35 | + "token不正确", | |
36 | + }) | |
37 | + return | |
38 | + } | |
39 | + | |
22 | 40 | var aDelayMessage []DelayMessage.Message |
23 | 41 | DelayMessage.CDelayMessage.Find(bson.M{"UserId": c.Query("UserId")}).All(&aDelayMessage) |
24 | 42 | |
... | ... | @@ -36,6 +54,7 @@ func DealyMessageInfo(c *gin.Context) { |
36 | 54 | // @Accept json |
37 | 55 | // @Produce json |
38 | 56 | // @Param UserId 5dfb03070a9ac17ac7a82054 string true "用户id" |
57 | +// @Param Token wgergejfwe string true "用户token" | |
39 | 58 | // @Param UDID 5dfb03070a9ac17ac7a82054 string true "设备id" |
40 | 59 | // @Param Title 表演时间提醒 string true "标题" |
41 | 60 | // @Param Content 5分钟后有表演 string true "内容" |
... | ... | @@ -47,6 +66,22 @@ func CreateDealyMessage(c *gin.Context) { |
47 | 66 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
48 | 67 | c.Header("Access-Control-Allow-Credentials", "true") |
49 | 68 | |
69 | + if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("UserId")) == false { | |
70 | + c.JSON(200, tools.ResponseError{ | |
71 | + 1, | |
72 | + "参数不正确", | |
73 | + }) | |
74 | + return | |
75 | + } | |
76 | + | |
77 | + if Token.GetToken(c.PostForm("UserId")) != c.PostForm("Token") { | |
78 | + c.JSON(200, tools.ResponseError{ | |
79 | + 1, | |
80 | + "token不正确", | |
81 | + }) | |
82 | + return | |
83 | + } | |
84 | + | |
50 | 85 | err := DelayMessage.GlobalDM.AddTaskForAppMessage(c.PostForm("DelayTime"), c.PostForm("UDID"), c.PostForm("Title"), c.PostForm("Content"), c.PostForm("UserId")) |
51 | 86 | |
52 | 87 | if err == nil { |
... | ... | @@ -70,6 +105,8 @@ func CreateDealyMessage(c *gin.Context) { |
70 | 105 | // @Accept json |
71 | 106 | // @Produce json |
72 | 107 | // @Param id 5dfb03070a9ac17ac7a82054 string true "提醒id" |
108 | +// @Param UserId 5dfb03070a9ac17ac7a82054 string true "用户id" | |
109 | +// @Param Token wgergejfwe string true "用户token" | |
73 | 110 | // @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}" |
74 | 111 | // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" |
75 | 112 | // @Router /DealyMessage/Remove? [post] |
... | ... | @@ -77,11 +114,18 @@ func RemoveDealyMessage(c *gin.Context) { |
77 | 114 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
78 | 115 | c.Header("Access-Control-Allow-Credentials", "true") |
79 | 116 | |
117 | + if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("UserId")) == false { | |
118 | + c.JSON(200, tools.ResponseError{ | |
119 | + 1, | |
120 | + "参数不正确", | |
121 | + }) | |
122 | + return | |
123 | + } | |
80 | 124 | |
81 | - if bson.IsObjectIdHex(c.PostForm("id")) == false { | |
125 | + if Token.GetToken(c.PostForm("UserId")) != c.PostForm("Token") { | |
82 | 126 | c.JSON(200, tools.ResponseError{ |
83 | 127 | 1, |
84 | - "id不正确", | |
128 | + "token不正确", | |
85 | 129 | }) |
86 | 130 | return |
87 | 131 | } | ... | ... |
... | ... | @@ -0,0 +1,113 @@ |
1 | +package Api | |
2 | + | |
3 | +import ( | |
4 | + "github.com/aarongao/tools" | |
5 | + "github.com/gin-gonic/gin" | |
6 | + "gopkg.in/mgo.v2/bson" | |
7 | + "letu/DB" | |
8 | +) | |
9 | + | |
10 | +// @Title 返回图标基础信息 | |
11 | +// @Description 图标管理 - 返回图标基础信息 | |
12 | +// @Accept json | |
13 | +// @Produce json | |
14 | +// @Param id 5dfb03070a9ac17ac7a82054 string true "图标id" | |
15 | +// @Success 200 {object} tools.ResponseSeccess "Name名称:Picture图片地址:id图标id" | |
16 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | |
17 | +// @Router /Icon/Info? [get] | |
18 | +func IconInfo(c *gin.Context) { | |
19 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | |
20 | + c.Header("Access-Control-Allow-Credentials", "true") | |
21 | + | |
22 | + if c.Query("id") == "" { | |
23 | + c.JSON(200, tools.ResponseError{ | |
24 | + 1, | |
25 | + "id为空", | |
26 | + }) | |
27 | + return | |
28 | + } | |
29 | + | |
30 | + var SIcon *DB.SIcons | |
31 | + DB.CIcons.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&SIcon) | |
32 | + | |
33 | + c.JSON(200, tools.ResponseSeccess{ | |
34 | + 0, | |
35 | + SIcon, | |
36 | + }) | |
37 | + | |
38 | +} | |
39 | + | |
40 | +// @Title 更新图标信息 | |
41 | +// @Description 图标管理 - 增加或修改图标信息 | |
42 | +// @Accept json | |
43 | +// @Produce json | |
44 | +// @Param id 5dfb03070a9ac17ac7a82054 string true "图标id" | |
45 | +// @Success 200 {object} tools.ResponseSeccess "Name名称:Picture图片地址:id图标id:ScenicId景区id" | |
46 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | |
47 | +// @Router /Icon/Update? [post] | |
48 | +func UpdateIcon(c *gin.Context) { | |
49 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | |
50 | + c.Header("Access-Control-Allow-Credentials", "true") | |
51 | + | |
52 | + ScenicId := c.PostForm("ScenicId") | |
53 | + if ScenicId == "" || ScenicId == "undefined" { | |
54 | + c.JSON(200, tools.ResponseError{ | |
55 | + 1, | |
56 | + "缺少scenicid(景区id)", | |
57 | + }) | |
58 | + return | |
59 | + } | |
60 | + | |
61 | + var id bson.ObjectId | |
62 | + if pid := c.PostForm("id"); pid == "null" { | |
63 | + id = bson.NewObjectId() | |
64 | + } else { | |
65 | + id = bson.ObjectIdHex(pid) | |
66 | + } | |
67 | + | |
68 | + DB.CIcons.UpsertId( | |
69 | + id, | |
70 | + bson.M{"$set": bson.M{ | |
71 | + "Name": c.PostForm("Name"), | |
72 | + "Picture": c.PostForm("Picture"), | |
73 | + "ScenicId": ScenicId, | |
74 | + }}, | |
75 | + ) | |
76 | + | |
77 | + c.JSON(200, tools.ResponseSeccess{ | |
78 | + 0, | |
79 | + "ok", | |
80 | + }) | |
81 | + | |
82 | +} | |
83 | + | |
84 | +// @Title 所有图标 | |
85 | +// @Description 图标管理 - 所有图标 | |
86 | +// @Accept json | |
87 | +// @Produce json | |
88 | +// @Param ScenicId 5dfb03070a9ac17ac7a82054 string true "景区id" | |
89 | +// @Success 200 {object} tools.ResponseSeccess "Name名称:Picture图片地址:id图标id:ScenicId景区id" | |
90 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | |
91 | +// @Router /Icon/All? [get] | |
92 | +func AllIcons(c *gin.Context) { | |
93 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | |
94 | + c.Header("Access-Control-Allow-Credentials", "true") | |
95 | + | |
96 | + ScenicId := c.Query("ScenicId") | |
97 | + if ScenicId == "" || ScenicId == "undefined" { | |
98 | + c.JSON(200, tools.ResponseError{ | |
99 | + 1, | |
100 | + "缺少scenicid(景区id)", | |
101 | + }) | |
102 | + return | |
103 | + } | |
104 | + | |
105 | + var SIcons = []*DB.SIcons{} | |
106 | + DB.CIcons.Find(bson.M{"ScenicId": ScenicId}).All(&SIcons) | |
107 | + | |
108 | + c.JSON(200, tools.ResponseSeccess{ | |
109 | + 0, | |
110 | + SIcons, | |
111 | + }) | |
112 | + | |
113 | +} | ... | ... |
API/Sms.go
... | ... | @@ -38,7 +38,7 @@ func Send(c *gin.Context) { |
38 | 38 | return |
39 | 39 | } |
40 | 40 | |
41 | - cacheCode := DB.Redis.Get(c.PostForm("Mobile")) | |
41 | + cacheCode := DB.Redis.Get("code_"+c.PostForm("Mobile")) | |
42 | 42 | if cacheCode != nil { |
43 | 43 | c.JSON(200, tools.ResponseError{ |
44 | 44 | 1, |
... | ... | @@ -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(c.PostForm("Mobile"), code, time.Second*60) | |
70 | + DB.Redis.Set("code_"+c.PostForm("Mobile"), code, time.Second*60) | |
71 | 71 | } |
72 | 72 | } |
73 | 73 | ... | ... |
API/User.go
... | ... | @@ -7,12 +7,12 @@ import ( |
7 | 7 | "github.com/gin-gonic/gin" |
8 | 8 | "gopkg.in/mgo.v2/bson" |
9 | 9 | "letu/DB" |
10 | + "letu/Lib/Token" | |
10 | 11 | "regexp" |
11 | 12 | "strconv" |
12 | 13 | "time" |
13 | 14 | ) |
14 | 15 | |
15 | - | |
16 | 16 | var Regular = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$" |
17 | 17 | |
18 | 18 | // @Title 登录 |
... | ... | @@ -51,7 +51,7 @@ func LoginUser(c *gin.Context) { |
51 | 51 | token := hex.EncodeToString(tokenunit8[:32]) |
52 | 52 | |
53 | 53 | // 检查验证码 |
54 | - cacheCode := DB.Redis.Get(c.PostForm("Mobile")) | |
54 | + cacheCode := DB.Redis.Get("code_" + c.PostForm("Mobile")) | |
55 | 55 | selected := bson.M{} |
56 | 56 | var User *DB.SMember |
57 | 57 | if cacheCode == c.PostForm("Code") { |
... | ... | @@ -61,46 +61,35 @@ func LoginUser(c *gin.Context) { |
61 | 61 | // 验证码匹配,但手机号不存在 |
62 | 62 | if User == nil { |
63 | 63 | objectID := bson.NewObjectId() |
64 | - oUser := DB.SMember{ | |
64 | + User := DB.SMember{ | |
65 | 65 | &objectID, |
66 | 66 | "", |
67 | 67 | "", |
68 | 68 | "", |
69 | 69 | c.PostForm("Mobile"), |
70 | 70 | "", |
71 | - token, | |
72 | 71 | "", |
73 | 72 | } |
74 | - DB.CMember.Insert(oUser) | |
75 | - //if err == nil { | |
76 | - c.JSON(200, tools.ResponseSeccess{ | |
77 | - 0, | |
78 | - oUser, | |
79 | - }) | |
80 | - return | |
81 | - //} | |
73 | + DB.CMember.Insert(User) | |
82 | 74 | } |
83 | 75 | |
84 | 76 | } else { |
85 | - selected["Mobile"] = c.PostForm("Mobile") | |
86 | - selected["Code"] = c.PostForm("Code") | |
87 | - DB.CMember.Find(selected).One(&User) | |
88 | - if User == nil { | |
89 | - c.JSON(200, tools.ResponseError{ | |
90 | - 1, | |
91 | - "用户不存在或密码不正确", | |
92 | - }) | |
93 | - return | |
94 | - } | |
77 | + c.JSON(200, tools.ResponseError{ | |
78 | + 1, | |
79 | + "验证码不正确", | |
80 | + }) | |
81 | + return | |
95 | 82 | } |
96 | 83 | |
97 | 84 | // 更新用户信息 |
98 | - DB.CMember.Update( | |
99 | - bson.M{"_id": User.Id}, | |
100 | - bson.M{"$set": bson.M{"Token": token}}, | |
101 | - ) | |
85 | + //DB.CMember.Update( | |
86 | + // bson.M{"_id": User.Id}, | |
87 | + // bson.M{"$set": bson.M{"Token": token}}, | |
88 | + //) | |
89 | + | |
90 | + // 更新token | |
91 | + Token.SaveToken(User.Id.Hex(), token) | |
102 | 92 | |
103 | - User.Token = token | |
104 | 93 | c.JSON(200, tools.ResponseSeccess{ |
105 | 94 | 0, |
106 | 95 | User, |
... | ... | @@ -113,6 +102,7 @@ func LoginUser(c *gin.Context) { |
113 | 102 | // @Accept json |
114 | 103 | // @Produce json |
115 | 104 | // @Param id aaron string true "用户id" |
105 | +// @Param Token wgergejfwe string true "用户token" | |
116 | 106 | // @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":{"Id":"5e09c64c1c09c6f0f7ca2fa9","Token":"640bf934e425aba5d3c90998b2641f2f0ca07261d334d9615d1cd4790b5f34e7"}}" |
117 | 107 | // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" |
118 | 108 | // @Router /UserInfo? [get] |
... | ... | @@ -120,10 +110,19 @@ func UserInfo(c *gin.Context) { |
120 | 110 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
121 | 111 | c.Header("Access-Control-Allow-Credentials", "true") |
122 | 112 | |
123 | - if c.Query("id") == "" { | |
113 | + | |
114 | + if c.Query("Token") == "" || bson.IsObjectIdHex(c.Query("id")) == false{ | |
124 | 115 | c.JSON(200, tools.ResponseError{ |
125 | 116 | 1, |
126 | - "空", | |
117 | + "参数不正确", | |
118 | + }) | |
119 | + return | |
120 | + } | |
121 | + | |
122 | + if Token.GetToken(c.Query("id")) != c.Query("Token"){ | |
123 | + c.JSON(200, tools.ResponseError{ | |
124 | + 1, | |
125 | + "token不正确", | |
127 | 126 | }) |
128 | 127 | return |
129 | 128 | } |
... | ... | @@ -142,6 +141,8 @@ func UserInfo(c *gin.Context) { |
142 | 141 | // @Description 用户管理 - 修改用户信息 |
143 | 142 | // @Accept json |
144 | 143 | // @Produce json |
144 | +// @Param id aaron string true "用户id"" | |
145 | +// @Param Token wgergejfwe string true "用户token" | |
145 | 146 | // @Param Birthday 2010.10.10 string true "生日" |
146 | 147 | // @Param FullName aarongao string true "全名" |
147 | 148 | // @Param Code 12345678 string true "6位验证码" |
... | ... | @@ -155,6 +156,24 @@ func UpdateUser(c *gin.Context) { |
155 | 156 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
156 | 157 | c.Header("Access-Control-Allow-Credentials", "true") |
157 | 158 | |
159 | + | |
160 | + if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("id")) == false{ | |
161 | + c.JSON(200, tools.ResponseError{ | |
162 | + 1, | |
163 | + "参数不正确", | |
164 | + }) | |
165 | + return | |
166 | + } | |
167 | + | |
168 | + if Token.GetToken(c.PostForm("id")) != c.PostForm("Token"){ | |
169 | + c.JSON(200, tools.ResponseError{ | |
170 | + 1, | |
171 | + "token不正确", | |
172 | + }) | |
173 | + return | |
174 | + } | |
175 | + | |
176 | + | |
158 | 177 | reg := regexp.MustCompile(Regular) |
159 | 178 | if !reg.MatchString(c.PostForm("Mobile")) { |
160 | 179 | |
... | ... | @@ -182,7 +201,7 @@ func UpdateUser(c *gin.Context) { |
182 | 201 | //} |
183 | 202 | |
184 | 203 | // 检查验证码 |
185 | - code := DB.Redis.Get(c.PostForm("Mobile")) | |
204 | + code := DB.Redis.Get("code_" + c.PostForm("Mobile")) | |
186 | 205 | if code == "" || code != c.PostForm("Code") { |
187 | 206 | c.JSON(200, tools.ResponseError{ |
188 | 207 | 1, |
... | ... | @@ -192,19 +211,18 @@ func UpdateUser(c *gin.Context) { |
192 | 211 | } |
193 | 212 | |
194 | 213 | err := DB.CMember.Update( |
195 | - bson.M{"Mobile": c.PostForm("Mobile")}, | |
214 | + bson.M{"_id": bson.ObjectIdHex(c.PostForm("id"))}, | |
196 | 215 | bson.M{"$set": bson.M{ |
197 | 216 | "Birthday": c.PostForm("Birthday"), |
198 | 217 | "FullName": c.PostForm("FullName"), |
199 | 218 | "Mobile": c.PostForm("Mobile"), |
200 | - "Sex": c.PostForm("Sex"), | |
219 | + "Sex": c.PostForm("Sex"), | |
201 | 220 | }}, |
202 | 221 | ) |
203 | 222 | |
204 | 223 | if err == nil { |
205 | - | |
206 | 224 | var User *DB.SMember |
207 | - DB.CMember.Find(bson.M{"Mobile": c.PostForm("Mobile")}).One(&User) | |
225 | + DB.CMember.Find(bson.M{"_id": bson.ObjectIdHex(c.PostForm("id"))}).One(&User) | |
208 | 226 | |
209 | 227 | c.JSON(200, tools.ResponseSeccess{ |
210 | 228 | 0, | ... | ... |
DB/db.go
... | ... | @@ -20,6 +20,7 @@ var CLine *mgo.Collection //推荐线路 |
20 | 20 | var CEventLog *mgo.Collection //用户行为记录 |
21 | 21 | var CActionLog *mgo.Collection //操作记录 |
22 | 22 | var CTrajectory *mgo.Collection //移动轨迹 |
23 | +var CIcons *mgo.Collection //图标信息 | |
23 | 24 | var DB *mgo.Database |
24 | 25 | |
25 | 26 | type SItem struct { |
... | ... | @@ -43,6 +44,12 @@ type SItem struct { |
43 | 44 | Reminder string `bson:"Reminder" json:"Reminder"` //温馨提示 |
44 | 45 | State int `bson:"State" json:"State"` // 运行状态0=正常1=停运 |
45 | 46 | } |
47 | +type SIcons struct { | |
48 | + Id *bson.ObjectId `bson:"_id" json:"Id" valid:"required"` | |
49 | + ScenicId string `bson:"ScenicId" json:"ScenicId"` | |
50 | + Name string `bson:"Name" json:"Name"` | |
51 | + Picture string `bson:"Picture" json:"Picture"` | |
52 | +} | |
46 | 53 | type STrajectory struct { |
47 | 54 | UserId string `bson:"UserId" json:"UserId"` // 用户ID |
48 | 55 | Location SLocation `bson:"Location" json:"Location"` |
... | ... | @@ -116,7 +123,6 @@ type SMember struct { |
116 | 123 | FullName string `bson:"FullName" json:"FullName"` |
117 | 124 | Mobile string `bson:"Mobile" json:"Mobile"` |
118 | 125 | Openid string `bson:"Openid" json:"Openid"` |
119 | - Token string `bson:"Token" json:"Token"` | |
120 | 126 | Sex string `bson:"Sex" json:"Sex"` |
121 | 127 | } |
122 | 128 | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | +package Token | |
2 | + | |
3 | +import ( | |
4 | + "letu/DB" | |
5 | + "time" | |
6 | +) | |
7 | + | |
8 | +func GetToken(mobile string) string { | |
9 | + token := DB.Redis.Get("token_" + mobile) | |
10 | + return token.(string) | |
11 | +} | |
12 | + | |
13 | +func SaveToken(mobile, token string) { | |
14 | + DB.Redis.Set("token_"+mobile, token, time.Second*3600*24*7) | |
15 | +} | ... | ... |
README.md
... | ... | @@ -20,6 +20,9 @@ |
20 | 20 | 1. [创建提醒](#dealymessage-create-post) |
21 | 21 | 1. [删除提醒](#dealymessage-remove-post) |
22 | 22 | 1. [增加访问日志](#eventlog-post) |
23 | +1. [图标管理 - 返回图标基础信息](#icon-info-get) | |
24 | +1. [图标管理 - 增加或修改图标信息](#icon-update-post) | |
25 | +1. [图标管理 - 所有图标](#icon-all-get) | |
23 | 26 | 1. [问券调查 - 增加调查](#investigation-save-post) |
24 | 27 | 1. [问券调查 - 查询所有问券调查](#investigation-list-get) |
25 | 28 | 1. [设备管理 - 查询设备信息](#iteminfo-get) |
... | ... | @@ -184,6 +187,7 @@ |
184 | 187 | | Param Name | Example | Data Type | Description | Required? | |
185 | 188 | |-----|-----|-----|-----|-----| |
186 | 189 | | UserId | 5dfb03070a9ac17ac7a82054 | string | 用户id | Yes | |
190 | +| Token | wgergejfwe | string | 用户token | Yes | | |
187 | 191 | |
188 | 192 | |
189 | 193 | | Code | Type | Model | Message | |
... | ... | @@ -202,6 +206,7 @@ |
202 | 206 | | Param Name | Example | Data Type | Description | Required? | |
203 | 207 | |-----|-----|-----|-----|-----| |
204 | 208 | | UserId | 5dfb03070a9ac17ac7a82054 | string | 用户id | Yes | |
209 | +| Token | wgergejfwe | string | 用户token | Yes | | |
205 | 210 | | UDID | 5dfb03070a9ac17ac7a82054 | string | 设备id | Yes | |
206 | 211 | | Title | 表演时间提醒 | string | 标题 | Yes | |
207 | 212 | | Content | 5分钟后有表演 | string | 内容 | Yes | |
... | ... | @@ -224,6 +229,8 @@ |
224 | 229 | | Param Name | Example | Data Type | Description | Required? | |
225 | 230 | |-----|-----|-----|-----|-----| |
226 | 231 | | id | 5dfb03070a9ac17ac7a82054 | string | 提醒id | Yes | |
232 | +| UserId | 5dfb03070a9ac17ac7a82054 | string | 用户id | Yes | | |
233 | +| Token | wgergejfwe | string | 用户token | Yes | | |
227 | 234 | |
228 | 235 | |
229 | 236 | | Code | Type | Model | Message | |
... | ... | @@ -258,6 +265,61 @@ |
258 | 265 | |
259 | 266 | |
260 | 267 | |
268 | +<a name="icon-info-get"></a> | |
269 | + | |
270 | +#### /Icon/Info (GET) | |
271 | + | |
272 | + | |
273 | +图标管理 - 返回图标基础信息 | |
274 | + | |
275 | +| Param Name | Example | Data Type | Description | Required? | | |
276 | +|-----|-----|-----|-----|-----| | |
277 | +| id | 5dfb03070a9ac17ac7a82054 | string | 图标id | Yes | | |
278 | + | |
279 | + | |
280 | +| Code | Type | Model | Message | | |
281 | +|-----|-----|-----|-----| | |
282 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Name名称:Picture图片地址:id图标id | | |
283 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | |
284 | + | |
285 | + | |
286 | +<a name="icon-update-post"></a> | |
287 | + | |
288 | +#### /Icon/Update (POST) | |
289 | + | |
290 | + | |
291 | +图标管理 - 增加或修改图标信息 | |
292 | + | |
293 | +| Param Name | Example | Data Type | Description | Required? | | |
294 | +|-----|-----|-----|-----|-----| | |
295 | +| id | 5dfb03070a9ac17ac7a82054 | string | 图标id | Yes | | |
296 | + | |
297 | + | |
298 | +| Code | Type | Model | Message | | |
299 | +|-----|-----|-----|-----| | |
300 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Name名称:Picture图片地址:id图标id:ScenicId景区id | | |
301 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | |
302 | + | |
303 | + | |
304 | +<a name="icon-all-get"></a> | |
305 | + | |
306 | +#### /Icon/All (GET) | |
307 | + | |
308 | + | |
309 | +图标管理 - 所有图标 | |
310 | + | |
311 | +| Param Name | Example | Data Type | Description | Required? | | |
312 | +|-----|-----|-----|-----|-----| | |
313 | +| ScenicId | 5dfb03070a9ac17ac7a82054 | string | 景区id | Yes | | |
314 | + | |
315 | + | |
316 | +| Code | Type | Model | Message | | |
317 | +|-----|-----|-----|-----| | |
318 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Name名称:Picture图片地址:id图标id:ScenicId景区id | | |
319 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | |
320 | + | |
321 | + | |
322 | + | |
261 | 323 | <a name="investigation-save-post"></a> |
262 | 324 | |
263 | 325 | #### /Investigation/Save (POST) |
... | ... | @@ -517,6 +579,8 @@ |
517 | 579 | |
518 | 580 | | Param Name | Example | Data Type | Description | Required? | |
519 | 581 | |-----|-----|-----|-----|-----| |
582 | +| id | aaron | string | 用户id | Yes | | |
583 | +| Token | wgergejfwe | string | 用户token | Yes | | |
520 | 584 | | Birthday | 2010.10.10 | string | 生日 | Yes | |
521 | 585 | | FullName | aarongao | string | 全名 | Yes | |
522 | 586 | | Code | 12345678 | string | 6位验证码 | Yes | |
... | ... | @@ -561,6 +625,7 @@ |
561 | 625 | | Param Name | Example | Data Type | Description | Required? | |
562 | 626 | |-----|-----|-----|-----|-----| |
563 | 627 | | id | aaron | string | 用户id | Yes | |
628 | +| Token | wgergejfwe | string | 用户token | Yes | | |
564 | 629 | |
565 | 630 | |
566 | 631 | | Code | Type | Model | Message | | ... | ... |
main.go
... | ... | @@ -60,6 +60,7 @@ func main() { |
60 | 60 | DB.CActionLog = DB.DB.C("ActionLog") |
61 | 61 | DB.CInvestigation = DB.DB.C("Investigation") |
62 | 62 | DB.CTrajectory = DB.DB.C("Trajectory") |
63 | + DB.CIcons = DB.DB.C("Icons") | |
63 | 64 | DelayMessage.CDelayMessage = DB.DB.C("DelayMessage") |
64 | 65 | DelayMessage.CDelayErrorLog = DB.DB.C("DelayErrorLog") |
65 | 66 | |
... | ... | @@ -98,6 +99,9 @@ func main() { |
98 | 99 | r.POST("/DealyMessage/Create", Api.CreateDealyMessage) |
99 | 100 | r.GET("/DealyMessage/Info", Api.DealyMessageInfo) |
100 | 101 | r.POST("/DealyMessage/Remove", Api.RemoveDealyMessage) |
102 | + r.POST("/Icon/Update", Api.UpdateIcon) | |
103 | + r.GET("/Icon/All", Api.AllIcons) | |
104 | + r.GET("/Icon/Info", Api.IconInfo) | |
101 | 105 | //r.GET("/ws", Api.WsPage) |
102 | 106 | |
103 | 107 | r.Static("/Upload", "./Upload") | ... | ... |