作者 yangfu

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

# Conflicts:
#	models/user_company.go
#	services/auth/auth.go
/*.exe
/*.exe~
/log/*.log
*.log
.idea
oppmg
... ...
... ... @@ -5,7 +5,6 @@ import (
"oppmg/common/log"
"oppmg/protocol"
"oppmg/services/bulletin"
"strconv"
)
type BulletinController struct {
... ... @@ -74,33 +73,28 @@ func (this *BulletinController) BulletinList() {
}
//GetBulletin
//@router /get [post]
func (this *BulletinController) GetBulletin() {
var msg *protocol.ResponseMessage
defer func() {
this.ResposeJson(msg)
}()
var request *protocol.GetBulletinRequest
//if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil {
// log.Error("json 解析失败", err)
// msg = protocol.BadRequestParam("1")
// return
//}
//if b, m := this.Valid(request); !b {
// msg = m
// return
//}
param := this.Ctx.Input.Param(":id")
id, _ := strconv.ParseInt(param, 10, 64)
if id == 0 {
if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil {
log.Error("json 解析失败", err)
msg = protocol.BadRequestParam("1")
return
}
if b, m := this.Valid(request); !b {
msg = m
return
}
companyId := this.GetCompanyId()
if companyId <= 0 {
msg = protocol.BadRequestParam("1")
return
}
rsp, err := bulletin.GetBulletin(int(id), companyId, request)
rsp, err := bulletin.GetBulletin(request.Id, companyId, request)
msg = protocol.NewReturnResponse(rsp, err)
}
... ...
... ... @@ -45,7 +45,7 @@ type BulletinReleaseResponse struct {
type BulletinListRequest struct {
Status int8 `json:"status"` //1:待上架 2:上架
Page int `json:"page"`
PageSize int `json:"page_size"`
PageSize int `json:"pageSize"`
}
type BulletinListResponse struct {
List []*BulletinItem `json:"list"`
... ... @@ -63,6 +63,7 @@ type BulletinItem struct {
/*GetBulletin */
type GetBulletinRequest struct {
Id int `json:"id"`
}
type GetBulletinResponse struct {
Id int `json:"id"`
... ...
... ... @@ -41,7 +41,7 @@ func init() {
beego.NSNamespace("/bulletin",
beego.NSRouter("/add", &controllers.BulletinController{}, "post:BulletinRelease"),
beego.NSRouter("/list", &controllers.BulletinController{}, "post:BulletinList"),
beego.NSRouter("/:id([0-9]+)", &controllers.BulletinController{}, "get:GetBulletin"),
beego.NSRouter("/get", &controllers.BulletinController{}, "post:GetBulletin"),
beego.NSRouter("/update", &controllers.BulletinController{}, "post:UpdateBulletin"),
),
)
... ...
... ... @@ -311,7 +311,7 @@ token 的响应内容
{
"code": 0,
"msg": "成功",
"data":
"data":null
}
```
... ... @@ -521,12 +521,14 @@ obj.status 状态 0-所有 1-下架 2-上架
### 公告详情
- 请求路径 :/v1/bulletin/:id
- 请求方式 :get
- 请求路径 :/v1/bulletin/get
- 请求方式 :post
- 请求 json:
```json
{}
{
"id":5
}
```
```
... ...