作者 唐旭辉

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/oppmg into dev

# Conflicts:
#	接口模型.md
@@ -19,10 +19,10 @@ type Bulletin struct { @@ -19,10 +19,10 @@ type Bulletin struct {
19 QuestionSwitch int8 `orm:"column(question_switch);null" description:"设置问题开关 (是否有问题)"` 19 QuestionSwitch int8 `orm:"column(question_switch);null" description:"设置问题开关 (是否有问题)"`
20 CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"` 20 CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
21 UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"更新时间"` 21 UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"更新时间"`
22 - AllowClose int8 `orm:"column(allow_close);null" description:"允许关闭公告(0允许,1禁止)"`  
23 - AllowCondition int8 `orm:"column(allow_condition);null" description:"关闭条件 (1(bit 0):公告内容查看完 2(bit 1):回答完问题)"`  
24 - CompanyId int64 `orm:"column(company_id);null" description:"公司Id"`  
25 - Status uint8 `orm:"column(status)" description:"状态 1-下架 2-上架"` 22 + AllowClose int8 `orm:"column(allow_close);null" description:"允许关闭公告(0允许关闭窗口,1阅读完才能关闭,2选项打勾后才能关闭)"`
  23 + //AllowCondition int8 `orm:"column(allow_condition);null" description:"关闭条件 (1(bit 0):公告内容查看完 2(bit 1):回答完问题)"`
  24 + CompanyId int64 `orm:"column(company_id);null" description:"公司Id"`
  25 + Status uint8 `orm:"column(status)" description:"状态 1-下架 2-上架"`
26 } 26 }
27 27
28 func (t *Bulletin) TableName() string { 28 func (t *Bulletin) TableName() string {
@@ -12,12 +12,12 @@ const ( @@ -12,12 +12,12 @@ const (
12 12
13 /*BulletinRelease */ 13 /*BulletinRelease */
14 type BulletinReleaseRequest struct { 14 type BulletinReleaseRequest struct {
15 - Id int `json:"id"`  
16 - Type int `json:"type" valid:"Required"`  
17 - Title string `json:"title" valid:"Required"`  
18 - Content string `json:"content" valid:"Required"`  
19 - AllowClose int `json:"allow_close"`  
20 - AllowCondition int `json:"allow_condition"` 15 + Id int `json:"id"`
  16 + Type int `json:"type" valid:"Required"`
  17 + Title string `json:"title" valid:"Required"`
  18 + Content string `json:"content" valid:"Required"`
  19 + AllowClose int `json:"allow_close"`
  20 + //AllowCondition int `json:"allow_condition"`
21 QuestionSwitch int `json:"question_switch"` 21 QuestionSwitch int `json:"question_switch"`
22 Receiver []string `json:"receiver" valid:"Required"` 22 Receiver []string `json:"receiver" valid:"Required"`
23 Question Question `json:"question"` 23 Question Question `json:"question"`
@@ -65,12 +65,12 @@ type BulletinItem struct { @@ -65,12 +65,12 @@ type BulletinItem struct {
65 type GetBulletinRequest struct { 65 type GetBulletinRequest struct {
66 } 66 }
67 type GetBulletinResponse struct { 67 type GetBulletinResponse struct {
68 - Id int `json:"id"`  
69 - Type int `json:"type" valid:"Required"`  
70 - Title string `json:"title" valid:"Required"`  
71 - Content string `json:"content" valid:"Required"`  
72 - AllowClose int `json:"allow_close"`  
73 - AllowCondition int `json:"allow_condition"` 68 + Id int `json:"id"`
  69 + Type int `json:"type" valid:"Required"`
  70 + Title string `json:"title" valid:"Required"`
  71 + Content string `json:"content" valid:"Required"`
  72 + AllowClose int `json:"allow_close"`
  73 + //AllowCondition int `json:"allow_condition"`
74 QuestionSwitch int `json:"question_switch"` 74 QuestionSwitch int `json:"question_switch"`
75 Receiver []Receiver `json:"receiver" valid:"Required"` 75 Receiver []Receiver `json:"receiver" valid:"Required"`
76 Question Question `json:"question"` 76 Question Question `json:"question"`
@@ -84,12 +84,12 @@ type Receiver struct { @@ -84,12 +84,12 @@ type Receiver struct {
84 84
85 /*UpdateBulletin */ 85 /*UpdateBulletin */
86 type UpdateBulletinRequest struct { 86 type UpdateBulletinRequest struct {
87 - Id int `json:"id" valid:"Required"`  
88 - Type int `json:"type" valid:"Required"`  
89 - Title string `json:"title" valid:"Required"`  
90 - Content string `json:"content" valid:"Required"`  
91 - AllowClose int `json:"allow_close"`  
92 - AllowCondition int `json:"allow_condition"` 87 + Id int `json:"id" valid:"Required"`
  88 + Type int `json:"type" valid:"Required"`
  89 + Title string `json:"title" valid:"Required"`
  90 + Content string `json:"content" valid:"Required"`
  91 + AllowClose int `json:"allow_close"`
  92 + //AllowCondition int `json:"allow_condition"`
93 QuestionSwitch int `json:"question_switch"` 93 QuestionSwitch int `json:"question_switch"`
94 Receiver []string `json:"receiver" valid:"Required"` 94 Receiver []string `json:"receiver" valid:"Required"`
95 Question Question `json:"question"` 95 Question Question `json:"question"`
@@ -32,12 +32,12 @@ func BulletinRelease(uid, companyId int64, request *protocol.BulletinReleaseRequ @@ -32,12 +32,12 @@ func BulletinRelease(uid, companyId int64, request *protocol.BulletinReleaseRequ
32 W: request.Cover.W, 32 W: request.Cover.W,
33 Receiver: string(receiver), 33 Receiver: string(receiver),
34 QuestionSwitch: int8(request.QuestionSwitch), 34 QuestionSwitch: int8(request.QuestionSwitch),
35 - AllowCondition: int8(request.AllowCondition),  
36 - AllowClose: int8(request.AllowClose),  
37 - CompanyId: companyId,  
38 - CreateAt: time.Now(),  
39 - UpdateAt: time.Now(),  
40 - Status: protocol.BulletinUnRelease, 35 + //AllowCondition: int8(request.AllowCondition),
  36 + AllowClose: int8(request.AllowClose),
  37 + CompanyId: companyId,
  38 + CreateAt: time.Now(),
  39 + UpdateAt: time.Now(),
  40 + Status: protocol.BulletinUnRelease,
41 } 41 }
42 42
43 orm := orm2.NewOrm() 43 orm := orm2.NewOrm()
@@ -167,12 +167,12 @@ func GetBulletin(id int, companyId int64, request *protocol.GetBulletinRequest) @@ -167,12 +167,12 @@ func GetBulletin(id int, companyId int64, request *protocol.GetBulletinRequest)
167 } 167 }
168 rsp = &protocol.GetBulletinResponse{} 168 rsp = &protocol.GetBulletinResponse{}
169 rsp = &protocol.GetBulletinResponse{ 169 rsp = &protocol.GetBulletinResponse{
170 - Id: bulletin.Id,  
171 - Type: int(bulletin.Type),  
172 - Title: bulletin.Title,  
173 - Content: bulletin.Content,  
174 - AllowClose: int(bulletin.AllowClose),  
175 - AllowCondition: int(bulletin.AllowCondition), 170 + Id: bulletin.Id,
  171 + Type: int(bulletin.Type),
  172 + Title: bulletin.Title,
  173 + Content: bulletin.Content,
  174 + AllowClose: int(bulletin.AllowClose),
  175 + //AllowCondition: int(bulletin.AllowCondition),
176 Cover: protocol.Cover{ 176 Cover: protocol.Cover{
177 Path: bulletin.Cover, 177 Path: bulletin.Cover,
178 W: bulletin.W, 178 W: bulletin.W,
@@ -233,7 +233,7 @@ func UpdateBulletin(companyId int64, request *protocol.UpdateBulletinRequest) (r @@ -233,7 +233,7 @@ func UpdateBulletin(companyId int64, request *protocol.UpdateBulletinRequest) (r
233 bulletin.W = request.Cover.W 233 bulletin.W = request.Cover.W
234 bulletin.Receiver = string(receiver) 234 bulletin.Receiver = string(receiver)
235 bulletin.QuestionSwitch = int8(request.QuestionSwitch) 235 bulletin.QuestionSwitch = int8(request.QuestionSwitch)
236 - bulletin.AllowCondition = int8(request.AllowCondition) 236 + //bulletin.AllowCondition = int8(request.AllowCondition)
237 bulletin.AllowClose = int8(request.AllowClose) 237 bulletin.AllowClose = int8(request.AllowClose)
238 bulletin.UpdateAt = time.Now() 238 bulletin.UpdateAt = time.Now()
239 if err = models.UpdateBulletinById(bulletin); err != nil { 239 if err = models.UpdateBulletinById(bulletin); err != nil {
@@ -155,33 +155,33 @@ token 的响应内容 @@ -155,33 +155,33 @@ token 的响应内容
155 155
156 ```json 156 ```json
157 { 157 {
158 - "type": 2,  
159 - "title": "标题",  
160 - "content": "公告内容",  
161 - "allow_close": 0,  
162 - "allow_condition": 3,  
163 - "question_switch": 1,  
164 - "receiver": ["1", "2"],  
165 - "question": {  
166 - "id": 1,  
167 - "type": 1,  
168 - "title": "今天星期几?",  
169 - "content": [  
170 - {  
171 - "id": 1,  
172 - "content": "星期1"  
173 - },  
174 - {  
175 - "id": 2,  
176 - "content": "星期2"  
177 - }  
178 - ]  
179 - },  
180 - "cover": {  
181 - "path": "/xx/xx.img",  
182 - "w": 50,  
183 - "h": 70  
184 - } 158 + "type":2,
  159 + "title":"标题",
  160 + "content":"公告内容",
  161 + "allow_close":0,
  162 + "question_switch":1,
  163 + "receiver":["1","2"],
  164 + "question":
  165 + {
  166 + "id":1,
  167 + "type":1,
  168 + "title":"今天星期几?",
  169 + "content":[
  170 + {
  171 + "id":1,
  172 + "content":"星期1"
  173 + },
  174 + {
  175 + "id":2,
  176 + "content":"星期2"
  177 + }
  178 + ]
  179 + },
  180 + "cover":{
  181 + "path":"/xx/xx.img",
  182 + "w":50,
  183 + "h":70
  184 + }
185 } 185 }
186 ``` 186 ```
187 187
@@ -189,8 +189,7 @@ token 的响应内容 @@ -189,8 +189,7 @@ token 的响应内容
189 obj.type 公告类型(1图+跳转链接、2纯文本) 189 obj.type 公告类型(1图+跳转链接、2纯文本)
190 obj.title 标题 190 obj.title 标题
191 obj.content 公告内容 191 obj.content 公告内容
192 -obj.allow_close 允许关闭公告(0允许,1禁止)  
193 -obj.allow_condition 关闭条件 (1(bit 0):公告内容查看完 2(bit 1):回答完问题) 192 +obj.allow_close 允许关闭公告(0允许关闭窗口,1阅读完才能关闭,2选项打勾后才能关闭)
194 obj.question_switch 设置问题开关 (是否有问题) 1:是 0:否 193 obj.question_switch 设置问题开关 (是否有问题) 1:是 0:否
195 obj.receiver 接收者 194 obj.receiver 接收者
196 obj.question.type 类型:0-单选,1-多选 195 obj.question.type 类型:0-单选,1-多选
@@ -286,7 +285,6 @@ obj.status 状态 0-所有 1-下架 2-上架 @@ -286,7 +285,6 @@ obj.status 状态 0-所有 1-下架 2-上架
286 "title": "测试公告", 285 "title": "测试公告",
287 "content": "今天发布了一则公告", 286 "content": "今天发布了一则公告",
288 "allow_close": 0, 287 "allow_close": 0,
289 - "allow_condition": 3,  
290 "question_switch": 1, 288 "question_switch": 1,
291 "receiver": [ 289 "receiver": [
292 { 290 {
@@ -330,34 +328,34 @@ obj.status 状态 0-所有 1-下架 2-上架 @@ -330,34 +328,34 @@ obj.status 状态 0-所有 1-下架 2-上架
330 328
331 ```json 329 ```json
332 { 330 {
333 - "id": 3,  
334 - "type": 2,  
335 - "title": "测试公告3",  
336 - "content": "今天发布了一则公告3",  
337 - "allow_close": 0,  
338 - "allow_condition": 2,  
339 - "question_switch": 1,  
340 - "receiver": ["1", "2", "3"],  
341 - "question": {  
342 - "id": 2,  
343 - "type": 1,  
344 - "title": "今天星期几?",  
345 - "content": [  
346 - {  
347 - "id": 1,  
348 - "content": "星期2"  
349 - },  
350 - {  
351 - "id": 2,  
352 - "content": "星期3"  
353 - }  
354 - ]  
355 - },  
356 - "cover": {  
357 - "path": "/xx/xx.img",  
358 - "w": 50,  
359 - "h": 70  
360 - } 331 + "id":3,
  332 + "type":2,
  333 + "title":"测试公告3",
  334 + "content":"今天发布了一则公告3",
  335 + "allow_close":0,
  336 + "question_switch":1,
  337 + "receiver":["1","2","3"],
  338 + "question":
  339 + {
  340 + "id":2,
  341 + "type":1,
  342 + "title":"今天星期几?",
  343 + "content":[
  344 + {
  345 + "id":1,
  346 + "content":"星期2"
  347 + },
  348 + {
  349 + "id":2,
  350 + "content":"星期3"
  351 + }
  352 + ]
  353 + },
  354 + "cover":{
  355 + "path":"/xx/xx.img",
  356 + "w":50,
  357 + "h":70
  358 + }
361 } 359 }
362 ``` 360 ```
363 361