1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package test
- import (
- "app.yhyue.com/moapp/jyMarketing/rpc/activity"
- "app.yhyue.com/moapp/jyMarketing/rpc/activityclient"
- "app.yhyue.com/moapp/jyMarketing/rpc/internal/config"
- "context"
- "flag"
- "github.com/tal-tech/go-zero/core/conf"
- "github.com/tal-tech/go-zero/zrpc"
- "log"
- "testing"
- "time"
- )
- var configFile = flag.String("f", "activity.yaml", "the config file")
- var c config.Config
- func init() {
- conf.MustLoad(*configFile, &c)
- }
- //活动下的奖券
- func Test_activityLottery(t *testing.T) {
- ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
- FileSystem :=activityclient.NewActivity(zrpc.MustNewClient(c.FileSystemConf))
- req := &activity.Request{UserId: "ABC", AppId: "123",ActivityId:1}
- res, err := FileSystem.ActivityLottery(ctx, req)
- log.Println("err ", err)
- log.Println("req ", res)
- }
- //奖券领取
- func Test_lotteryReceive(t *testing.T) {
- ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
- FileSystem :=activityclient.NewActivity(zrpc.MustNewClient(c.FileSystemConf))
- lotteryIdArr:=[]int64{2}
- req := &activity.LotteryOperation{UserId: "ABC", AppId: "123",LotteryIdArr:lotteryIdArr}
- res, err := FileSystem.LotteryReceive(ctx, req)
- log.Println("err ", err)
- log.Println("req ", res)
- }
- //用户下的奖券
- func Test_UserLottery(t *testing.T) {
- ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
- FileSystem :=activityclient.NewActivity(zrpc.MustNewClient(c.FileSystemConf))
- req := &activity.Request{UserId: "ABC", AppId: "123"}
- res, err := FileSystem.UserLottery(ctx, req)
- log.Println("err ", err)
- log.Println("req ", res)
- }
- //奖券使用
- func Test_ActivityUse(t *testing.T) {
- ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
- FileSystem :=activityclient.NewActivity(zrpc.MustNewClient(c.FileSystemConf))
- lotteryIdArr:=[]int64{2}
- req := &activity.LotteryOperation{UserId: "ABC", AppId: "123",LotteryIdArr:lotteryIdArr}
- res, err := FileSystem.ActivityUse(ctx, req)
- log.Println("err ", err)
- log.Println("req ", res)
- }
|