...
|
...
|
@@ -169,7 +169,7 @@ func sendBulletinUserMsg(orm orm2.Ormer, receivers []protocol.VisibleObject, com |
|
|
return
|
|
|
}
|
|
|
}
|
|
|
if err = utils.ExecuteSQLWithOrmer(orm, models.SqlUpdateUserMsgPublic, models.Public, companyId, models.MsgTypeBulletin, sourceId); err != nil {
|
|
|
if err = utils.ExecuteSQLWithOrmer(orm, fmt.Sprintf(models.SqlUpdateUserMsgPublicInUsers, utils.JoinInt64s(ids, ",")), models.Public, companyId, models.MsgTypeBulletin, sourceId); err != nil {
|
|
|
log.Error(err.Error())
|
|
|
orm.Rollback()
|
|
|
return
|
...
|
...
|
@@ -310,9 +310,11 @@ func GetBulletin(id int, companyId int64, request *protocol.GetBulletinRequest) |
|
|
Type: int(question.Type),
|
|
|
Title: question.Title,
|
|
|
}
|
|
|
if err = json.Unmarshal([]byte(question.Content), &rsp.Question.Content); err != nil {
|
|
|
log.Error(err.Error())
|
|
|
return
|
|
|
if len(question.Content) > 0 {
|
|
|
if err = json.Unmarshal([]byte(question.Content), &rsp.Question.Content); err != nil {
|
|
|
log.Error(err.Error())
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
for i := range rsp.Question.Content {
|
|
|
if rsp.Question.Content[i].Id == -1 && len(rsp.Question.Content[i].Content) == 0 {
|
...
|
...
|
@@ -406,7 +408,7 @@ func UpdateBulletin(companyId int64, request *protocol.UpdateBulletinRequest) (r |
|
|
log.Error(err.Error())
|
|
|
return
|
|
|
}
|
|
|
bulletinQuestion.Title = request.Title
|
|
|
bulletinQuestion.Title = request.Question.Title
|
|
|
bulletinQuestion.Content = string(questionContent)
|
|
|
bulletinQuestion.Type = int8(request.Question.Type)
|
|
|
bulletinQuestion.UpdateAt = time.Now()
|
...
|
...
|
@@ -418,10 +420,16 @@ func UpdateBulletin(companyId int64, request *protocol.UpdateBulletinRequest) (r |
|
|
}
|
|
|
if err == orm2.ErrNoRows {
|
|
|
//添加
|
|
|
questionContent, err = json.Marshal(request.Question.Content)
|
|
|
if err != nil {
|
|
|
orm.Rollback()
|
|
|
log.Error("格式化问题失败:%s", err)
|
|
|
return
|
|
|
}
|
|
|
bulletinQuestion = &models.BulletinQuestion{
|
|
|
BulletinId: bulletin.Id,
|
|
|
Type: int8(request.Question.Type),
|
|
|
Title: request.Title,
|
|
|
Title: request.Question.Title,
|
|
|
Content: string(questionContent),
|
|
|
CreateAt: time.Now(),
|
|
|
UpdateAt: time.Now(),
|
...
|
...
|
|