|
@@ -78,7 +78,7 @@ func MsgDetail(id int) (*map[string]interface{}, error) {
|
|
|
}
|
|
|
|
|
|
// MsgList 消息列表查询
|
|
|
-func MsgList(param *MsgListParam, isLookAllMsg, loginUserId int, loginUserName string) (*[]map[string]interface{}, int) {
|
|
|
+func MsgList(param *MsgListParam, isLookAllMsg, loginUserId int, loginUserName string) ([]map[string]interface{}, int) {
|
|
|
sql := "SELECT DISTINCT(a.id)," + Str + " FROM message_send_log as a LEFT JOIN sendmsg_customer_info as b on a.id = b.msg_id "
|
|
|
str := ""
|
|
|
sqlc := "SELECT COUNT(DISTINCT a.id) FROM message_send_log as a LEFT JOIN sendmsg_customer_info as b on a.id = b.msg_id "
|
|
@@ -90,7 +90,7 @@ func MsgList(param *MsgListParam, isLookAllMsg, loginUserId int, loginUserName s
|
|
|
}
|
|
|
}
|
|
|
if param.MsgType != 0 {
|
|
|
- str += " a.msg_type = " + strconv.Itoa(param.MsgType) + " and"
|
|
|
+ str += " a.group_id = " + strconv.Itoa(param.MsgType) + " and"
|
|
|
}
|
|
|
if param.Title != "" {
|
|
|
str += " a.title like " + "'%" + param.Title + "%' and"
|
|
@@ -136,9 +136,16 @@ func MsgList(param *MsgListParam, isLookAllMsg, loginUserId int, loginUserName s
|
|
|
}
|
|
|
sql += page
|
|
|
//sql += " ORDER BY id DESC"
|
|
|
+ list := []map[string]interface{}{}
|
|
|
data := util.JysqlDB.SelectBySql(sql)
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
+ for _, v := range *data {
|
|
|
+ v["msg_type"] = v["group_id"]
|
|
|
+ list = append(list, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
count := util.JysqlDB.CountBySql(sqlc)
|
|
|
- return data, int(count)
|
|
|
+ return list, int(count)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -164,6 +171,7 @@ func SendMsg(param *public.Message, sendStatus int, loginUserName string, loginU
|
|
|
if param.SendMode == 2 {
|
|
|
param.SendTime = time.Now().Format(qutil.Date_Full_Layout)
|
|
|
}
|
|
|
+ groupId := public.MsgTypeToGroupId[param.MsgType]
|
|
|
// 更新消息 新用户注册消息不能更新
|
|
|
if param.Id != 0 && param.Sign != 4 {
|
|
|
msgLogId = strconv.Itoa(param.Id)
|
|
@@ -185,6 +193,7 @@ func SendMsg(param *public.Message, sendStatus int, loginUserName string, loginU
|
|
|
"show_content": param.ShowContent,
|
|
|
"Sign": param.Sign,
|
|
|
"menu_name": param.MenuName,
|
|
|
+ "group_id": groupId,
|
|
|
})
|
|
|
if !ok {
|
|
|
return 0, errors.New("发送消息出错")
|
|
@@ -232,6 +241,7 @@ func SendMsg(param *public.Message, sendStatus int, loginUserName string, loginU
|
|
|
"show_buoy": param.ShowBuoy,
|
|
|
"show_content": param.ShowContent,
|
|
|
"menu_name": param.MenuName,
|
|
|
+ "group_id": groupId,
|
|
|
})
|
|
|
//立即发送 新用户发送消息走nsq通知 直接返回
|
|
|
if param.Sign == 4 {
|
|
@@ -281,6 +291,7 @@ func pushMsg(param *SendMessage, sendStatus int) (int, error) {
|
|
|
if param.CallPlatform == "" {
|
|
|
param.CallPlatform = "hjzx"
|
|
|
}
|
|
|
+ groupId := public.MsgTypeToGroupId[param.MsgType]
|
|
|
//保存发送的消息
|
|
|
log.Println("发送消息发送时间:", param.SendTime)
|
|
|
msgId := util.JysqlDB.Insert("message_send_log", map[string]interface{}{
|
|
@@ -299,6 +310,7 @@ func pushMsg(param *SendMessage, sendStatus int) (int, error) {
|
|
|
"send_userid": param.CallPlatform, //呼叫中心
|
|
|
"sign": 3,
|
|
|
"menu_name": param.MenuName,
|
|
|
+ "group_id": groupId,
|
|
|
})
|
|
|
msgLogId = strconv.FormatInt(msgId, 10)
|
|
|
//立即发送
|