From 0f4f6b937fb7b017b80d3e946f682c41ec326645 Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 18 Jun 2019 09:00:32 +0800 Subject: [PATCH] =?UTF-8?q?-=20GetStoreMessageStatuses=E4=B9=9F=E8=BF=94?= =?UTF-8?q?=E5=9B=9Etitle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/message.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/message.go b/business/jxstore/cms/message.go index 5bf65bc11..87895192f 100644 --- a/business/jxstore/cms/message.go +++ b/business/jxstore/cms/message.go @@ -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 {