- GetStoreMessageStatuses也返回title

This commit is contained in:
gazebo
2019-06-18 09:00:32 +08:00
parent 741adff9e0
commit 0f4f6b937f

View File

@@ -13,6 +13,12 @@ import (
"git.rosy.net.cn/jx-callback/globals"
)
type MessageStatusExt struct {
model.MessageStatus
Title string `json:"title"`
}
func SendStoreMessage(ctx *jxcontext.Context, title, content string, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
db := dao.GetDB()
dao.Begin(db)
@@ -128,8 +134,11 @@ func GetStoreMessages(ctx *jxcontext.Context, msgIDs, storeIDs, types []int, fro
func GetStoreMessageStatuses(ctx *jxcontext.Context, msgIDs, storeIDs []int, fromReadCount, toReadCount int, fromTime, toTime time.Time, keyword string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
sql := `
SELECT SQL_CALC_FOUND_ROWS t1.*
SELECT SQL_CALC_FOUND_ROWS
t1.*,
t2.title
FROM message_status t1
JOIN message t2 ON t2.id = t1.message_id
WHERE 1 = 1
`
sqlParams := []interface{}{}
@@ -167,7 +176,7 @@ func GetStoreMessageStatuses(ctx *jxcontext.Context, msgIDs, storeIDs []int, fro
db := dao.GetDB()
dao.Begin(db)
defer dao.Commit(db)
var msgStatusList []*model.MessageStatus
var msgStatusList []*MessageStatusExt
// globals.SugarLogger.Debug(sql)
// globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
if err = dao.GetRows(db, &msgStatusList, sql, sqlParams...); err == nil {