by Robin at 20240511

This commit is contained in:
Leufolium 2024-05-11 10:22:32 +08:00
parent 5c0057d98f
commit 2c9e1cdb91
3 changed files with 7 additions and 51 deletions

View File

@ -0,0 +1,4 @@
package dao
type ElasticSearch struct {
}

View File

@ -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{

View File

@ -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),