互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.2 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package common
  2. import (
  3. "hudongzhuanjia/controllers"
  4. im_service "hudongzhuanjia/services/im"
  5. "time"
  6. )
  7. type ImTestCtl struct {
  8. controllers.BaseCtl
  9. }
  10. func (t *ImTestCtl) SendNotice() {
  11. activityId := t.MustGetInt64("activity_id")
  12. status := t.MustGetInt("status")
  13. im_service.SendGroupCustomMessage(1, activityId, im_service.NoticeStatus(status), map[string]interface{}{
  14. "customer_id": 16,
  15. "shake_red_envelope_rule_id": 5,
  16. "timestamp": time.Now().Unix(),
  17. })
  18. t.SUCCESS("发送成功")
  19. }
  20. func (t *ImTestCtl) SendRedPack() {
  21. activityId := t.MustGetInt64("activity_id")
  22. prompt := t.MustGet("prompt")
  23. im_service.SendGroupCustomMessage(1, activityId, im_service.NoticeLiveRedPackStart,
  24. map[string]interface{}{
  25. "live_red_envelope_rule_id": 1,
  26. "prompt": prompt,
  27. "timestamp": time.Now().Unix(),
  28. })
  29. t.SUCCESS("发送成功")
  30. }
  31. type LotteryUser struct {
  32. UserId int64
  33. Username string
  34. UserPhone string
  35. Avatar string
  36. PrizeName string
  37. LadderId int64
  38. PrizeImg string
  39. }
  40. func (t *ImTestCtl) SendLottery() {
  41. activityId := t.MustGetInt64("activity_id")
  42. ladderId := t.MustGetInt64("lottery_draw_ladder_id")
  43. desc := t.MustGet("desc")
  44. notice := t.MustGetInt("notice")
  45. if notice == 264 {
  46. winners := make([]*LotteryUser, 0)
  47. winners = append(winners, &LotteryUser{
  48. UserId: 1,
  49. Username: "哗啦啦@黄梓健",
  50. UserPhone: "18814098671",
  51. Avatar: "http://thirdwx.qlogo.cn/mmopen/vi_32/U8krFYdib9PITkDicbaNPnJHKpUMJ8unribzyPcUKWKGyJovoKmES6UHW1Zl6bVsUUtmFjyzsUTrajAJ53icZpEcgw/132",
  52. PrizeName: "白金王座",
  53. LadderId: ladderId,
  54. PrizeImg: "http://thirdwx.qlogo.cn/mmopen/vi_32/U8krFYdib9PITkDicbaNPnJHKpUMJ8unribzyPcUKWKGyJovoKmES6UHW1Zl6bVsUUtmFjyzsUTrajAJ53icZpEcgw/132",
  55. })
  56. winners = append(winners, &LotteryUser{
  57. UserId: 3,
  58. Username: "明月清风",
  59. UserPhone: "18814098673",
  60. Avatar: "http://thirdwx.qlogo.cn/mmopen/vi_32/ZbibUK9Ywia2TtmQCxlyQPrxqKKzed1q4IWA5EUhMEgDiaKOnDODVrAvtKGE9qpFFZYoYfdsZrm63HKMKMA7on38A/132",
  61. PrizeName: "白银王座",
  62. LadderId: ladderId,
  63. PrizeImg: "http://thirdwx.qlogo.cn/mmopen/vi_32/U8krFYdib9PITkDicbaNPnJHKpUMJ8unribzyPcUKWKGyJovoKmES6UHW1Zl6bVsUUtmFjyzsUTrajAJ53icZpEcgw/132",
  64. })
  65. winners = append(winners, &LotteryUser{
  66. UserId: 4,
  67. Username: "Liujw",
  68. UserPhone: "18814098672",
  69. Avatar: "http://thirdwx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCO4qnL4BtyfjDQHhYmU8MgUZK11cABc8KFY7oenQYNErtm0n2ibfFB4QkFXfT3tVNMGqibDb3Oib30Q/132",
  70. PrizeName: "青铜王座",
  71. LadderId: ladderId,
  72. PrizeImg: "http://thirdwx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCO4qnL4BtyfjDQHhYmU8MgUZK11cABc8KFY7oenQYNErtm0n2ibfFB4QkFXfT3tVNMGqibDb3Oib30Q/132",
  73. })
  74. im_service.SendGroupCustomMessage("admin", activityId, im_service.NoticeStatus(notice),
  75. map[string]interface{}{
  76. "lottery_draw_ladder_id": ladderId,
  77. "winners": winners,
  78. "timestamp": time.Now().Unix(),
  79. "desc": desc,
  80. })
  81. } else {
  82. im_service.SendGroupCustomMessage("admin", activityId, im_service.NoticeStatus(notice),
  83. map[string]interface{}{
  84. "lottery_draw_ladder_id": ladderId,
  85. "timestamp": time.Now().Unix(),
  86. "desc": desc,
  87. })
  88. }
  89. t.SUCCESS("恭喜这B")
  90. }