123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- 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"
- "jyBXBase/entity"
- "jyBXBase/rpc/bxbase"
- IC "jyBXBase/rpc/init"
- "jyBXBase/rpc/internal/config"
- "jyBXBase/rpc/internal/svc"
- "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 TestNewestBiddingLogic_NewestBidding(t *testing.T) {
- type fields struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- Logger logx.Logger
- }
- type args struct {
- in *bxbase.NewestBiddingReq
- }
- tests := []struct {
- name string
- fields fields
- args args
- want *bxbase.NewsetBiddingResp
- wantErr bool
- }{
- // TODO: Add test cases.
- {name: "app首页数据",
- args: args{
- in: &bxbase.NewestBiddingReq{
- City: "",
- IsSearch: 0,
- UserId: "5e8eb60ae138234b4f91aacf",
- AppId: "10000",
- EntUserId: "",
- },
- }},
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- l := &NewestBiddingLogic{
- ctx: tt.fields.ctx,
- svcCtx: tt.fields.svcCtx,
- Logger: tt.fields.Logger,
- }
- got, err := l.NewestBidding(tt.args.in)
- if (err != nil) != tt.wantErr {
- t.Errorf("NewestBidding() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("NewestBidding() got = %v, want %v", got, tt.want)
- }
- })
- }
- }
|