sendMsg.go 19 KB

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