作者 yangfu

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

# Conflicts:
#	models/user_company.go
#	services/auth/auth.go
1 /*.exe 1 /*.exe
2 /*.exe~ 2 /*.exe~
3 /log/*.log 3 /log/*.log
  4 +*.log
  5 +.idea
  6 +oppmg
@@ -5,7 +5,6 @@ import ( @@ -5,7 +5,6 @@ import (
5 "oppmg/common/log" 5 "oppmg/common/log"
6 "oppmg/protocol" 6 "oppmg/protocol"
7 "oppmg/services/bulletin" 7 "oppmg/services/bulletin"
8 - "strconv"  
9 ) 8 )
10 9
11 type BulletinController struct { 10 type BulletinController struct {
@@ -74,33 +73,28 @@ func (this *BulletinController) BulletinList() { @@ -74,33 +73,28 @@ func (this *BulletinController) BulletinList() {
74 } 73 }
75 74
76 //GetBulletin 75 //GetBulletin
  76 +//@router /get [post]
77 func (this *BulletinController) GetBulletin() { 77 func (this *BulletinController) GetBulletin() {
78 var msg *protocol.ResponseMessage 78 var msg *protocol.ResponseMessage
79 defer func() { 79 defer func() {
80 this.ResposeJson(msg) 80 this.ResposeJson(msg)
81 }() 81 }()
82 var request *protocol.GetBulletinRequest 82 var request *protocol.GetBulletinRequest
83 - //if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil {  
84 - // log.Error("json 解析失败", err)  
85 - // msg = protocol.BadRequestParam("1")  
86 - // return  
87 - //}  
88 - //if b, m := this.Valid(request); !b {  
89 - // msg = m  
90 - // return  
91 - //}  
92 - param := this.Ctx.Input.Param(":id")  
93 - id, _ := strconv.ParseInt(param, 10, 64)  
94 - if id == 0 { 83 + if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil {
  84 + log.Error("json 解析失败", err)
95 msg = protocol.BadRequestParam("1") 85 msg = protocol.BadRequestParam("1")
96 return 86 return
97 } 87 }
  88 + if b, m := this.Valid(request); !b {
  89 + msg = m
  90 + return
  91 + }
98 companyId := this.GetCompanyId() 92 companyId := this.GetCompanyId()
99 if companyId <= 0 { 93 if companyId <= 0 {
100 msg = protocol.BadRequestParam("1") 94 msg = protocol.BadRequestParam("1")
101 return 95 return
102 } 96 }
103 - rsp, err := bulletin.GetBulletin(int(id), companyId, request) 97 + rsp, err := bulletin.GetBulletin(request.Id, companyId, request)
104 msg = protocol.NewReturnResponse(rsp, err) 98 msg = protocol.NewReturnResponse(rsp, err)
105 } 99 }
106 100
@@ -45,7 +45,7 @@ type BulletinReleaseResponse struct { @@ -45,7 +45,7 @@ type BulletinReleaseResponse struct {
45 type BulletinListRequest struct { 45 type BulletinListRequest struct {
46 Status int8 `json:"status"` //1:待上架 2:上架 46 Status int8 `json:"status"` //1:待上架 2:上架
47 Page int `json:"page"` 47 Page int `json:"page"`
48 - PageSize int `json:"page_size"` 48 + PageSize int `json:"pageSize"`
49 } 49 }
50 type BulletinListResponse struct { 50 type BulletinListResponse struct {
51 List []*BulletinItem `json:"list"` 51 List []*BulletinItem `json:"list"`
@@ -63,6 +63,7 @@ type BulletinItem struct { @@ -63,6 +63,7 @@ type BulletinItem struct {
63 63
64 /*GetBulletin */ 64 /*GetBulletin */
65 type GetBulletinRequest struct { 65 type GetBulletinRequest struct {
  66 + Id int `json:"id"`
66 } 67 }
67 type GetBulletinResponse struct { 68 type GetBulletinResponse struct {
68 Id int `json:"id"` 69 Id int `json:"id"`
@@ -41,7 +41,7 @@ func init() { @@ -41,7 +41,7 @@ func init() {
41 beego.NSNamespace("/bulletin", 41 beego.NSNamespace("/bulletin",
42 beego.NSRouter("/add", &controllers.BulletinController{}, "post:BulletinRelease"), 42 beego.NSRouter("/add", &controllers.BulletinController{}, "post:BulletinRelease"),
43 beego.NSRouter("/list", &controllers.BulletinController{}, "post:BulletinList"), 43 beego.NSRouter("/list", &controllers.BulletinController{}, "post:BulletinList"),
44 - beego.NSRouter("/:id([0-9]+)", &controllers.BulletinController{}, "get:GetBulletin"), 44 + beego.NSRouter("/get", &controllers.BulletinController{}, "post:GetBulletin"),
45 beego.NSRouter("/update", &controllers.BulletinController{}, "post:UpdateBulletin"), 45 beego.NSRouter("/update", &controllers.BulletinController{}, "post:UpdateBulletin"),
46 ), 46 ),
47 ) 47 )
@@ -311,7 +311,7 @@ token 的响应内容 @@ -311,7 +311,7 @@ token 的响应内容
311 { 311 {
312 "code": 0, 312 "code": 0,
313 "msg": "成功", 313 "msg": "成功",
314 - "data": 314 + "data":null
315 } 315 }
316 ``` 316 ```
317 317
@@ -521,12 +521,14 @@ obj.status 状态 0-所有 1-下架 2-上架 @@ -521,12 +521,14 @@ obj.status 状态 0-所有 1-下架 2-上架
521 521
522 ### 公告详情 522 ### 公告详情
523 523
524 -- 请求路径 :/v1/bulletin/:id  
525 -- 请求方式 :get 524 +- 请求路径 :/v1/bulletin/get
  525 +- 请求方式 :post
526 - 请求 json: 526 - 请求 json:
527 527
528 ```json 528 ```json
529 -{} 529 +{
  530 + "id":5
  531 +}
530 ``` 532 ```
531 533
532 ``` 534 ```