sendMsg.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. package common
  2. import (
  3. "fmt"
  4. "log"
  5. "strconv"
  6. "time"
  7. "app.yhyue.com/moapp/MessageCenter/entity"
  8. "app.yhyue.com/moapp/MessageCenter/rpc/type/message"
  9. "app.yhyue.com/moapp/MessageCenter/util"
  10. "app.yhyue.com/moapp/jybase/common"
  11. "app.yhyue.com/moapp/jybase/redis"
  12. )
  13. // 类型的顺序
  14. const order = "1,4"
  15. const MsgCountKey = "count_%s_%d" //redis 消息未读数量 Count.用户id.消息类型=数量
  16. const MsgClassCountKey = "msg_class_count_%s_%d" //redis 用户消息class分类消息数量
  17. const redisModule = "msgCount"
  18. const UserMsgSummery = "user_msg_summery_%s"
  19. const UserWorkDeskKey = "user_work_desk_%s"
  20. const UserClassMapKey = "user_class_msg_%s"
  21. func FindUserMsg(this message.FindUserMsgReq, isClean bool) message.FindUserMsgRes {
  22. var err error
  23. var count int64
  24. cquery := map[string]interface{}{
  25. "receive_userid": this.UserId,
  26. "isdel": 1,
  27. "appid": this.Appid,
  28. }
  29. if this.MsgType > 0 {
  30. cquery["group_id"] = this.MsgType
  31. }
  32. if this.Read != -1 {
  33. cquery["isRead"] = this.Read
  34. }
  35. count = entity.Mysql.Count("message", cquery)
  36. data := message.FindUserMsgRes{}
  37. if this.PageSize == 5 {
  38. //从缓存里边取数据
  39. pc_a, err := entity.GetData(this.UserId)
  40. if err == nil && pc_a != nil {
  41. // 缓存有值
  42. if !isClean {
  43. data.Code = 1
  44. data.Message = "查询成功"
  45. data.Data = pc_a.Data
  46. data.Count = pc_a.Count
  47. return data
  48. }
  49. }
  50. }
  51. count = entity.Mysql.Count("message", cquery)
  52. if count > 0 {
  53. res := entity.Mysql.Find("message", cquery, "", "createtime desc", (int(this.OffSet)-1)*int(this.PageSize), int(this.PageSize))
  54. //log.Println("数据:", res)
  55. if res != nil && len(*res) > 0 {
  56. for _, v := range *res {
  57. _id := util.Int64All(v["id"])
  58. id := strconv.FormatInt(_id, 10)
  59. data.Data = append(data.Data, &message.Messages{
  60. Id: id,
  61. Appid: util.ObjToString(v["appId"]),
  62. ReceiveUserId: util.ObjToString(v["receive_userid"]),
  63. ReceiveName: util.ObjToString(v["receive_name"]),
  64. SendUserId: util.ObjToString(v["send_userid"]),
  65. SendName: util.ObjToString(v["send_name"]),
  66. Createtime: util.ObjToString(v["createtime"]),
  67. Title: util.ObjToString(v["title"]),
  68. MsgType: int64(util.IntAll(v["group_id"])),
  69. Link: util.ObjToString(v["link"]),
  70. CiteId: util.Int64All(v["cite_id"]),
  71. Content: util.ObjToString(v["content"]),
  72. IsRead: util.Int64All(v["isRead"]),
  73. MsgLogId: util.Int64All(v["msg_log_id"]),
  74. })
  75. }
  76. }
  77. }
  78. data.Count = count
  79. if this.PageSize == 5 {
  80. redisData := map[string]interface{}{
  81. "count": count,
  82. "data": data.Data,
  83. }
  84. entity.SetData(this.UserId, redisData, entity.SurvivalTime)
  85. }
  86. if err != nil {
  87. data.Code = 0
  88. data.Message = "查询失败"
  89. } else {
  90. data.Code = 1
  91. data.Message = "查询成功"
  92. }
  93. return data
  94. }
  95. func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
  96. var (
  97. unread, count, toDoUnread int64
  98. )
  99. m := &MessageService{}
  100. data := new(message.UserMsgList)
  101. if !this.IsMsgList && !this.IsColumnNewMsg && !this.IsColumn { //消息未读数统计
  102. //获取总未读数 初始化
  103. var sortUnread map[string]int64
  104. sortUnread, unread = m.CountUnread(this.UserId, true)
  105. if this.IsContainLetter { //私信统计
  106. unread += unreadMsg(this)
  107. }
  108. data.Unread = unread
  109. data.ToDoUnread = sortUnread["11"]
  110. return data
  111. }
  112. cquery := map[string]interface{}{
  113. "receive_userid": this.UserId,
  114. "isdel": 1,
  115. "appid": this.Appid,
  116. }
  117. // p436 细化分类时需要用msg_type 进行查询
  118. if this.MsgType > 0 && this.IsClassSearch {
  119. cquery["msg_type"] = this.MsgType
  120. } else if this.MsgType > 0 {
  121. cquery["group_id"] = this.MsgType
  122. }
  123. if this.Read != -1 {
  124. cquery["isRead"] = this.Read
  125. }
  126. //获取栏目下的数据
  127. sData := make(map[string][]*message.Messages)
  128. t := time.Now()
  129. if this.IsColumnNewMsg && this.SortSize > 0 { //this.SortSize app分类展示最新一条消息
  130. var sortData *[]map[string]interface{}
  131. if this.IsClassSearch { // p436 增加
  132. sortDataQ := fmt.Sprintf(`SELECT title,createtime,msg_type as group_id ,id FROM (
  133. SELECT title,createtime,msg_type,id, ROW_NUMBER() OVER (PARTITION BY msg_type, receive_userid ORDER BY createtime DESC) AS row_num
  134. FROM message
  135. WHERE receive_userid = '%s' and isdel = 1 and appid = %s and group_id=%d
  136. ) AS message_ranked
  137. WHERE row_num <=%d;`, this.UserId, this.Appid, this.MsgType, this.SortSize)
  138. sortData = entity.Mysql.SelectBySql(sortDataQ)
  139. } else {
  140. sortData = entity.Mysql.SelectBySql(fmt.Sprintf(`SELECT title,createtime,group_id,id FROM (
  141. SELECT title,createtime,group_id,id, ROW_NUMBER() OVER (PARTITION BY group_id, receive_userid ORDER BY createtime DESC) AS row_num
  142. FROM message
  143. WHERE receive_userid = '%s' and isdel = 1 and appid = %s
  144. ) AS message_ranked
  145. WHERE row_num <=%d;`, this.UserId, this.Appid, this.SortSize))
  146. }
  147. log.Println("消息列表耗时1:", time.Since(t))
  148. if sortData != nil {
  149. for _, v := range *sortData {
  150. _id := util.Int64All(v["id"])
  151. id := strconv.FormatInt(_id, 10)
  152. var msg = message.Messages{
  153. Id: id,
  154. Createtime: common.InterfaceToStr(v["createtime"]),
  155. Title: common.InterfaceToStr(v["title"]),
  156. MsgType: int64(util.IntAll(v["group_id"])),
  157. }
  158. if sData[common.InterfaceToStr(v["group_id"])] == nil {
  159. sData[common.InterfaceToStr(v["group_id"])] = []*message.Messages{&msg}
  160. } else {
  161. sData[common.InterfaceToStr(v["group_id"])] = append(sData[common.InterfaceToStr(v["group_id"])], &msg)
  162. }
  163. }
  164. }
  165. }
  166. // 消息栏目下的最新消息
  167. var columnData []*message.AllSortData
  168. if this.IsColumn && this.MsgType > 0 && this.IsClassSearch {
  169. // p436 处理消息细分分类要返回的数据
  170. // 获取小分类下的未读数
  171. sortUnread, _ := m.CountClassUnread(this.UserId, this.MsgType)
  172. columnArr := []entity.MsgClass{}
  173. if !this.IsColumnNewMsg { // 用于区分分类列表页和分类详情页 根据不同情况
  174. columnArr = append(columnArr, entity.ClassMap[this.MsgType])
  175. } else {
  176. columnArr = entity.ClassSearchMap[this.MsgType]
  177. }
  178. for i := 0; i < len(columnArr); i++ {
  179. tmp := columnArr[i]
  180. var column message.AllSortData
  181. column.Name = tmp.Name
  182. column.Img = fmt.Sprintf("/common-module/msgCenter/%s.png", tmp.Img)
  183. column.MsgType = tmp.MsgType
  184. // 消息未读数
  185. msgType := common.InterfaceToStr(tmp.MsgType)
  186. column.UnreadMessages = sortUnread[msgType]
  187. unread += sortUnread[msgType]
  188. column.Data = sData[msgType]
  189. column.IsClassSearch = true
  190. columnData = append(columnData, &column)
  191. }
  192. // 未读数量
  193. } else if this.IsColumn {
  194. //获取所有分类未读数 不初始化
  195. sortUnread, _ := m.CountUnread(this.UserId, false)
  196. toDoUnread = sortUnread["11"]
  197. for _, v := range entity.MessageColumn {
  198. var column message.AllSortData
  199. column.Name = common.InterfaceToStr(v["name"])
  200. column.Img = fmt.Sprintf("/common-module/msgCenter/%s.png", common.InterfaceToStr(v["img"]))
  201. column.MsgType = common.Int64All(v["group_id"])
  202. if column.Name == "私信" {
  203. column.UnreadMessages = unreadMsg(this)
  204. } else if common.IntAll(v["group_id"]) > 0 {
  205. //消息未读数
  206. msgType := common.InterfaceToStr(v["group_id"])
  207. column.UnreadMessages = sortUnread[msgType]
  208. unread += sortUnread[msgType]
  209. column.Data = sData[msgType]
  210. }
  211. // p436 该groupId属于展示细化分类的 如待办 点击待办进入到待参加会议、待处理任务中间列表页等
  212. // 该返回值用于前端后续传参使用
  213. if _, ok := entity.ClassSearchMap[column.MsgType]; ok {
  214. column.IsClassSearch = true
  215. }
  216. columnData = append(columnData, &column)
  217. }
  218. }
  219. data.SortData = columnData
  220. count = entity.Mysql.Count("message", cquery)
  221. if this.IsMsgList {
  222. if count > 0 {
  223. if this.OffSet <= 0 {
  224. this.OffSet = 1
  225. }
  226. res := entity.Mysql.Find("message", cquery, "", "createtime desc", (int(this.OffSet)-1)*int(this.PageSize), int(this.PageSize))
  227. log.Println("消息列表耗时3:", time.Since(t))
  228. if res != nil && len(*res) > 0 {
  229. for _, v := range *res {
  230. _id := util.Int64All(v["id"])
  231. id := strconv.FormatInt(_id, 10)
  232. data.Data = append(data.Data, &message.Messages{
  233. Id: id,
  234. Appid: common.InterfaceToStr(v["appId"]),
  235. ReceiveUserId: common.InterfaceToStr(v["receive_userid"]),
  236. ReceiveName: common.InterfaceToStr(v["receive_name"]),
  237. SendUserId: common.InterfaceToStr(v["send_userid"]),
  238. SendName: common.InterfaceToStr(v["send_name"]),
  239. Createtime: common.InterfaceToStr(v["createtime"]),
  240. Title: common.InterfaceToStr(v["title"]),
  241. MsgType: int64(util.IntAll(v["group_id"])),
  242. Link: common.InterfaceToStr(v["link"]),
  243. CiteId: util.Int64All(v["cite_id"]),
  244. Content: common.InterfaceToStr(v["content"]),
  245. IsRead: util.Int64All(v["isRead"]),
  246. MsgLogId: util.Int64All(v["msg_log_id"]),
  247. })
  248. }
  249. }
  250. }
  251. }
  252. data.Count = count
  253. if this.Read == 0 {
  254. unread = count
  255. if this.IsContainLetter { //是否需要统计私信未读数
  256. unread += unreadMsg(this)
  257. }
  258. }
  259. data.Unread = unread
  260. data.ToDoUnread = toDoUnread
  261. return data
  262. }
  263. func unreadMsg(this *message.UserMsgListReq) int64 {
  264. if this.PositionId <= 0 {
  265. return 0
  266. }
  267. //querySql := fmt.Sprintf("SELECT b.*,(SELECT SUM( a.unread) FROM %s a "+
  268. // "LEFT JOIN %s b ON a.message_id = b.id "+
  269. // "WHERE a.unread > 0 "+
  270. // "AND ( a.my_position_id = %d OR a.user_id = %d )) AS unread "+
  271. // "FROM %s a "+
  272. // "LEFT JOIN %s b ON a.message_id = b.id "+
  273. // "WHERE a.unread > 0 "+
  274. // "AND ( a.my_position_id = %d OR a.user_id = %d ) "+
  275. // "ORDER BY a.TIMESTAMP DESC LIMIT 0,1", "socialize_summary", "socialize_message", this.PositionId, this.NewUserId,
  276. // "socialize_summary", "socialize_message", this.PositionId, this.NewUserId)
  277. querySql := fmt.Sprintf(`SELECT
  278. SUM( unread ) as unread
  279. FROM (
  280. SELECT
  281. SUM( unread ) as unread
  282. FROM
  283. socialize_summary
  284. WHERE
  285. my_position_id = %d
  286. AND unread > 0
  287. UNION ALL
  288. SELECT
  289. SUM( unread ) as unread
  290. FROM
  291. socialize_summary
  292. WHERE
  293. user_id = %d
  294. AND unread > 0)`, this.PositionId, this.NewUserId)
  295. log.Println("查询sql", querySql)
  296. msgUnread := entity.BaseMysql.SelectBySql(querySql)
  297. if msgUnread != nil && len(*msgUnread) > 0 {
  298. return common.Int64All((*msgUnread)[0]["unread"])
  299. }
  300. return 0
  301. }
  302. func MessageGetLast(this *message.UserMsgListReq) *message.Messages {
  303. if !this.IsMsgList && !this.IsColumnNewMsg && !this.IsColumn {
  304. return nil
  305. }
  306. query := map[string]interface{}{
  307. "receive_userid": this.UserId,
  308. "isdel": 1,
  309. "appid": this.Appid,
  310. "isRead": 0,
  311. "group_id": 1,
  312. }
  313. lastMsg := entity.Mysql.FindOne("message", query, "", "createtime desc")
  314. if lastMsg != nil && len(*lastMsg) > 0 {
  315. _id := util.Int64All((*lastMsg)["id"])
  316. id := strconv.FormatInt(_id, 10)
  317. msg := message.Messages{
  318. Id: id,
  319. Appid: common.InterfaceToStr((*lastMsg)["appid"]),
  320. ReceiveUserId: common.InterfaceToStr((*lastMsg)["receive_userid"]),
  321. ReceiveName: common.InterfaceToStr((*lastMsg)["receive_name"]),
  322. SendUserId: common.InterfaceToStr((*lastMsg)["send_userid"]),
  323. SendName: common.InterfaceToStr((*lastMsg)["send_name"]),
  324. Createtime: common.InterfaceToStr((*lastMsg)["createtime"]),
  325. Title: common.InterfaceToStr((*lastMsg)["title"]),
  326. MsgType: common.Int64All((*lastMsg)["group_id"]),
  327. Link: common.InterfaceToStr((*lastMsg)["link"]),
  328. CiteId: common.Int64All((*lastMsg)["cite_id"]),
  329. Content: common.InterfaceToStr((*lastMsg)["content"]),
  330. IsRead: common.Int64All((*lastMsg)["isRead"]),
  331. MsgLogId: common.Int64All((*lastMsg)["msg_log_id"]),
  332. }
  333. return &msg
  334. }
  335. return nil
  336. }
  337. // MsgCountAdd 消息未读数量加1
  338. func MsgCountAdd(userId, appId string, msgType int64, msgClassType int64) bool {
  339. keyString := fmt.Sprintf(MsgCountKey, userId, msgType)
  340. classKeyString := fmt.Sprintf(MsgClassCountKey, userId, msgClassType)
  341. if exist, _ := redis.Exists(redisModule, classKeyString); exist {
  342. redis.Incr(redisModule, classKeyString)
  343. }
  344. exists, _ := redis.Exists(redisModule, keyString)
  345. if exists {
  346. in := redis.Incr(redisModule, keyString)
  347. FindUserMsg(message.FindUserMsgReq{
  348. UserId: userId,
  349. Appid: appId,
  350. OffSet: 1,
  351. PageSize: 5,
  352. MsgType: -1,
  353. Read: 0,
  354. }, true)
  355. return in > 0
  356. }
  357. return true
  358. }
  359. // MsgCountMinusOne 根据消息类型未读消息数量减1
  360. func MsgCountMinusOne(userId, appId string, msgType int64, msgClassType int64) bool {
  361. classKeyString := fmt.Sprintf(MsgClassCountKey, userId, msgClassType)
  362. if exist, _ := redis.Exists(redisModule, classKeyString); exist {
  363. if redis.GetInt(redisModule, classKeyString) > 0 {
  364. redis.Decrby(redisModule, classKeyString, 1)
  365. }
  366. }
  367. keyString := fmt.Sprintf(MsgCountKey, userId, msgType)
  368. exists, _ := redis.Exists(redisModule, keyString)
  369. if exists {
  370. FindUserMsg(message.FindUserMsgReq{
  371. UserId: userId,
  372. Appid: appId,
  373. OffSet: 1,
  374. PageSize: 5,
  375. MsgType: -1,
  376. Read: 0,
  377. }, true)
  378. if redis.GetInt(redisModule, keyString) <= 0 {
  379. return true
  380. }
  381. in := redis.Decrby(redisModule, keyString, 1)
  382. return in > 0
  383. }
  384. return true
  385. }
  386. // MsgCountZero 把该消息类型未读数量置0
  387. func MsgCountZero(userId, appId string, msgType int64) bool {
  388. if msgType > 0 && msgType < 999 { //全部私信不统计
  389. keyString := fmt.Sprintf(MsgCountKey, userId, msgType)
  390. fool := redis.Put(redisModule, keyString, 0, -1)
  391. FindUserMsg(message.FindUserMsgReq{
  392. UserId: userId,
  393. Appid: appId,
  394. OffSet: 1,
  395. PageSize: 5,
  396. MsgType: -1,
  397. Read: 0,
  398. }, true)
  399. return fool
  400. }
  401. return true
  402. }
  403. //func MultSave(this message.MultipleSaveMsgReq) (int64, string) {
  404. // userIdArr := strings.Split(this.UserIds, ",")
  405. // userNameArr := strings.Split(this.UserNames, ",")
  406. // positionIdArr := strings.Split(this.PositionIds, ",")
  407. // if len(userIdArr) == 0 {
  408. // return 0, "无效的用户id"
  409. // }
  410. // wg := &sync.WaitGroup{}
  411. // var group_id int
  412. // class := entity.Mysql.FindOne("message_class", map[string]interface{}{"msg_type": this.MsgType}, "group_id", "")
  413. // if class != nil && len(*class) > 0 {
  414. // group_id = util.IntAll((*class)["group_id"])
  415. // }
  416. // //p459 特殊处理 传过来的消息内容格式为 消息内容#jy#微信模板项目名称#jy#服务地址
  417. // equityName, equityAddr := "", ""
  418. // if this.MsgType == config.ConfigJson.EquityInfoMsgType {
  419. // equityRs := strings.Split(this.Content, "#jy#")
  420. // if len(equityRs) != 3 {
  421. // log.Println("消息内容格式有误:", this.Content)
  422. // return 0, "无效的消息内容格式"
  423. // }
  424. // this.Content = equityRs[0]
  425. // equityName = equityRs[1]
  426. // equityAddr = equityRs[2]
  427. // }
  428. // for i := 0; i < len(userIdArr); i++ {
  429. // if userIdArr[i] == "" {
  430. // continue
  431. // }
  432. // name := userNameArr[i]
  433. // wg.Add(1)
  434. // entity.SaveConcurrencyChan <- 1
  435. // var positionId int64
  436. // if len(positionIdArr) == len(userIdArr) {
  437. // positionId = common.Int64All(positionIdArr[i])
  438. // }
  439. //
  440. // go func(v, userName string, positionId int64) {
  441. // defer func() {
  442. // <-entity.SaveConcurrencyChan
  443. // wg.Done()
  444. // }()
  445. // //消息数组
  446. // nTime := time.Now().Format("2006-01-02 15:04:05")
  447. // //c := entity.Mysql.Count("conversation", map[string]interface{}{"receive_id": v, "send_id": this.SendUserId})
  448. // sql3 := `INSERT INTO message(appid,receive_userid,receive_name,send_userid,send_name,title,content,msg_type,link,cite_id,createtime,isRead,isdel,msg_log_id,show_buoy,show_content,group_id,position_id) values ("%s",'%s','%s','%s','%s','%s','%s',%d,'%s',0,'%s',0,1,%d,%d,'%s',%d,?);`
  449. // sql3 = fmt.Sprintf(sql3, this.Appid, v, userName, this.SendUserId, this.SendName, this.Title, this.Content, this.MsgType, this.Link, nTime, this.MsgLogId, this.ShowBuoy, this.ShowContent, group_id)
  450. // var in int64
  451. // /*if c <= 0 {
  452. // sql1 := `INSERT INTO conversation(appid,secret_key,user_id,receive_id,receive_name,send_id,send_name,sort,createtime) values ('%s','','%s','%s','%s','%s','%s',0,'%s');`
  453. // sql1 = fmt.Sprintf(sql1, this.Appid, this.SendUserId, v, userName, this.SendUserId, this.SendName, nTime)
  454. //
  455. // //插入会话表
  456. // in1 := entity.Mysql.InsertBySql(sql1)
  457. // sql2 := `INSERT INTO conversation(appid,secret_key,user_id,receive_id,receive_name,send_id,send_name,sort,createtime) values ('%s','','%s','%s','%s','%s','%s',0,'%s');`
  458. // sql2 = fmt.Sprintf(sql2, this.Appid, v, this.SendUserId, this.SendName, v, userName, nTime)
  459. // in2 := entity.Mysql.InsertBySql(sql2)
  460. // //插入消息表
  461. // in = entity.Mysql.InsertBySql(sql3, common.If(positionId != 0, positionId, nil))
  462. // logx.Info(in1, in2, in)
  463. //
  464. // if in1 > -1 && in2 > -1 && in > -1 {
  465. // ok1 := MsgCountAdd(v, this.Appid, this.MsgType)
  466. // if !ok1 {
  467. // log.Println("存redis:", ok1, v)
  468. // }
  469. // }
  470. // } else {*/
  471. // in = entity.Mysql.InsertBySql(sql3, common.If(positionId != 0, positionId, nil))
  472. // logx.Info("插入消息返回 in1 id:", in, "消息类型:", this.MsgType, "用户id:", v)
  473. // if in > -1 {
  474. // ok := MsgCountAdd(v, this.Appid, util.Int64All(group_id), this.MsgType)
  475. // if !ok {
  476. // log.Println("存redis:", ok, v)
  477. // }
  478. // }
  479. // //}
  480. // if in > -1 {
  481. // //发送消息成功,推送微信、app
  482. // pushConfig, err := GetWxTmplConfig(this.MsgType)
  483. // if err != nil {
  484. // logx.Error(fmt.Sprintf("SendWxTmplMsg uId %s Error %s", v, err.Error()))
  485. // }
  486. // p := &WxTmplPush{
  487. // Config: pushConfig,
  488. // CustomWxTpl: this.CustomWxTpl,
  489. // }
  490. // p.MgoId = v
  491. // if this.MsgType == 10 {
  492. // this.Title = this.ProductName
  493. // this.Content = this.OrderId
  494. // nTime = this.OrderMoney
  495. // }
  496. // // 消息模版 工单类型 {{thing19.DATA}} 工单标题 {{thing6.DATA}} 项目名称 {{thing13.DATA}} 服务时间 {{time25.DATA}} 服务地址 {{thing26.DATA}}
  497. // if this.MsgType != 1 && this.MsgType != 10 {
  498. // if this.MsgType == config.ConfigJson.EquityInfoMsgType {
  499. // // p459 服务地址特殊处理
  500. // err = p.SendMsg(this.WxPushUrl, this.Title, equityName, nTime, this.Row4, equityAddr)
  501. // } else {
  502. // err = p.SendMsg(this.WxPushUrl, this.Title, this.Content, nTime, this.Row4, "")
  503. // }
  504. // if err != nil {
  505. // logx.Error(fmt.Sprintf("SendWxTmplMsg uId %s Error %s", v, err.Error()))
  506. // } else {
  507. // logx.Infof("SendWxTmplMsg uId success %s ", v)
  508. // }
  509. // }
  510. // if this.MsgType == 1 {
  511. // mst := new(WxTmplConfig)
  512. // mst.Switch = AppPushMsgType[group_id]
  513. // p.Config = mst
  514. // }
  515. // //app推送
  516. // if this.MsgType != 10 {
  517. // uData := p.GetUserPushInfo()
  518. // category := ""
  519. // if this.SendUserId == "cbgl" {
  520. // category = "服务通知_工作事项"
  521. // }
  522. // if err = AppPushMsg(uData, AppPushMsgType[group_id], this.AppPushUrl, this.Title, this.Content, this.MsgType, category); err != nil {
  523. // logx.Error(fmt.Sprintf("SendAppMsg uId %s Error %s", v, err.Error()))
  524. // }
  525. // }
  526. // }
  527. // }(userIdArr[i], name, positionId)
  528. // }
  529. // wg.Wait()
  530. // return 0, ""
  531. //}