|
@@ -1,58 +0,0 @@
|
|
-package test
|
|
|
|
-
|
|
|
|
-import (
|
|
|
|
- "context"
|
|
|
|
- "log"
|
|
|
|
- "testing"
|
|
|
|
- "time"
|
|
|
|
-
|
|
|
|
- "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
|
- ordercenterclient "bp.jydev.jianyu360.cn/BaseService/orderCenter/rpc/ordercenter"
|
|
|
|
- "bp.jydev.jianyu360.cn/BaseService/orderCenter/rpc/pb"
|
|
|
|
- "github.com/zeromicro/go-zero/zrpc"
|
|
|
|
-
|
|
|
|
- "github.com/zeromicro/go-zero/core/conf"
|
|
|
|
-)
|
|
|
|
-
|
|
|
|
-type Config struct {
|
|
|
|
- FileSystemConf zrpc.RpcClientConf
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-var c Config
|
|
|
|
-
|
|
|
|
-func init() {
|
|
|
|
- conf.MustLoad("ordercenter.yaml", &c)
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// go test -v -run Test_GetOrderCode
|
|
|
|
-func Test_GetOrderCode(t *testing.T) {
|
|
|
|
- ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
|
|
|
|
- FileSystem := ordercenterclient.NewOrderCenter(zrpc.MustNewClient(c.FileSystemConf))
|
|
|
|
- req := &pb.GetOrderCodeReq{
|
|
|
|
- Appid: "10000",
|
|
|
|
- }
|
|
|
|
- res, err := FileSystem.GetOrderCode(ctx, req)
|
|
|
|
- log.Println("err ", err)
|
|
|
|
- log.Println("res:", res)
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// go test -v -run Test_OrderList
|
|
|
|
-func Test_OrderList(t *testing.T) {
|
|
|
|
- ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
|
|
|
|
- FileSystem := ordercenterclient.NewOrderCenter(zrpc.MustNewClient(c.FileSystemConf))
|
|
|
|
- user_id := encrypt.SE.Encode2Hex("47700")
|
|
|
|
- log.Println("user_id=", user_id)
|
|
|
|
- req := &pb.OrderListReq{
|
|
|
|
- Appid: "10000",
|
|
|
|
- UserId: "",
|
|
|
|
- NewUserId: 0,
|
|
|
|
- NewUserIds: user_id,
|
|
|
|
- PageNum: 1,
|
|
|
|
- PageSize: 10,
|
|
|
|
- }
|
|
|
|
- res, err := FileSystem.OrderList(ctx, req)
|
|
|
|
- log.Println("err ", err)
|
|
|
|
- log.Println("res:", res.Data)
|
|
|
|
- log.Println("res:", res.Data.Count)
|
|
|
|
- log.Println("res:", len(res.Data.OrderList))
|
|
|
|
-}
|
|
|