diff --git a/app/mix/dao/elasticsearch.go b/app/mix/dao/elasticsearch.go new file mode 100644 index 00000000..59e6464d --- /dev/null +++ b/app/mix/dao/elasticsearch.go @@ -0,0 +1,4 @@ +package dao + +type ElasticSearch struct { +} diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index c9e10bca..d3cb28c2 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -443,52 +443,6 @@ func (s *Service) ApiGetAccountListByUserId(ctx *gin.Context, req *accountproto. return } -// func (s *Service) ApiGetAccountListFuzzilyByUserId(ctx *gin.Context, req *accountproto.ApiListFuzzilyByUserIdReq) (volist []*accountproto.ApiListVO, ec errcode.ErrCode) { -// ec = errcode.ErrCodeAccountSrvOk -// list, err := _DefaultAccount.OpListFuzzilyByUserId(ctx, &accountproto.OpListFuzzilyByUserIdReq{ -// UserId: req.UserId, -// Role: req.Role, -// Offset: req.Offset, -// Limit: req.Limit, -// Sort: req.Sort, -// }) -// if err != nil { -// logger.Error("OpListFuzzilyByUserId fail, err: %v", err) -// ec = errcode.ErrCodeAccountSrvFail -// return -// } - -// volist = make([]*accountproto.ApiListVO, len(list)) -// for i, account := range list { -// volist[i] = &accountproto.ApiListVO{} -// volist[i].CopyAccount(account) -// } -// return -// } - -// func (s *Service) ApiGetAccountListFuzzilyByName(ctx *gin.Context, req *accountproto.ApiListFuzzilyByNameReq) (volist []*accountproto.ApiListVO, ec errcode.ErrCode) { -// ec = errcode.ErrCodeAccountSrvOk -// list, err := _DefaultAccount.OpListFuzzilyByName(ctx, &accountproto.OpListFuzzilyByNameReq{ -// Name: req.Name, -// Role: req.Role, -// Offset: req.Offset, -// Limit: req.Limit, -// Sort: req.Sort, -// }) -// if err != nil { -// logger.Error("OpListFuzzilyByName fail, err: %v", err) -// ec = errcode.ErrCodeAccountSrvFail -// return -// } - -// volist = make([]*accountproto.ApiListVO, len(list)) -// for i, account := range list { -// volist[i] = &accountproto.ApiListVO{} -// volist[i].CopyAccount(account) -// } -// return -// } - func (s *Service) ApiGetAccountListForOthersByMid(ctx *gin.Context, req *accountproto.ApiListOthersByMidReq) (vo *accountproto.ApiListOthersVO, ec errcode.ErrCode) { ec = errcode.ErrCodeAccountSrvOk account, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{ diff --git a/library/elastic_search/client.go b/library/elasticsearchdb/client.go similarity index 66% rename from library/elastic_search/client.go rename to library/elasticsearchdb/client.go index f0eaaf86..f93f850b 100644 --- a/library/elastic_search/client.go +++ b/library/elasticsearchdb/client.go @@ -1,4 +1,4 @@ -package elasticsearch +package elasticsearchdb import ( "service/bizcommon/util" @@ -8,10 +8,8 @@ import ( "github.com/olivere/elastic/v7" ) -var defaultElasticSearchClient *elastic.Client - -func Init(cfg *configcenter.ElasticSearchConfig) (err error) { - defaultElasticSearchClient, err = elastic.NewClient( +func Init(cfg *configcenter.ElasticSearchConfig) (client *elastic.Client, err error) { + client, err = elastic.NewClient( elastic.SetURL(cfg.Uri), elastic.SetSniff(cfg.Sniff), elastic.SetBasicAuth(cfg.Username, cfg.Password),