Commit 8bea60754bf2e534b709d6d702990895915b9c51
1 parent
8fa7cc70
Exists in
v1.2
and in
1 other branch
new
Showing
5 changed files
with
412 additions
and
1 deletions
Show diff stats
@@ -0,0 +1,273 @@ | @@ -0,0 +1,273 @@ | ||
1 | +package Api | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/aarongao/tools" | ||
5 | + "github.com/asaskevich/govalidator" | ||
6 | + "github.com/gin-gonic/gin" | ||
7 | + "go.mongodb.org/mongo-driver/bson" | ||
8 | + "go.mongodb.org/mongo-driver/bson/primitive" | ||
9 | + "letu/DB" | ||
10 | + "letu/Lib/Auth" | ||
11 | + "time" | ||
12 | +) | ||
13 | + | ||
14 | +// @Title 查询公告 | ||
15 | +// @Description 查询公告-单条 | ||
16 | +// @Accept json | ||
17 | +// @Produce json | ||
18 | +// @Param id 5dfb03070a9ac17ac7a82054 string true "id" | ||
19 | +// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":{"Id":"5e82d2539561231535f72958","Title":"公告2","Url":"http://www.google.cn","CreateTime":1585631827,"UpdateTime":0,"Expiry":1585670400,"ExpiryString":"今天"}}" | ||
20 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | ||
21 | +// @Router /Notice/Info? [get] | ||
22 | +func NoticeInfo(c *gin.Context) { | ||
23 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | ||
24 | + c.Header("Access-Control-Allow-Credentials", "true") | ||
25 | + | ||
26 | + var aNotice *DB.SNotice | ||
27 | + objId, _ := primitive.ObjectIDFromHex(c.Query("id")) | ||
28 | + DB.CNotice.FindOne(tools.GetContext(), bson.M{"_id": objId}).Decode(&aNotice) | ||
29 | + | ||
30 | + c.JSON(200, tools.ResponseSeccess{ | ||
31 | + 0, | ||
32 | + aNotice, | ||
33 | + }) | ||
34 | +} | ||
35 | + | ||
36 | +// @Title 查询公告 | ||
37 | +// @Description 查询公告-列表 | ||
38 | +// @Accept json | ||
39 | +// @Produce json | ||
40 | +// @Param ScenicId wgergejfwe string true "景区id" | ||
41 | +// @Param ExpiryState all string false "是否有效,默认只显示有效数据,==all所有数据" | ||
42 | +// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":[{"Id":"5e82c27f41914b0fdcac489f","Title":"公告","Url":"http://www.google.cn","CreateTime":1585627775,"UpdateTime":0,"Expiry":1585670400,"ExpiryString":"今天"}...]}" | ||
43 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | ||
44 | +// @Router /Notice/List? [get] | ||
45 | +func NoticeList(c *gin.Context) { | ||
46 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | ||
47 | + c.Header("Access-Control-Allow-Credentials", "true") | ||
48 | + | ||
49 | + var aNotice []*DB.SNotice | ||
50 | + | ||
51 | + var _select primitive.M | ||
52 | + if c.Query("ExpiryState") == "all"{ | ||
53 | + _select = bson.M{"ScenicId":c.Query("ScenicId")} | ||
54 | + }else{ | ||
55 | + _select = bson.M{"Expiry": bson.M{"$gte": time.Now().Unix()},"ScenicId":c.Query("ScenicId")} | ||
56 | + } | ||
57 | + | ||
58 | + | ||
59 | + cur, err := DB.CNotice.Find(tools.GetContext(), _select)// | ||
60 | + defer cur.Close(tools.GetContext()) | ||
61 | + if err == nil { | ||
62 | + for cur.Next(tools.GetContext()) { | ||
63 | + var e *DB.SNotice | ||
64 | + cur.Decode(&e) | ||
65 | + aNotice = append(aNotice, e) | ||
66 | + } | ||
67 | + } | ||
68 | + | ||
69 | + if aNotice == nil { | ||
70 | + aNotice = []*DB.SNotice{} | ||
71 | + } | ||
72 | + c.JSON(200, tools.ResponseSeccess{ | ||
73 | + 0, | ||
74 | + aNotice, | ||
75 | + }) | ||
76 | +} | ||
77 | + | ||
78 | +// @Title 创建公告 | ||
79 | +// @Description 创建公告 | ||
80 | +// @Accept json | ||
81 | +// @Produce json | ||
82 | +// @Param ScenicId wgergejfwe string true "景区id" | ||
83 | +// @Param Title 营业时间公告 string true "公告名称" | ||
84 | +// @Param Url http://abc.com string true "公告链接" | ||
85 | +// @Param ExpiryString http://abc.com string true "有效期(15分钟|1小时|今天|今年)" | ||
86 | +// @Param Token wgergejfwe string true "用户token" | ||
87 | +// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}" | ||
88 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | ||
89 | +// @Router /Notice/Create? [post] | ||
90 | +func CreateNotice(c *gin.Context) { | ||
91 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | ||
92 | + c.Header("Access-Control-Allow-Credentials", "true") | ||
93 | + | ||
94 | + _user, _ := c.Get("UserInfo") | ||
95 | + user := _user.(*DB.SMember) | ||
96 | + | ||
97 | + err := Auth.CheckScenicAuth(c.PostForm("ScenicId"), user) | ||
98 | + if err != nil { | ||
99 | + c.JSON(200, tools.ResponseError{ | ||
100 | + 401, | ||
101 | + "没有权限", | ||
102 | + }) | ||
103 | + return | ||
104 | + } | ||
105 | + | ||
106 | + var Expiry = getExp(c.PostForm("ExpiryString")) | ||
107 | + | ||
108 | + NowTime := time.Now() | ||
109 | + objectID := primitive.NewObjectID() | ||
110 | + Notice := &DB.SNotice{ | ||
111 | + &objectID, | ||
112 | + c.PostForm("ScenicId"), | ||
113 | + c.PostForm("Title"), | ||
114 | + c.PostForm("Url"), | ||
115 | + NowTime.Unix(), | ||
116 | + 0, | ||
117 | + Expiry, | ||
118 | + c.PostForm("ExpiryString"), | ||
119 | + } | ||
120 | + | ||
121 | + _, err = govalidator.ValidateStruct(Notice); | ||
122 | + if err != nil { | ||
123 | + c.JSON(200, tools.ResponseError{ | ||
124 | + 1, | ||
125 | + err.Error(), | ||
126 | + }) | ||
127 | + return | ||
128 | + } | ||
129 | + | ||
130 | + _, err = DB.CNotice.InsertOne(tools.GetContext(), Notice) | ||
131 | + if err != nil { | ||
132 | + c.JSON(200, tools.ResponseError{ | ||
133 | + 1, | ||
134 | + err.Error(), | ||
135 | + }) | ||
136 | + return | ||
137 | + } | ||
138 | + | ||
139 | + c.JSON(200, tools.ResponseSeccess{ | ||
140 | + 0, | ||
141 | + "ok", | ||
142 | + }) | ||
143 | +} | ||
144 | + | ||
145 | +// @Title 删除公告 | ||
146 | +// @Description 删除公告 | ||
147 | +// @Accept json | ||
148 | +// @Produce json | ||
149 | +// @Param id 5dfb03070a9ac17ac7a82054 string true "公告id" | ||
150 | +// @Param ScenicId 5dfb03070a9ac17ac7a82054 string true "景区id" | ||
151 | +// @Param Token wgergejfwe string true "用户token" | ||
152 | +// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}" | ||
153 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | ||
154 | +// @Router /Notice/Remove? [post] | ||
155 | +func RemoveNotice(c *gin.Context) { | ||
156 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | ||
157 | + c.Header("Access-Control-Allow-Credentials", "true") | ||
158 | + | ||
159 | + _user, _ := c.Get("UserInfo") | ||
160 | + user := _user.(*DB.SMember) | ||
161 | + | ||
162 | + err := Auth.CheckScenicAuth(c.PostForm("ScenicId"), user) | ||
163 | + if err != nil { | ||
164 | + c.JSON(200, tools.ResponseError{ | ||
165 | + 401, | ||
166 | + "没有权限", | ||
167 | + }) | ||
168 | + return | ||
169 | + } | ||
170 | + | ||
171 | + _, err = primitive.ObjectIDFromHex(c.PostForm("id")) | ||
172 | + if err != nil { | ||
173 | + c.JSON(200, tools.ResponseError{ | ||
174 | + 1, | ||
175 | + "id不正确", | ||
176 | + }) | ||
177 | + return | ||
178 | + } | ||
179 | + | ||
180 | + objID, _ := primitive.ObjectIDFromHex(c.PostForm("id")) | ||
181 | + DB.CNotice.DeleteOne(tools.GetContext(), bson.M{"_id": objID}) | ||
182 | + | ||
183 | + c.JSON(200, tools.ResponseSeccess{ | ||
184 | + 0, | ||
185 | + "ok", | ||
186 | + }) | ||
187 | + | ||
188 | +} | ||
189 | + | ||
190 | +// @Title 修改公告 | ||
191 | +// @Description 修改公告 | ||
192 | +// @Accept json | ||
193 | +// @Produce json | ||
194 | +// @Param id 5dfb03070a9ac17ac7a82054 string true "公告id" | ||
195 | +// @Param ScenicId wgergejfwe string true "景区id" | ||
196 | +// @Param Title 营业时间公告 string true "公告名称" | ||
197 | +// @Param Url http://abc.com string true "公告链接" | ||
198 | +// @Param ExpiryString http://abc.com string true "有效期(15分钟|1小时|今天|今年)" | ||
199 | +// @Param Token wgergejfwe string true "用户token" | ||
200 | +// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}" | ||
201 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | ||
202 | +// @Router /Notice/Modify? [post] | ||
203 | +func ModifyNotice(c *gin.Context) { | ||
204 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | ||
205 | + c.Header("Access-Control-Allow-Credentials", "true") | ||
206 | + | ||
207 | + _user, _ := c.Get("UserInfo") | ||
208 | + user := _user.(*DB.SMember) | ||
209 | + | ||
210 | + err := Auth.CheckScenicAuth(c.PostForm("ScenicId"), user) | ||
211 | + if err != nil { | ||
212 | + c.JSON(200, tools.ResponseError{ | ||
213 | + 401, | ||
214 | + "没有权限", | ||
215 | + }) | ||
216 | + return | ||
217 | + } | ||
218 | + | ||
219 | + var Expiry = getExp(c.PostForm("ExpiryString")) | ||
220 | + | ||
221 | + NowTime := time.Now() | ||
222 | + objectID, _ := primitive.ObjectIDFromHex(c.PostForm("id")) | ||
223 | + | ||
224 | + Notice := &DB.SNotice{ | ||
225 | + &objectID, | ||
226 | + c.PostForm("ScenicId"), | ||
227 | + c.PostForm("Title"), | ||
228 | + c.PostForm("Url"), | ||
229 | + 0, | ||
230 | + NowTime.Unix(), | ||
231 | + Expiry, | ||
232 | + c.PostForm("ExpiryString"), | ||
233 | + } | ||
234 | + _, err = govalidator.ValidateStruct(Notice); | ||
235 | + if err != nil { | ||
236 | + c.JSON(200, tools.ResponseError{ | ||
237 | + 1, | ||
238 | + err.Error(), | ||
239 | + }) | ||
240 | + return | ||
241 | + } | ||
242 | + | ||
243 | + _, err = DB.CNotice.UpdateOne(tools.GetContext(), | ||
244 | + bson.M{"_id": objectID}, | ||
245 | + bson.M{"$set": Notice}, | ||
246 | + ) | ||
247 | + | ||
248 | + c.JSON(200, tools.ResponseSeccess{ | ||
249 | + 0, | ||
250 | + "ok", | ||
251 | + }) | ||
252 | + | ||
253 | +} | ||
254 | + | ||
255 | +func getExp(ExpiryString string) int64 { | ||
256 | + | ||
257 | + var Expiry int64 | ||
258 | + NowTime := time.Now() | ||
259 | + if ExpiryString == "15分钟" { | ||
260 | + Expiry = NowTime.Add(time.Minute * 15).Unix() | ||
261 | + } | ||
262 | + if ExpiryString == "1小时" { | ||
263 | + Expiry = NowTime.Add(time.Minute * 60).Unix() | ||
264 | + } | ||
265 | + if ExpiryString == "今天" { | ||
266 | + md := NowTime.Add(time.Hour * 24) | ||
267 | + Expiry = time.Date(md.Year(), md.Month(), md.Day(), 0, 0, 0, 0, NowTime.Location()).Unix() | ||
268 | + } | ||
269 | + if ExpiryString == "今年" { | ||
270 | + Expiry = time.Date(NowTime.Year()+1, 1, 1, 0, 0, 0, 0, NowTime.Location()).Unix() | ||
271 | + } | ||
272 | + return Expiry | ||
273 | +} |
DB/db.go
@@ -22,6 +22,7 @@ var CTrajectory *mongo.Collection //移动轨迹 | @@ -22,6 +22,7 @@ var CTrajectory *mongo.Collection //移动轨迹 | ||
22 | var CIcons *mongo.Collection //图标信息 | 22 | var CIcons *mongo.Collection //图标信息 |
23 | var CTopMenus *mongo.Collection //菜单 | 23 | var CTopMenus *mongo.Collection //菜单 |
24 | var CDevice *mongo.Collection //设备清单 | 24 | var CDevice *mongo.Collection //设备清单 |
25 | +var CNotice *mongo.Collection //公告 | ||
25 | var DB *mongo.Database | 26 | var DB *mongo.Database |
26 | 27 | ||
27 | type SItem struct { | 28 | type SItem struct { |
@@ -51,6 +52,17 @@ type SModel struct { | @@ -51,6 +52,17 @@ type SModel struct { | ||
51 | Model string `bson:"Model" json:"Model"` | 52 | Model string `bson:"Model" json:"Model"` |
52 | Action string `bson:"Action" json:"Action"` | 53 | Action string `bson:"Action" json:"Action"` |
53 | } | 54 | } |
55 | + | ||
56 | +type SNotice struct { | ||
57 | + Id *primitive.ObjectID `bson:"_id" json:"Id" valid:"required"` | ||
58 | + ScenicId string `bson:"ScenicId" json:"ScenicId" valid:"required"` | ||
59 | + Title string `bson:"Title" json:"Title" valid:"required"` | ||
60 | + Url string `bson:"Url" json:"Url" valid:"required"` | ||
61 | + CreateTime int64 `bson:"CreateTime,omitempty" json:"CreateTime"` //创建时间 | ||
62 | + UpdateTime int64 `bson:"UpdateTime,omitempty" json:"UpdateTime"` //最后一次修改时间 | ||
63 | + Expiry int64 `bson:"Expiry" json:"Expiry"` //有效期 | ||
64 | + ExpiryString string `bson:"ExpiryString" json:"ExpiryString" valid:"required,in(15分钟|1小时|今天|今年)"` //有效期 | ||
65 | +} | ||
54 | type SIcons struct { | 66 | type SIcons struct { |
55 | Id *primitive.ObjectID `bson:"_id" json:"Id" valid:"required"` | 67 | Id *primitive.ObjectID `bson:"_id" json:"Id" valid:"required"` |
56 | ScenicId string `bson:"ScenicId" json:"ScenicId"` | 68 | ScenicId string `bson:"ScenicId" json:"ScenicId"` |
@@ -149,7 +161,7 @@ type SInvestigation struct { | @@ -149,7 +161,7 @@ type SInvestigation struct { | ||
149 | } | 161 | } |
150 | type SMember struct { | 162 | type SMember struct { |
151 | Id *primitive.ObjectID `bson:"_id" json:"Id" valid:"required"` | 163 | Id *primitive.ObjectID `bson:"_id" json:"Id" valid:"required"` |
152 | - UserType string `bson:"UserType" json:"UserType"` // "root" or "operator" or "visitor" | 164 | + UserType string `bson:"UserType" json:"UserType" valid:"required,in(root|operator|visitor)"` // "root" or "operator" or "visitor" |
153 | ScenicId string `bson:"ScenicId,omitempty" json:"ScenicId,omitempty"` | 165 | ScenicId string `bson:"ScenicId,omitempty" json:"ScenicId,omitempty"` |
154 | Username string `bson:"Username,omitempty" json:"Username,omitempty"` | 166 | Username string `bson:"Username,omitempty" json:"Username,omitempty"` |
155 | Password string `bson:"Password,omitempty" json:"Password,omitempty"` | 167 | Password string `bson:"Password,omitempty" json:"Password,omitempty"` |
README.md
@@ -33,6 +33,11 @@ | @@ -33,6 +33,11 @@ | ||
33 | 1. [查询线路信息](#lineinfo-get) | 33 | 1. [查询线路信息](#lineinfo-get) |
34 | 1. [操作员管理 - 操作员登录](#loginoperator-post) | 34 | 1. [操作员管理 - 操作员登录](#loginoperator-post) |
35 | 1. [用户管理 - 用户登录&注册](#loginuser-post) | 35 | 1. [用户管理 - 用户登录&注册](#loginuser-post) |
36 | +1. [查询公告-单条](#notice-info-get) | ||
37 | +1. [查询公告-列表](#notice-list-get) | ||
38 | +1. [创建公告](#notice-create-post) | ||
39 | +1. [删除公告](#notice-remove-post) | ||
40 | +1. [修改公告](#notice-modify-post) | ||
36 | 1. [用户管理 - 注册客户端](#registerdevice-post) | 41 | 1. [用户管理 - 注册客户端](#registerdevice-post) |
37 | 1. [用户管理 - 删除用户(注销)](#removeuser-post) | 42 | 1. [用户管理 - 删除用户(注销)](#removeuser-post) |
38 | 1. [返回景区基础信息](#scenicinfo-get) | 43 | 1. [返回景区基础信息](#scenicinfo-get) |
@@ -545,6 +550,109 @@ | @@ -545,6 +550,109 @@ | ||
545 | 550 | ||
546 | 551 | ||
547 | 552 | ||
553 | +<a name="notice-info-get"></a> | ||
554 | + | ||
555 | +#### /Notice/Info (GET) | ||
556 | + | ||
557 | + | ||
558 | +查询公告-单条 | ||
559 | + | ||
560 | +| Param Name | Example | Data Type | Description | Required? | | ||
561 | +|-----|-----|-----|-----|-----| | ||
562 | +| id | 5dfb03070a9ac17ac7a82054 | string | id | Yes | | ||
563 | + | ||
564 | + | ||
565 | +| Code | Type | Model | Message | | ||
566 | +|-----|-----|-----|-----| | ||
567 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | {"errcode":0,"result":{"Id":"5e82d2539561231535f72958","Title":"公告2","Url":"http://www.google.cn","CreateTime":1585631827,"UpdateTime":0,"Expiry":1585670400,"ExpiryString":"今天"}} | | ||
568 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | ||
569 | + | ||
570 | + | ||
571 | +<a name="notice-list-get"></a> | ||
572 | + | ||
573 | +#### /Notice/List (GET) | ||
574 | + | ||
575 | + | ||
576 | +查询公告-列表 | ||
577 | + | ||
578 | +| Param Name | Example | Data Type | Description | Required? | | ||
579 | +|-----|-----|-----|-----|-----| | ||
580 | +| ScenicId | wgergejfwe | string | 景区id | Yes | | ||
581 | +| ExpiryState | all | string | 是否有效,默认只显示有效数据,==all所有数据 | | | ||
582 | + | ||
583 | + | ||
584 | +| Code | Type | Model | Message | | ||
585 | +|-----|-----|-----|-----| | ||
586 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | {"errcode":0,"result":[{"Id":"5e82c27f41914b0fdcac489f","Title":"公告","Url":"http://www.google.cn","CreateTime":1585627775,"UpdateTime":0,"Expiry":1585670400,"ExpiryString":"今天"}...]} | | ||
587 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | ||
588 | + | ||
589 | + | ||
590 | +<a name="notice-create-post"></a> | ||
591 | + | ||
592 | +#### /Notice/Create (POST) | ||
593 | + | ||
594 | + | ||
595 | +创建公告 | ||
596 | + | ||
597 | +| Param Name | Example | Data Type | Description | Required? | | ||
598 | +|-----|-----|-----|-----|-----| | ||
599 | +| ScenicId | wgergejfwe | string | 景区id | Yes | | ||
600 | +| Title | 营业时间公告 | string | 公告名称 | Yes | | ||
601 | +| Url | http://abc.com | string | 公告链接 | Yes | | ||
602 | +| ExpiryString | http://abc.com | string | 有效期(15分钟|1小时|今天|今年) | Yes | | ||
603 | +| Token | wgergejfwe | string | 用户token | Yes | | ||
604 | + | ||
605 | + | ||
606 | +| Code | Type | Model | Message | | ||
607 | +|-----|-----|-----|-----| | ||
608 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | {"errcode":0,"result":"ok"} | | ||
609 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | ||
610 | + | ||
611 | + | ||
612 | +<a name="notice-remove-post"></a> | ||
613 | + | ||
614 | +#### /Notice/Remove (POST) | ||
615 | + | ||
616 | + | ||
617 | +删除公告 | ||
618 | + | ||
619 | +| Param Name | Example | Data Type | Description | Required? | | ||
620 | +|-----|-----|-----|-----|-----| | ||
621 | +| id | 5dfb03070a9ac17ac7a82054 | string | 公告id | Yes | | ||
622 | +| ScenicId | 5dfb03070a9ac17ac7a82054 | string | 景区id | Yes | | ||
623 | +| Token | wgergejfwe | string | 用户token | Yes | | ||
624 | + | ||
625 | + | ||
626 | +| Code | Type | Model | Message | | ||
627 | +|-----|-----|-----|-----| | ||
628 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | {"errcode":0,"result":"ok"} | | ||
629 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | ||
630 | + | ||
631 | + | ||
632 | +<a name="notice-modify-post"></a> | ||
633 | + | ||
634 | +#### /Notice/Modify (POST) | ||
635 | + | ||
636 | + | ||
637 | +修改公告 | ||
638 | + | ||
639 | +| Param Name | Example | Data Type | Description | Required? | | ||
640 | +|-----|-----|-----|-----|-----| | ||
641 | +| id | 5dfb03070a9ac17ac7a82054 | string | 公告id | Yes | | ||
642 | +| ScenicId | wgergejfwe | string | 景区id | Yes | | ||
643 | +| Title | 营业时间公告 | string | 公告名称 | Yes | | ||
644 | +| Url | http://abc.com | string | 公告链接 | Yes | | ||
645 | +| ExpiryString | http://abc.com | string | 有效期(15分钟|1小时|今天|今年) | Yes | | ||
646 | +| Token | wgergejfwe | string | 用户token | Yes | | ||
647 | + | ||
648 | + | ||
649 | +| Code | Type | Model | Message | | ||
650 | +|-----|-----|-----|-----| | ||
651 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | {"errcode":0,"result":"ok"} | | ||
652 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | ||
653 | + | ||
654 | + | ||
655 | + | ||
548 | <a name="registerdevice-post"></a> | 656 | <a name="registerdevice-post"></a> |
549 | 657 | ||
550 | #### /RegisterDevice (POST) | 658 | #### /RegisterDevice (POST) |
Version.md
@@ -20,6 +20,18 @@ | @@ -20,6 +20,18 @@ | ||
20 | } | 20 | } |
21 | ``` | 21 | ``` |
22 | 22 | ||
23 | +3. 新增加公告管理模块接口 | ||
24 | + | ||
25 | + ``` | ||
26 | + /Notice/Info | ||
27 | + /Notice/List | ||
28 | + /Notice/Create(需要携带Token) | ||
29 | + /Notice/Remove(需要携带Token) | ||
30 | + /Notice/Modify(需要携带Token) | ||
31 | + ``` | ||
32 | + | ||
33 | + | ||
34 | + | ||
23 | ##### 发布流程: | 35 | ##### 发布流程: |
24 | 36 | ||
25 | 1. 提交APP代码到git(v1.1分支) | 37 | 1. 提交APP代码到git(v1.1分支) |
main.go
@@ -94,6 +94,7 @@ func main() { | @@ -94,6 +94,7 @@ func main() { | ||
94 | DB.CIcons = DB.DB.Collection("Icons") | 94 | DB.CIcons = DB.DB.Collection("Icons") |
95 | DB.CTopMenus = DB.DB.Collection("TopMenus") | 95 | DB.CTopMenus = DB.DB.Collection("TopMenus") |
96 | DB.CDevice = DB.DB.Collection("Device") | 96 | DB.CDevice = DB.DB.Collection("Device") |
97 | + DB.CNotice = DB.DB.Collection("Notice") | ||
97 | DelayMessage.CDelayMessage = DB.DB.Collection("DelayMessage") | 98 | DelayMessage.CDelayMessage = DB.DB.Collection("DelayMessage") |
98 | DelayMessage.CDelayErrorLog = DB.DB.Collection("DelayErrorLog") | 99 | DelayMessage.CDelayErrorLog = DB.DB.Collection("DelayErrorLog") |
99 | 100 | ||
@@ -145,6 +146,11 @@ func main() { | @@ -145,6 +146,11 @@ func main() { | ||
145 | InitController("POST", "/DealyMessage/Create", Api.CreateDealyMessage, &DB.SModel{"通知管理", "增加"}) | 146 | InitController("POST", "/DealyMessage/Create", Api.CreateDealyMessage, &DB.SModel{"通知管理", "增加"}) |
146 | InitController("GET", "/DealyMessage/Info", Api.DealyMessageInfo, &DB.SModel{"通知管理", "查看所有"}) | 147 | InitController("GET", "/DealyMessage/Info", Api.DealyMessageInfo, &DB.SModel{"通知管理", "查看所有"}) |
147 | InitController("POST", "/DealyMessage/Remove", Api.RemoveDealyMessage, &DB.SModel{"通知管理", "删除"}) | 148 | InitController("POST", "/DealyMessage/Remove", Api.RemoveDealyMessage, &DB.SModel{"通知管理", "删除"}) |
149 | + InitController("POST", "/Notice/Create", Api.CreateNotice, &DB.SModel{"公告管理", "增加"}) | ||
150 | + InitController("GET", "/Notice/Info", Api.NoticeInfo, &DB.SModel{}) | ||
151 | + InitController("GET", "/Notice/List", Api.NoticeList, &DB.SModel{}) | ||
152 | + InitController("POST", "/Notice/Remove", Api.RemoveNotice, &DB.SModel{"公告管理", "删除"}) | ||
153 | + InitController("POST", "/Notice/Modify", Api.ModifyNotice, &DB.SModel{"公告管理", "修改"}) | ||
148 | InitController("POST", "/Icon/Update", Api.UpdateIcon, &DB.SModel{"图标管理", "修改管理"}) | 154 | InitController("POST", "/Icon/Update", Api.UpdateIcon, &DB.SModel{"图标管理", "修改管理"}) |
149 | InitController("GET", "/Icon/All", Api.AllIcons, &DB.SModel{}) | 155 | InitController("GET", "/Icon/All", Api.AllIcons, &DB.SModel{}) |
150 | InitController("GET", "/Icon/Info", Api.IconInfo, &DB.SModel{}) | 156 | InitController("GET", "/Icon/Info", Api.IconInfo, &DB.SModel{}) |