package logic import ( elastic "app.yhyue.com/moapp/jybase/esv1" "app.yhyue.com/moapp/jybase/mongodb" "app.yhyue.com/moapp/jybase/mysql" "app.yhyue.com/moapp/jybase/redis" "context" "github.com/zeromicro/go-zero/core/logx" "jyBXSubscribe/entity" IC "jyBXSubscribe/rpc/init" "jyBXSubscribe/rpc/internal/config" "jyBXSubscribe/rpc/internal/svc" "jyBXSubscribe/rpc/type/bxsubscribe" "log" "reflect" "strings" "testing" ) func init() { logx.Info("--初始化 mongodb--") IC.Mgo = mongodb.MongodbSim{ MongodbAddr: "192.168.3.206:27080", Size: 5, DbName: "qfw", } IC.Mgo.InitPool() IC.DB = config.Db{Mongo: entity.Mongo{ Bidding: &entity.MongoStruct{ Collection: "bidding", CollectionBack: "bidding_back", }, }} IC.DB.Mongo.Bidding.Collection = "bidding_back" // logx.Info("--初始化 mongodb bidding--") IC.MgoBidding = mongodb.MongodbSim{ MongodbAddr: "192.168.3.206:27001", Size: 5, DbName: "qfw_data", UserName: "jyDevGroup", Password: "jy@DevGroup", } IC.MgoBidding.InitPool() logx.Info("--初始化 mysql--") IC.MainMysql = &mysql.Mysql{ Address: "192.168.3.11:3366", UserName: "root", PassWord: "Topnet123", DBName: "jianyu", MaxOpenConns: 5, MaxIdleConns: 5, } IC.MainMysql.Init() //初始化 mysql-EntnichePush logx.Info("--初始化 商机管理推送 mysql--") IC.BaseServiceMysql = &mysql.Mysql{ Address: "192.168.3.217:4000", UserName: "root", PassWord: "=PDT49#80Z!RVv52_z", DBName: "base_service", MaxOpenConns: 5, MaxIdleConns: 5, } IC.BaseServiceMysql.Init() logx.Info("--初始化 redis--") redis.InitRedisBySize(strings.Join([]string{"other=192.168.3.206:1712", "push=192.168.3.206:1712", "pushcache_1=192.168.3.206:5000", "pushcache_2_a=192.168.3.206:5001", "pushcache_2_b=192.168.3.206:5002"}, ","), 100, 30, 300) //初始化 elasticsearch logx.Info("--初始化 elasticsearch--") elastic.InitElasticSize("http://192.168.3.206:9800", 5) } func TestGetSubListLogic_GetSubList(t *testing.T) { type fields struct { ctx context.Context svcCtx *svc.ServiceContext Logger logx.Logger } type args struct { in *bxsubscribe.SubscribeInfosReq } tests := []struct { name string fields fields args args want *bxsubscribe.SubscribeInfosResp wantErr bool }{ // TODO: Add test cases. { name: "推送记录查看", fields: fields{}, args: args{ in: &bxsubscribe.SubscribeInfosReq{ PageNum: 1, PageSize: 20, SelectTime: "", Area: "", City: "", Industry: "", BuyerClass: "", KeyWords: "", Subtype: "", UserType: "mType", UserId: "5e8eb60ae138234b4f91aacf", EntId: "1111", AppId: "10000", Price: "", FileExists: "", EntUserId: "", DeptId: "1111", NewUserId: 11111, }, }, want: nil, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { l := &GetSubListLogic{ ctx: tt.fields.ctx, svcCtx: tt.fields.svcCtx, Logger: tt.fields.Logger, } got, err := l.GetSubList(tt.args.in) log.Println(got) if (err != nil) != tt.wantErr { t.Errorf("GetSubList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetSubList() got = %v, want %v", got, tt.want) } }) } }