Browse Source

feat: send notice to im

master
黄梓健 5 years ago
parent
commit
235c2e82e1
  1. 3
      controllers/client/good.go
  2. 2
      go.mod
  3. 9
      main.go
  4. 4
      services/im/im.go
  5. 6
      test/pay_test.go

3
controllers/client/good.go

@ -216,9 +216,6 @@ func (t *GoodCtl) Order() {
Phone: param.Phone,
IsDrawCash: 0,
Postage: option.PostFee,
CancelTime: define.DefaultTime,
AutoReceiveTime: define.DefaultTime,
}
_, err = session.InsertOne(&order)
if err != nil {

2
go.mod

@ -11,7 +11,7 @@ require (
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect
github.com/go-chi/chi v4.1.0+incompatible // indirect
github.com/go-chi/chi v4.1.0+incompatible
github.com/go-errors/errors v1.0.2 // indirect
github.com/go-redis/redis v6.15.7+incompatible // indirect
github.com/golang/snappy v0.0.1 // indirect

9
main.go

@ -6,9 +6,11 @@ import (
"hudongzhuanjia/controllers/client"
"hudongzhuanjia/controllers/common"
"hudongzhuanjia/controllers/pc"
//_ "net/http/pprof"
)
func main() {
// pc
core.GetInstanceRouterManage().Registered(new(pc.WsCtl)) // 用户
core.GetInstanceRouterManage().Registered(new(pc.UserCtl)) // 用户
@ -52,5 +54,12 @@ func main() {
core.GetInstanceRouterManage().Registered(new(common.AnnexCtl))
core.GetInstanceRouterManage().Registered(new(common.WeChatOauthCtl))
//r := osmanthuswine.GetChiRouter()
//r.HandleFunc("/debug/pprof/", pprof.Index)
//r.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
//r.HandleFunc("/debug/pprof/profile", pprof.Profile)
//r.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
//r.HandleFunc("/debug/pprof/trace", pprof.Trace)
osmanthuswine.Run()
}

4
services/im/im.go

@ -2,6 +2,7 @@ package im_service
import (
"errors"
"fmt"
"hudongzhuanjia/libs/im"
"hudongzhuanjia/models"
)
@ -15,5 +16,6 @@ func SendNoticeByActivityId(activityId int64, _type im.NoticeStatus, data map[st
if !exist {
return errors.New("直播信息不存在")
}
return im.SendGroupSystemNotification(live.ImGroupId, _type, data, members...)
groupId := fmt.Sprintf("%v%d%d", live.LiveRoomId, live.Id, live.ActivityId)
return im.SendGroupSystemNotification(groupId, _type, data, members...)
}

6
test/pay_test.go

@ -3,7 +3,9 @@ package test
import (
"fmt"
"github.com/chanxuehong/wechat/mch/core"
"hudongzhuanjia/libs/im"
"hudongzhuanjia/logger"
im_service "hudongzhuanjia/services/im"
pay_service "hudongzhuanjia/services/pay"
"math"
"testing"
@ -50,7 +52,9 @@ func TestTimeExpire(t *testing.T) {
}
func TestSendNotice(t *testing.T) {
//im_service.SendNoticeByActivityId(91)
im_service.SendNoticeByActivityId(114, im.NoticeLiveRedPackStart, map[string]interface{}{
"nihao": "wojiaohuanxiao",
})
}
// 地球半径,单位米

Loading…
Cancel
Save