黄梓健 5 years ago
parent
commit
ecfd3f20b1
  1. 2
      controllers/client/sign.go
  2. 16
      controllers/common/im.go
  3. 4
      go.mod
  4. 4
      go.sum
  5. 14
      test/pay_test.go

2
controllers/client/sign.go

@ -58,7 +58,7 @@ func (t *SignCtl) CheckSign() {
activity := models.Activity{}
exist, err := models.Get(&activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "主活动不存在")
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "动不存在")
customer := models.Customer{}
exist, err = models.Get(&customer, activity.CustomerId)

16
controllers/common/im.go

@ -2,6 +2,7 @@ package common
import (
"hudongzhuanjia/controllers"
im_service "hudongzhuanjia/services/im"
pay_service "hudongzhuanjia/services/pay"
)
@ -16,3 +17,18 @@ func (t *ImTestCtl) SendRB() {
t.CheckErr(err)
t.JSON(res)
}
func (t *ImTestCtl) Refund() {
outTradeNo := t.MustGet("out_trade_no")
res, err := pay_service.Refund("退款", outTradeNo)
t.CheckErr(err)
t.JSON(res)
}
func (t *ImTestCtl) Send() {
err := im_service.SendGroupCustomMessage("admin", t.MustGetInt64("activity_id"),
im_service.NoticeStatus(t.MustGetInt("type")), map[string]interface{}{
"content": "测试",
})
t.CheckErr(err)
t.SUCCESS("成功")
}

4
go.mod

@ -5,7 +5,7 @@ go 1.12
require (
github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.1
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect
github.com/aws/aws-sdk-go v1.32.3 // indirect
github.com/aws/aws-sdk-go v1.32.4 // indirect
github.com/chanxuehong/wechat v0.0.0-20200409104612-0a1fd76d7a3a
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
@ -25,7 +25,7 @@ require (
github.com/panjf2000/ants v4.0.2+incompatible
github.com/pkg/errors v0.9.1
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24
github.com/skip2/go-qrcode v0.0.0-20200526175731-7ac0b40b2038
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/smartystreets/goconvey v1.6.4
github.com/swaggo/http-swagger v0.0.0-20190614090009-c2865af9083e // indirect
github.com/swaggo/swag v1.6.3 // indirect

4
go.sum

@ -49,6 +49,8 @@ github.com/aws/aws-sdk-go v1.32.0 h1:P38SNbJIasEcA9gAlz/AG309VvhNv2CfNIJXQ61Oh6I
github.com/aws/aws-sdk-go v1.32.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.32.3 h1:E3OciOGVlJrv1gQ2T7/Oou+I9nGPB2j978THQjvZBf0=
github.com/aws/aws-sdk-go v1.32.3/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.32.4 h1:J2OMvipVB5dPIn+VH7L5rOqM4WoTsBxOqv+I06sjYOM=
github.com/aws/aws-sdk-go v1.32.4/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c=
github.com/bndr/gotabulate v1.1.2/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U=
@ -301,6 +303,8 @@ github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086 h1:RYiqpb2ii2Z6J4x
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
github.com/skip2/go-qrcode v0.0.0-20200526175731-7ac0b40b2038 h1:YV7j5thtTo5/Len66qC+EHMFBH4JZXO3rZ1I4ogb3HM=
github.com/skip2/go-qrcode v0.0.0-20200526175731-7ac0b40b2038/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=

14
test/pay_test.go

@ -144,3 +144,17 @@ func TestLogger(t *testing.T) {
}
}
}
func TestSendGroupMessage(t *testing.T) {
err := im_service.SendGroupCustomMessage("admin", 314, im_service.NoticeLotteryDrawRollStart,
map[string]interface{}{
"lottery_draw_ladder_id": 1,
"timestamp": time.Now().Unix(),
"roll_num": 1,
"desc": "开始滚动",
"number": 1,
})
if err != nil {
t.Error(err)
}
}
Loading…
Cancel
Save