sendMsg.go 19 KB

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