Commit 58ec1105806da5abe8c2e7821e20c6457df8e401
1 parent
8bea6075
Exists in
v1.2
and in
1 other branch
new
Showing
13 changed files
with
124 additions
and
65 deletions
Show diff stats
API/Complaint.go
| ... | ... | @@ -88,6 +88,7 @@ func CreateComplaint(c *gin.Context) { |
| 88 | 88 | // @Description 投诉 - 查询所有投诉 |
| 89 | 89 | // @Accept json |
| 90 | 90 | // @Produce json |
| 91 | +// @Param ScenicId 5e1ed07524e03431008b4572 string true "景区id" | |
| 91 | 92 | // @Param Page 1 int true "当前第几页" |
| 92 | 93 | // @Success 200 {object} tools.ResponseSeccess "" |
| 93 | 94 | // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" |
| ... | ... | @@ -109,7 +110,7 @@ func AllComplaint(c *gin.Context) { |
| 109 | 110 | |
| 110 | 111 | var aComplaint = []bson.M{} |
| 111 | 112 | |
| 112 | - cur, err := DB.CComplaint.Find(tools.GetContext(), bson.M{}, &options.FindOptions{Limit: &limit, Skip: &skip, Sort: bson.M{"_id": -1}}) | |
| 113 | + cur, err := DB.CComplaint.Find(tools.GetContext(), bson.M{"ScenicId":c.Query("ScenicId")}, &options.FindOptions{Limit: &limit, Skip: &skip, Sort: bson.M{"_id": -1}}) | |
| 113 | 114 | defer cur.Close(tools.GetContext()) |
| 114 | 115 | if err == nil { |
| 115 | 116 | for cur.Next(tools.GetContext()) { | ... | ... |
API/Icon.go
| ... | ... | @@ -104,13 +104,8 @@ func AllIcons(c *gin.Context) { |
| 104 | 104 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
| 105 | 105 | c.Header("Access-Control-Allow-Credentials", "true") |
| 106 | 106 | |
| 107 | - var ScenicId string | |
| 108 | - if ScenicId = c.Query("ScenicId"); ScenicId == "" { | |
| 109 | - ScenicId = "5e0d504e24e03431008b4567" // 乐岛 | |
| 110 | - } | |
| 111 | - | |
| 112 | 107 | var SIcons = []DB.SIcons{} |
| 113 | - cur, err := DB.CIcons.Find(tools.GetContext(), bson.M{"ScenicId": ScenicId}) | |
| 108 | + cur, err := DB.CIcons.Find(tools.GetContext(), bson.M{"ScenicId": c.Query("ScenicId")}) | |
| 114 | 109 | defer cur.Close(tools.GetContext()) |
| 115 | 110 | if err == nil { |
| 116 | 111 | for cur.Next(tools.GetContext()) { | ... | ... |
API/Item.go
| ... | ... | @@ -56,13 +56,8 @@ func AllItems(c *gin.Context) { |
| 56 | 56 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
| 57 | 57 | c.Header("Access-Control-Allow-Credentials", "true") |
| 58 | 58 | |
| 59 | - var ScenicId string | |
| 60 | - if ScenicId = c.Query("ScenicId");ScenicId == ""{ | |
| 61 | - ScenicId = "5e0d504e24e03431008b4567" // 乐岛 | |
| 62 | - } | |
| 63 | - | |
| 64 | 59 | var aItems = []DB.SItem{} |
| 65 | - cur, err := DB.CItem.Find(tools.GetContext(), bson.M{"ScenicId": ScenicId}) | |
| 60 | + cur, err := DB.CItem.Find(tools.GetContext(), bson.M{"ScenicId": c.Query("ScenicId")}) | |
| 66 | 61 | defer cur.Close(tools.GetContext()) |
| 67 | 62 | if err == nil { |
| 68 | 63 | for cur.Next(tools.GetContext()) { |
| ... | ... | @@ -225,12 +220,7 @@ func AllItemTime(c *gin.Context) { |
| 225 | 220 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
| 226 | 221 | c.Header("Access-Control-Allow-Credentials", "true") |
| 227 | 222 | |
| 228 | - var ScenicId string | |
| 229 | - if ScenicId = c.Query("ScenicId");ScenicId == ""{ | |
| 230 | - ScenicId = "5e0d504e24e03431008b4567" // 乐岛 | |
| 231 | - } | |
| 232 | - | |
| 233 | - allteim := DB.Redis.Get("AllItemTime_" + ScenicId) | |
| 223 | + allteim := DB.Redis.Get("AllItemTime_" + c.Query("ScenicId")) | |
| 234 | 224 | if allteim != nil { |
| 235 | 225 | c.JSON(200, allteim) |
| 236 | 226 | } else { | ... | ... |
API/Line.go
| ... | ... | @@ -53,13 +53,8 @@ func AllLine(c *gin.Context) { |
| 53 | 53 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
| 54 | 54 | c.Header("Access-Control-Allow-Credentials", "true") |
| 55 | 55 | |
| 56 | - var ScenicId string | |
| 57 | - if ScenicId = c.Query("ScenicId");ScenicId == ""{ | |
| 58 | - ScenicId = "5e0d504e24e03431008b4567" // 乐岛 | |
| 59 | - } | |
| 60 | - | |
| 61 | 56 | var aLine []DB.SLine |
| 62 | - cur, err := DB.CLine.Find(tools.GetContext(), bson.M{"ScenicId": ScenicId}) | |
| 57 | + cur, err := DB.CLine.Find(tools.GetContext(), bson.M{"ScenicId": c.Query("ScenicId")}) | |
| 63 | 58 | defer cur.Close(tools.GetContext()) |
| 64 | 59 | if err == nil { |
| 65 | 60 | for cur.Next(tools.GetContext()) { | ... | ... |
API/Shop.go
| ... | ... | @@ -54,13 +54,8 @@ func AllCommodity(c *gin.Context) { |
| 54 | 54 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
| 55 | 55 | c.Header("Access-Control-Allow-Credentials", "true") |
| 56 | 56 | |
| 57 | - var ScenicId string | |
| 58 | - if ScenicId = c.Query("ScenicId");ScenicId == ""{ | |
| 59 | - ScenicId = "5e0d504e24e03431008b4567" // 乐岛 | |
| 60 | - } | |
| 61 | - | |
| 62 | 57 | var aCommoditys []DB.SCommodity |
| 63 | - cur, err := DB.CCommodity.Find(tools.GetContext(), bson.M{"ScenicId": ScenicId}) | |
| 58 | + cur, err := DB.CCommodity.Find(tools.GetContext(), bson.M{"ScenicId": c.Query("ScenicId")}) | |
| 64 | 59 | defer cur.Close(tools.GetContext()) |
| 65 | 60 | if err == nil { |
| 66 | 61 | for cur.Next(tools.GetContext()) { | ... | ... |
API/SystemInfo.go
| ... | ... | @@ -20,7 +20,7 @@ func SystemInfo(c *gin.Context) { |
| 20 | 20 | |
| 21 | 21 | info := make(map[string]interface{}) |
| 22 | 22 | info["Version"] = Config.Info.Version |
| 23 | - | |
| 23 | + info["SupportVersion"] = Config.Info.SupportVersion | |
| 24 | 24 | |
| 25 | 25 | UpdateLocationInterval := DB.Redis.Get("UpdateLocationInterval") |
| 26 | 26 | info["UpdateLocationInterval"] = UpdateLocationInterval | ... | ... |
API/TopMenus.go
| ... | ... | @@ -24,19 +24,8 @@ func AllTopMenus(c *gin.Context) { |
| 24 | 24 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
| 25 | 25 | c.Header("Access-Control-Allow-Credentials", "true") |
| 26 | 26 | |
| 27 | - _user, _ := c.Get("UserInfo") | |
| 28 | - user := _user.(*DB.SMember) | |
| 29 | - err := Auth.CheckScenicAuth(c.PostForm("ScenicId"), user) | |
| 30 | - if err != nil { | |
| 31 | - c.JSON(200, tools.ResponseError{ | |
| 32 | - 401, | |
| 33 | - "没有权限", | |
| 34 | - }) | |
| 35 | - return | |
| 36 | - } | |
| 37 | - | |
| 38 | 27 | var STopMenus []DB.STopMenus |
| 39 | - cur, err := DB.CTopMenus.Find(tools.GetContext(), bson.M{"ScenicId": c.PostForm("ScenicId")}) | |
| 28 | + cur, err := DB.CTopMenus.Find(tools.GetContext(), bson.M{"ScenicId": c.Query("ScenicId")}) | |
| 40 | 29 | defer cur.Close(tools.GetContext()) |
| 41 | 30 | if err == nil { |
| 42 | 31 | for cur.Next(tools.GetContext()) { |
| ... | ... | @@ -105,7 +94,7 @@ func UpdateTopMenus(c *gin.Context) { |
| 105 | 94 | bson.M{"_id": id}, |
| 106 | 95 | bson.M{"$set": bson.M{ |
| 107 | 96 | "ScenicId": c.PostForm("ScenicId"), |
| 108 | - "Title": c.PostForm("Title"), | |
| 97 | + "Name": c.PostForm("Name"), | |
| 109 | 98 | "Tags": Tags, |
| 110 | 99 | }}, &options.FindOneAndUpdateOptions{ |
| 111 | 100 | Upsert: &upsert, |
| ... | ... | @@ -118,3 +107,48 @@ func UpdateTopMenus(c *gin.Context) { |
| 118 | 107 | }) |
| 119 | 108 | |
| 120 | 109 | } |
| 110 | + | |
| 111 | +// @Title 删除菜单 | |
| 112 | +// @Description 删除菜单 | |
| 113 | +// @Accept json | |
| 114 | +// @Produce json | |
| 115 | +// @Param id 5dfb03070a9ac17ac7a82054 string true "公告id" | |
| 116 | +// @Param ScenicId 5dfb03070a9ac17ac7a82054 string true "景区id" | |
| 117 | +// @Param Token wgergejfwe string true "用户token" | |
| 118 | +// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}" | |
| 119 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | |
| 120 | +// @Router /TopMenus/Remove? [post] | |
| 121 | +func RemoveTopMenus(c *gin.Context) { | |
| 122 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | |
| 123 | + c.Header("Access-Control-Allow-Credentials", "true") | |
| 124 | + | |
| 125 | + _user, _ := c.Get("UserInfo") | |
| 126 | + user := _user.(*DB.SMember) | |
| 127 | + | |
| 128 | + err := Auth.CheckScenicAuth(c.PostForm("ScenicId"), user) | |
| 129 | + if err != nil { | |
| 130 | + c.JSON(200, tools.ResponseError{ | |
| 131 | + 401, | |
| 132 | + "没有权限", | |
| 133 | + }) | |
| 134 | + return | |
| 135 | + } | |
| 136 | + | |
| 137 | + _, err = primitive.ObjectIDFromHex(c.PostForm("id")) | |
| 138 | + if err != nil { | |
| 139 | + c.JSON(200, tools.ResponseError{ | |
| 140 | + 1, | |
| 141 | + "id不正确", | |
| 142 | + }) | |
| 143 | + return | |
| 144 | + } | |
| 145 | + | |
| 146 | + objID, _ := primitive.ObjectIDFromHex(c.PostForm("id")) | |
| 147 | + DB.CTopMenus.DeleteOne(tools.GetContext(), bson.M{"_id": objID}) | |
| 148 | + | |
| 149 | + c.JSON(200, tools.ResponseSeccess{ | |
| 150 | + 0, | |
| 151 | + "ok", | |
| 152 | + }) | |
| 153 | + | |
| 154 | +} | |
| 121 | 155 | \ No newline at end of file | ... | ... |
Config/config.go
| 1 | 1 | package Config |
| 2 | 2 | |
| 3 | 3 | type Config struct { |
| 4 | - TagType []string | |
| 5 | - DbPath string | |
| 6 | - DbName string | |
| 7 | - DbUser string | |
| 8 | - DbPassword string | |
| 9 | - RedisPath string | |
| 10 | - Env string | |
| 11 | - TokenSecret string | |
| 12 | - ServerPort string | |
| 13 | - Version string | |
| 4 | + TagType []string | |
| 5 | + DbPath string | |
| 6 | + DbName string | |
| 7 | + DbUser string | |
| 8 | + DbPassword string | |
| 9 | + RedisPath string | |
| 10 | + Env string | |
| 11 | + TokenSecret string | |
| 12 | + ServerPort string | |
| 13 | + Version int64 | |
| 14 | + SupportVersion int64 | |
| 14 | 15 | } |
| 15 | 16 | |
| 16 | 17 | var Info = Config{} | ... | ... |
Config/config.json
DB/db.go
| ... | ... | @@ -20,9 +20,9 @@ var CUserLog *mongo.Collection //用户行为记录 |
| 20 | 20 | var CSystemLog *mongo.Collection //操作记录 |
| 21 | 21 | var CTrajectory *mongo.Collection //移动轨迹 |
| 22 | 22 | var CIcons *mongo.Collection //图标信息 |
| 23 | -var CTopMenus *mongo.Collection //菜单 | |
| 24 | 23 | var CDevice *mongo.Collection //设备清单 |
| 25 | 24 | var CNotice *mongo.Collection //公告 |
| 25 | +var CTopMenus *mongo.Collection //菜单 | |
| 26 | 26 | var DB *mongo.Database |
| 27 | 27 | |
| 28 | 28 | type SItem struct { |
| ... | ... | @@ -80,9 +80,9 @@ type SLocation struct { |
| 80 | 80 | } |
| 81 | 81 | type STopMenus struct { |
| 82 | 82 | Id *primitive.ObjectID `bson:"_id" json:"Id" valid:"required"` |
| 83 | - ScenicId string `bson:"ScenicId" json:"ScenicId"` | |
| 84 | - Title string `bson:"Title" json:"Title"` //菜单标题 | |
| 85 | - Tags []string `bson:"Tags" json:"Tags"` //标签 | |
| 83 | + ScenicId string `bson:"ScenicId" json:"ScenicId" valid:"required"` | |
| 84 | + Name string `bson:"Name" json:"Name" valid:"required"` //菜单标题 | |
| 85 | + Tags []string `bson:"Tags" json:"Tags" valid:"required"` //标签 | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | type SDevice struct { | ... | ... |
README.md
| ... | ... | @@ -47,6 +47,7 @@ |
| 47 | 47 | 1. [标签 - 删除标签](#tag-remove-post) |
| 48 | 48 | 1. [菜单管理 - 查询所有菜单](#topmenus-all-get) |
| 49 | 49 | 1. [菜单管理 - 更新菜单](#topmenus-update-post) |
| 50 | +1. [删除菜单](#topmenus-remove-post) | |
| 50 | 51 | 1. [保存用户移动轨迹(5分钟提交一次)](#trajectory-save-post) |
| 51 | 52 | 1. [更新商品](#updatecommodity-post) |
| 52 | 53 | 1. [设备管理 - 更新设施](#updateitem-post) |
| ... | ... | @@ -89,6 +90,7 @@ |
| 89 | 90 | |
| 90 | 91 | | Param Name | Example | Data Type | Description | Required? | |
| 91 | 92 | |-----|-----|-----|-----|-----| |
| 93 | +| ScenicId | 5e1ed07524e03431008b4572 | string | 景区id | Yes | | |
| 92 | 94 | | Page | 1 | int | 当前第几页 | Yes | |
| 93 | 95 | |
| 94 | 96 | |
| ... | ... | @@ -832,6 +834,26 @@ |
| 832 | 834 | | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | |
| 833 | 835 | |
| 834 | 836 | |
| 837 | +<a name="topmenus-remove-post"></a> | |
| 838 | + | |
| 839 | +#### /TopMenus/Remove (POST) | |
| 840 | + | |
| 841 | + | |
| 842 | +删除菜单 | |
| 843 | + | |
| 844 | +| Param Name | Example | Data Type | Description | Required? | | |
| 845 | +|-----|-----|-----|-----|-----| | |
| 846 | +| id | 5dfb03070a9ac17ac7a82054 | string | 公告id | Yes | | |
| 847 | +| ScenicId | 5dfb03070a9ac17ac7a82054 | string | 景区id | Yes | | |
| 848 | +| Token | wgergejfwe | string | 用户token | Yes | | |
| 849 | + | |
| 850 | + | |
| 851 | +| Code | Type | Model | Message | | |
| 852 | +|-----|-----|-----|-----| | |
| 853 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | {"errcode":0,"result":"ok"} | | |
| 854 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | |
| 855 | + | |
| 856 | + | |
| 835 | 857 | |
| 836 | 858 | <a name="trajectory-save-post"></a> |
| 837 | 859 | ... | ... |
Version.md
| ... | ... | @@ -8,19 +8,22 @@ |
| 8 | 8 | |
| 9 | 9 | 1. /UserInfo接口增加权限验证(需要携带Token),游客只能查询自己信息,操作员可查询所有。 |
| 10 | 10 | |
| 11 | -2. /SystemInfo 新增系统信息接口 | |
| 11 | +2. /AllComplaint接口增加ScenicId景区id参数 | |
| 12 | + | |
| 13 | +3. /SystemInfo 新增系统信息接口 | |
| 12 | 14 | |
| 13 | 15 | ``` |
| 14 | 16 | { |
| 15 | 17 | "errcode": 0, |
| 16 | 18 | "result": { |
| 17 | 19 | "UpdateLocationInterval": 30,//上报位置时间间隔(秒) |
| 18 | - "Version": "v1.1"//最新版本号 | |
| 20 | + "Version": 1.1//最新版本号 | |
| 21 | + "SupportVersion": 1.1//支持的最旧版本号 | |
| 19 | 22 | } |
| 20 | 23 | } |
| 21 | 24 | ``` |
| 22 | 25 | |
| 23 | -3. 新增加公告管理模块接口 | |
| 26 | +4. 新增加公告管理模块接口 | |
| 24 | 27 | |
| 25 | 28 | ``` |
| 26 | 29 | /Notice/Info |
| ... | ... | @@ -30,8 +33,22 @@ |
| 30 | 33 | /Notice/Modify(需要携带Token) |
| 31 | 34 | ``` |
| 32 | 35 | |
| 36 | +5. 新增加顶部菜单相关接口 | |
| 37 | + | |
| 38 | + ``` | |
| 39 | + /TopMenus/All 获取所有菜单,以及关联标签 | |
| 40 | + /TopMenus/Update(需要携带Token) | |
| 41 | + /TopMenus/Remove(需要携带Token) | |
| 42 | + ``` | |
| 43 | + | |
| 33 | 44 | |
| 34 | 45 | |
| 46 | +6. 删除【游玩项目】标签。增加【游乐设施】【演出】【餐饮】【购物】【普通】 | |
| 47 | + | |
| 48 | +7. 删除【location】标签组 | |
| 49 | + | |
| 50 | +8. | |
| 51 | + | |
| 35 | 52 | ##### 发布流程: |
| 36 | 53 | |
| 37 | 54 | 1. 提交APP代码到git(v1.1分支) |
| ... | ... | @@ -40,3 +57,8 @@ |
| 40 | 57 | 4. 使用 “生产环境地址” 打包公测版本至TestFlight |
| 41 | 58 | 5. 发布至商店 |
| 42 | 59 | |
| 60 | + | |
| 61 | + | |
| 62 | +##### 销毁说明 | |
| 63 | + | |
| 64 | +1. | |
| 43 | 65 | \ No newline at end of file | ... | ... |
main.go
| ... | ... | @@ -92,9 +92,9 @@ func main() { |
| 92 | 92 | DB.CInvestigation = DB.DB.Collection("Investigation") |
| 93 | 93 | DB.CTrajectory = DB.DB.Collection("Trajectory") |
| 94 | 94 | DB.CIcons = DB.DB.Collection("Icons") |
| 95 | - DB.CTopMenus = DB.DB.Collection("TopMenus") | |
| 96 | 95 | DB.CDevice = DB.DB.Collection("Device") |
| 97 | 96 | DB.CNotice = DB.DB.Collection("Notice") |
| 97 | + DB.CTopMenus = DB.DB.Collection("TopMenu") | |
| 98 | 98 | DelayMessage.CDelayMessage = DB.DB.Collection("DelayMessage") |
| 99 | 99 | DelayMessage.CDelayErrorLog = DB.DB.Collection("DelayErrorLog") |
| 100 | 100 | |
| ... | ... | @@ -156,7 +156,8 @@ func main() { |
| 156 | 156 | InitController("GET", "/Icon/Info", Api.IconInfo, &DB.SModel{}) |
| 157 | 157 | InitController("POST", "/CheckToken", Api.CheckToken, &DB.SModel{}) |
| 158 | 158 | //InitController("/Tiles", Api.Tiles) |
| 159 | - InitController("POST", "/TopMenus/Update", Api.UpdateTopMenus, &DB.SModel{}) | |
| 159 | + InitController("POST", "/TopMenus/Update", Api.UpdateTopMenus, &DB.SModel{"菜单管理","修改"}) | |
| 160 | + InitController("POST", "/TopMenus/Remove", Api.RemoveTopMenus, &DB.SModel{"菜单管理","删除"}) | |
| 160 | 161 | InitController("GET", "/TopMenus/All", Api.AllTopMenus, &DB.SModel{}) |
| 161 | 162 | InitController("GET", "/RegisterDevice", Api.RegisterDevice, &DB.SModel{}) |
| 162 | 163 | InitController("POST", "/RemoveUser", Api.RemoveUser, &DB.SModel{"用户管理", "删除"}) |
| ... | ... | @@ -165,6 +166,8 @@ func main() { |
| 165 | 166 | InitController("POST", "/UpdateOperator", Api.UpdateOperator, &DB.SModel{"操作员管理", "增加和修改"}) |
| 166 | 167 | InitController("GET", "/AllOperator", Api.AllOperator, &DB.SModel{"操作员管理", "查看所有"}) |
| 167 | 168 | InitController("GET", "/SystemInfo", Api.SystemInfo, &DB.SModel{}) |
| 169 | + | |
| 170 | + | |
| 168 | 171 | Gin.GET("/AllModules", Auth.Modules) |
| 169 | 172 | //InitController("/ws", Api.WsPage) |
| 170 | 173 | ... | ... |