浏览代码

计算消息推送打开和送达率

wangshan 5 年之前
父节点
当前提交
b076a9eca1
共有 1 个文件被更改,包括 19 次插入0 次删除
  1. 19 0
      core/src/qfw/manage/message.go

+ 19 - 0
core/src/qfw/manage/message.go

@@ -77,6 +77,25 @@ func (m *Message) Content(id string) error {
 		r := FindById("message_app", id, nil)
 		if nil != r {
 			(*r)["_id"] = strings.Split(fmt.Sprintf("%s", (*r)["_id"]), `"`)[1]
+			//此条消息已读的数量
+			r_count_0 := Count("jyapp_notice", map[string]interface{}{
+				"s_type":   "message",
+				"i_unread": 0,
+				"s_id":     (*r)["_id"],
+			})
+			//此条消息全部推送的数量
+			r_count := Count("jyapp_notice", map[string]interface{}{
+				"s_type": "message",
+				"s_id":   (*r)["_id"],
+			})
+			//如果此条消息送达量小于打开量;是错误的,重新赋值展示
+			if (*r)["i_delivery"].(int) < r_count_0 {
+				(*r)["i_delivery"] = r_count_0
+			}
+			(*r)["i_click"] = r_count_0
+			if r_count > 0 {
+				(*r)["i_total"] = r_count
+			}
 			data_3 := (*r)["l_submitdate"]
 			(*r)["l_submitdate"] = util.FormatDateWithObj(&data_3, util.Date_Full_Layout)
 			s_url := util.ObjToString((*r)["s_url"])