sendMsg.go 19 KB

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