123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- 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()
- //初始化 mysql-GlobalCommonData
- logx.Info("--初始化 推送 mysql--")
- IC.GlobalCommonData = &mysql.Mysql{
- Address: "192.168.3.217:4000",
- UserName: "root",
- PassWord: "=PDT49#80Z!RVv52_z",
- DBName: "global_common_data",
- MaxOpenConns: 5,
- MaxIdleConns: 5,
- }
- IC.GlobalCommonData.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)
- //IC.PushMapping.Init(IC.GlobalCommonData)
- }
- 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: "",
- BuyerClass: "人大,政协,党委办,组织,宣传,统战,纪委,政府办,发改委,财政,教育,科技,工信,民政,民宗,人社,公安,检察院,法院,司法,应急管理,军队,自然资源,生态环境,住建,市政,城管,交通,水利,农业,气象,文旅,卫健委,医疗,学校,档案,体育,政务中心,机关事务,国资委,海关,税务,市场监管,商务,人行,银保监,证监,审计,出版广电,统计,公共资源交易,社会团体",
- Subtype: "",
- KeyWords: "",
- Industry: "",
- UserType: "mType",
- UserId: "5e8eb60ae138234b4f91aacf",
- EntId: "1111",
- AppId: "10000",
- Price: "",
- FileExists: "",
- EntUserId: "",
- DeptId: "1111",
- NewUserId: 72668,
- },
- },
- 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)
- }
- })
- }
- }
|