Commit 2f326a5c6dc8f99bf445aa8716557a34ee876bde

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

..

API/Item.go
... ... @@ -3,7 +3,6 @@ package Api
3 3 import (
4 4 "encoding/json"
5 5 "github.com/aarongao/tools"
6   - "github.com/davecgh/go-spew/spew"
7 6 "github.com/gin-gonic/gin"
8 7 "gopkg.in/mgo.v2/bson"
9 8 "letu/DB"
... ... @@ -110,6 +109,24 @@ func UpdateItem(c *gin.Context) {
110 109 }},
111 110 )
112 111  
  112 +
  113 +
  114 + // 更新等待时间
  115 + allteim := DB.Redis.Get("AllItemTime")
  116 + jsond,_ := json.Marshal(allteim)
  117 +
  118 + var ItemTime map[string]string
  119 + json.Unmarshal([]byte(jsond), &ItemTime)
  120 +
  121 + if poststate == 1{
  122 + ItemTime[c.PostForm("id")] = "--"
  123 + }
  124 + if poststate == 0{
  125 + ItemTime[c.PostForm("id")] = "0"
  126 + }
  127 + DB.Redis.Set("AllItemTime", ItemTime, time.Second*60*60*24*30)
  128 +
  129 +
113 130 c.JSON(200, tools.ResponseSeccess{
114 131 0,
115 132 "ok",
... ... @@ -147,7 +164,6 @@ func UpdateItemTime(c *gin.Context) {
147 164 0,
148 165 "ok",
149 166 })
150   -
151 167 }
152 168  
153 169 // @Title 获得所有设备的等待时间
... ... @@ -162,21 +178,18 @@ func AllItemTime(c *gin.Context) {
162 178 c.Header("Access-Control-Allow-Credentials", "true")
163 179  
164 180  
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   -
  181 + //Device := DB.SDevice{
  182 + // c.Request.Header.Get("DeviceId"),
  183 + // c.Request.Header.Get("Mac"),
  184 + // c.Request.Header.Get("UDID"),
  185 + // c.Request.Header.Get("SystemVersion"),
  186 + // c.Request.Header.Get("SystemModel"),
  187 + // c.Request.Header.Get("AppVersion"),
  188 + // c.Request.Header.Get("AppVersion"),
  189 + // c.Request.Header.Get("DeviceToken"),
  190 + //}
  191 + //spew.Dump(Device)
177 192  
178   - var ItemTime map[string]string
179   - json.Unmarshal([]byte(c.PostForm("items")), &ItemTime)
180 193  
181 194 allteim := DB.Redis.Get("AllItemTime")
182 195 if allteim != nil {
... ... @@ -185,4 +198,4 @@ func AllItemTime(c *gin.Context) {
185 198 c.String(200, "{}")
186 199 }
187 200  
188 201 -}
  202 +}
189 203 \ No newline at end of file
... ...
API/Scenic.go
... ... @@ -13,7 +13,7 @@ import (
13 13 // @Accept json
14 14 // @Produce json
15 15 // @Param id 5dfb03070a9ac17ac7a82054 string true "景区id"
16   -// @Success 200 {object} tools.ResponseSeccess "Name名称;Describe介绍;OpenHours营业时间;Picture最上面图片;ShopAdPicture商城列表页图片;ItemScenicPicture项目场次照片;ActivityPicture活动照片;VideoList视频(VideoPicture=首桢图片);InvestigationUrl问券调查的url"
  16 +// @Success 200 {object} tools.ResponseSeccess "Name名称;Describe介绍;OpenHours营业时间;Picture最上面图片;ShopAdPicture商城列表页图片;ItemScenicPicture项目场次照片;ActivityPicture活动照片;VideoList视频(VideoPicture=首桢图片);InvestigationUrl问券调查的url;RangeLocation景区范围(多个坐标点)"
17 17 // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}"
18 18 // @Router /ScenicInfo? [get]
19 19 func ScenicInfo(c *gin.Context) {
... ... @@ -43,7 +43,7 @@ func ScenicInfo(c *gin.Context) {
43 43 // @Accept json
44 44 // @Produce json
45 45 // @Param id 5dfb03070a9ac17ac7a82054 string true "景区id"
46   -// @Success 200 {object} tools.ResponseSeccess "Name名称;Describe介绍;OpenHours营业时间;Picture最上面图片;ShopAdPicture商城列表页图片;ItemScenicPicture项目场次照片;ActivityPicture活动照片;VideoList视频(VideoPicture=首桢图片);InvestigationUrl问券调查的url"
  46 +// @Success 200 {object} tools.ResponseSeccess "Name名称;Describe介绍;OpenHours营业时间;Picture最上面图片;ShopAdPicture商城列表页图片;ItemScenicPicture项目场次照片;ActivityPicture活动照片;VideoList视频(VideoPicture=首桢图片);InvestigationUrl问券调查的url;RangeLocation景区范围(多个坐标点)"
47 47 // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}"
48 48 // @Router /UpdateScenic? [post]
49 49 func UpdateScenic(c *gin.Context) {
... ... @@ -53,6 +53,9 @@ func UpdateScenic(c *gin.Context) {
53 53 var Location DB.SLocation
54 54 json.Unmarshal([]byte(c.PostForm("Location")), &Location)
55 55  
  56 + var RangeLocation []DB.SLocation
  57 + json.Unmarshal([]byte(c.PostForm("RangeLocation")), &RangeLocation)
  58 +
56 59 var Picture []DB.SPicture
57 60 json.Unmarshal([]byte(c.PostForm("Picture")), &Picture)
58 61  
... ... @@ -84,6 +87,7 @@ func UpdateScenic(c *gin.Context) {
84 87 "Name": c.PostForm("Name"),
85 88 "Describe": c.PostForm("Describe"),
86 89 "Location": Location,
  90 + "RangeLocation": RangeLocation,
87 91 "OpenHours": c.PostForm("OpenHours"),
88 92 "Mobile": c.PostForm("Mobile"),
89 93 "Address": c.PostForm("Address"),
... ...
API/User.go
... ... @@ -335,3 +335,51 @@ func UpdateUser(c *gin.Context) {
335 335 }
336 336  
337 337 }
  338 +
  339 +
  340 +// @Title 删除用户
  341 +// @Description 用户管理 - 删除用户(注销)
  342 +// @Accept json
  343 +// @Produce json
  344 +// @Param id aaron string true "用户id""
  345 +// @Param Token wgergejfwe string true "用户token"
  346 +// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}"
  347 +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}"
  348 +// @Router /RemoveUser? [post]
  349 +func RemoveUser(c *gin.Context) {
  350 + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin"))
  351 + c.Header("Access-Control-Allow-Credentials", "true")
  352 +
  353 + if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("id")) == false {
  354 + c.JSON(200, tools.ResponseError{
  355 + 1,
  356 + "Token或者用户id不正确",
  357 + })
  358 + return
  359 + }
  360 +
  361 + if Token.GetToken(c.PostForm("id")) != c.PostForm("Token") {
  362 + c.JSON(200, tools.ResponseError{
  363 + 401,
  364 + "token过期",
  365 + })
  366 + return
  367 + }
  368 +
  369 +
  370 + err := DB.CMember.Remove(bson.M{"_id": bson.ObjectIdHex(c.PostForm("id"))})
  371 +
  372 + if err == nil {
  373 +
  374 + c.JSON(200, tools.ResponseSeccess{
  375 + 0,
  376 + "ok",
  377 + })
  378 + } else {
  379 + c.JSON(200, tools.ResponseError{
  380 + 1,
  381 + err.Error(),
  382 + })
  383 + }
  384 +
  385 +}
... ...
DB/db.go
... ... @@ -182,4 +182,5 @@ type SScenic struct {
182 182 ItemScenicPicture []SPicture `bson:"ItemScenicPicture" json:"ItemScenicPicture"` //项目场次照片
183 183 ActivityPicture []SPicture `bson:"ActivityPicture" json:"ActivityPicture"` //活动照片
184 184 VideoList []SVideo `bson:"VideoList" json:"VideoList"`
  185 + RangeLocation []SLocation `bson:"RangeLocation" json:"RangeLocation"` //景区范围
185 186 }
... ...
README.md
... ... @@ -31,6 +31,7 @@
31 31 1. [查询线路信息](#lineinfo-get)
32 32 1. [用户管理 - 用户登录&注册](#loginuser-post)
33 33 1. [用户管理 - 注册客户端](#registerdevice-post)
  34 +1. [用户管理 - 删除用户(注销)](#removeuser-post)
34 35 1. [返回景区基础信息](#scenicinfo-get)
35 36 1. [发送短信验证码](#sms-send-post)
36 37 1. [标签 - 增加标签](#tag-create-post)
... ... @@ -489,6 +490,26 @@
489 490  
490 491  
491 492  
  493 +<a name="removeuser-post"></a>
  494 +
  495 +#### /RemoveUser (POST)
  496 +
  497 +
  498 +用户管理 - 删除用户(注销)
  499 +
  500 +| Param Name | Example | Data Type | Description | Required? |
  501 +|-----|-----|-----|-----|-----|
  502 +| id | aaron | string | 用户id | Yes |
  503 +| Token | wgergejfwe | string | 用户token | Yes |
  504 +
  505 +
  506 +| Code | Type | Model | Message |
  507 +|-----|-----|-----|-----|
  508 +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | {"errcode":0,"result":"ok"} |
  509 +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} |
  510 +
  511 +
  512 +
492 513 <a name="scenicinfo-get"></a>
493 514  
494 515 #### /ScenicInfo (GET)
... ... @@ -503,7 +524,7 @@
503 524  
504 525 | Code | Type | Model | Message |
505 526 |-----|-----|-----|-----|
506   -| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Name名称;Describe介绍;OpenHours营业时间;Picture最上面图片;ShopAdPicture商城列表页图片;ItemScenicPicture项目场次照片;ActivityPicture活动照片;VideoList视频(VideoPicture=首桢图片);InvestigationUrl问券调查的url |
  527 +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Name名称;Describe介绍;OpenHours营业时间;Picture最上面图片;ShopAdPicture商城列表页图片;ItemScenicPicture项目场次照片;ActivityPicture活动照片;VideoList视频(VideoPicture=首桢图片);InvestigationUrl问券调查的url;RangeLocation景区范围(多个坐标点) |
507 528 | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} |
508 529  
509 530  
... ... @@ -691,7 +712,7 @@
691 712  
692 713 | Code | Type | Model | Message |
693 714 |-----|-----|-----|-----|
694   -| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Name名称;Describe介绍;OpenHours营业时间;Picture最上面图片;ShopAdPicture商城列表页图片;ItemScenicPicture项目场次照片;ActivityPicture活动照片;VideoList视频(VideoPicture=首桢图片);InvestigationUrl问券调查的url |
  715 +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Name名称;Describe介绍;OpenHours营业时间;Picture最上面图片;ShopAdPicture商城列表页图片;ItemScenicPicture项目场次照片;ActivityPicture活动照片;VideoList视频(VideoPicture=首桢图片);InvestigationUrl问券调查的url;RangeLocation景区范围(多个坐标点) |
695 716 | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} |
696 717  
697 718  
... ...