作者 唐旭辉

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

# Conflicts:
#	接口模型.md
... ... @@ -19,10 +19,10 @@ type Bulletin struct {
QuestionSwitch int8 `orm:"column(question_switch);null" description:"设置问题开关 (是否有问题)"`
CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"更新时间"`
AllowClose int8 `orm:"column(allow_close);null" description:"允许关闭公告(0允许,1禁止)"`
AllowCondition int8 `orm:"column(allow_condition);null" description:"关闭条件 (1(bit 0):公告内容查看完 2(bit 1):回答完问题)"`
CompanyId int64 `orm:"column(company_id);null" description:"公司Id"`
Status uint8 `orm:"column(status)" description:"状态 1-下架 2-上架"`
AllowClose int8 `orm:"column(allow_close);null" description:"允许关闭公告(0允许关闭窗口,1阅读完才能关闭,2选项打勾后才能关闭)"`
//AllowCondition int8 `orm:"column(allow_condition);null" description:"关闭条件 (1(bit 0):公告内容查看完 2(bit 1):回答完问题)"`
CompanyId int64 `orm:"column(company_id);null" description:"公司Id"`
Status uint8 `orm:"column(status)" description:"状态 1-下架 2-上架"`
}
func (t *Bulletin) TableName() string {
... ...
... ... @@ -12,12 +12,12 @@ const (
/*BulletinRelease */
type BulletinReleaseRequest struct {
Id int `json:"id"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Content string `json:"content" valid:"Required"`
AllowClose int `json:"allow_close"`
AllowCondition int `json:"allow_condition"`
Id int `json:"id"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Content string `json:"content" valid:"Required"`
AllowClose int `json:"allow_close"`
//AllowCondition int `json:"allow_condition"`
QuestionSwitch int `json:"question_switch"`
Receiver []string `json:"receiver" valid:"Required"`
Question Question `json:"question"`
... ... @@ -65,12 +65,12 @@ type BulletinItem struct {
type GetBulletinRequest struct {
}
type GetBulletinResponse struct {
Id int `json:"id"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Content string `json:"content" valid:"Required"`
AllowClose int `json:"allow_close"`
AllowCondition int `json:"allow_condition"`
Id int `json:"id"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Content string `json:"content" valid:"Required"`
AllowClose int `json:"allow_close"`
//AllowCondition int `json:"allow_condition"`
QuestionSwitch int `json:"question_switch"`
Receiver []Receiver `json:"receiver" valid:"Required"`
Question Question `json:"question"`
... ... @@ -84,12 +84,12 @@ type Receiver struct {
/*UpdateBulletin */
type UpdateBulletinRequest struct {
Id int `json:"id" valid:"Required"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Content string `json:"content" valid:"Required"`
AllowClose int `json:"allow_close"`
AllowCondition int `json:"allow_condition"`
Id int `json:"id" valid:"Required"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Content string `json:"content" valid:"Required"`
AllowClose int `json:"allow_close"`
//AllowCondition int `json:"allow_condition"`
QuestionSwitch int `json:"question_switch"`
Receiver []string `json:"receiver" valid:"Required"`
Question Question `json:"question"`
... ...
... ... @@ -32,12 +32,12 @@ func BulletinRelease(uid, companyId int64, request *protocol.BulletinReleaseRequ
W: request.Cover.W,
Receiver: string(receiver),
QuestionSwitch: int8(request.QuestionSwitch),
AllowCondition: int8(request.AllowCondition),
AllowClose: int8(request.AllowClose),
CompanyId: companyId,
CreateAt: time.Now(),
UpdateAt: time.Now(),
Status: protocol.BulletinUnRelease,
//AllowCondition: int8(request.AllowCondition),
AllowClose: int8(request.AllowClose),
CompanyId: companyId,
CreateAt: time.Now(),
UpdateAt: time.Now(),
Status: protocol.BulletinUnRelease,
}
orm := orm2.NewOrm()
... ... @@ -167,12 +167,12 @@ func GetBulletin(id int, companyId int64, request *protocol.GetBulletinRequest)
}
rsp = &protocol.GetBulletinResponse{}
rsp = &protocol.GetBulletinResponse{
Id: bulletin.Id,
Type: int(bulletin.Type),
Title: bulletin.Title,
Content: bulletin.Content,
AllowClose: int(bulletin.AllowClose),
AllowCondition: int(bulletin.AllowCondition),
Id: bulletin.Id,
Type: int(bulletin.Type),
Title: bulletin.Title,
Content: bulletin.Content,
AllowClose: int(bulletin.AllowClose),
//AllowCondition: int(bulletin.AllowCondition),
Cover: protocol.Cover{
Path: bulletin.Cover,
W: bulletin.W,
... ... @@ -233,7 +233,7 @@ func UpdateBulletin(companyId int64, request *protocol.UpdateBulletinRequest) (r
bulletin.W = request.Cover.W
bulletin.Receiver = string(receiver)
bulletin.QuestionSwitch = int8(request.QuestionSwitch)
bulletin.AllowCondition = int8(request.AllowCondition)
//bulletin.AllowCondition = int8(request.AllowCondition)
bulletin.AllowClose = int8(request.AllowClose)
bulletin.UpdateAt = time.Now()
if err = models.UpdateBulletinById(bulletin); err != nil {
... ...
... ... @@ -155,33 +155,33 @@ token 的响应内容
```json
{
"type": 2,
"title": "标题",
"content": "公告内容",
"allow_close": 0,
"allow_condition": 3,
"question_switch": 1,
"receiver": ["1", "2"],
"question": {
"id": 1,
"type": 1,
"title": "今天星期几?",
"content": [
{
"id": 1,
"content": "星期1"
},
{
"id": 2,
"content": "星期2"
}
]
},
"cover": {
"path": "/xx/xx.img",
"w": 50,
"h": 70
}
"type":2,
"title":"标题",
"content":"公告内容",
"allow_close":0,
"question_switch":1,
"receiver":["1","2"],
"question":
{
"id":1,
"type":1,
"title":"今天星期几?",
"content":[
{
"id":1,
"content":"星期1"
},
{
"id":2,
"content":"星期2"
}
]
},
"cover":{
"path":"/xx/xx.img",
"w":50,
"h":70
}
}
```
... ... @@ -189,8 +189,7 @@ token 的响应内容
obj.type 公告类型(1图+跳转链接、2纯文本)
obj.title 标题
obj.content 公告内容
obj.allow_close 允许关闭公告(0允许,1禁止)
obj.allow_condition 关闭条件 (1(bit 0):公告内容查看完 2(bit 1):回答完问题)
obj.allow_close 允许关闭公告(0允许关闭窗口,1阅读完才能关闭,2选项打勾后才能关闭)
obj.question_switch 设置问题开关 (是否有问题) 1:是 0:否
obj.receiver 接收者
obj.question.type 类型:0-单选,1-多选
... ... @@ -286,7 +285,6 @@ obj.status 状态 0-所有 1-下架 2-上架
"title": "测试公告",
"content": "今天发布了一则公告",
"allow_close": 0,
"allow_condition": 3,
"question_switch": 1,
"receiver": [
{
... ... @@ -330,34 +328,34 @@ obj.status 状态 0-所有 1-下架 2-上架
```json
{
"id": 3,
"type": 2,
"title": "测试公告3",
"content": "今天发布了一则公告3",
"allow_close": 0,
"allow_condition": 2,
"question_switch": 1,
"receiver": ["1", "2", "3"],
"question": {
"id": 2,
"type": 1,
"title": "今天星期几?",
"content": [
{
"id": 1,
"content": "星期2"
},
{
"id": 2,
"content": "星期3"
}
]
},
"cover": {
"path": "/xx/xx.img",
"w": 50,
"h": 70
}
"id":3,
"type":2,
"title":"测试公告3",
"content":"今天发布了一则公告3",
"allow_close":0,
"question_switch":1,
"receiver":["1","2","3"],
"question":
{
"id":2,
"type":1,
"title":"今天星期几?",
"content":[
{
"id":1,
"content":"星期2"
},
{
"id":2,
"content":"星期3"
}
]
},
"cover":{
"path":"/xx/xx.img",
"w":50,
"h":70
}
}
```
... ...