Browse Source

Merge branch 'release/v4.8.39' of https://jygit.jydev.jianyu360.cn/qmx/jy into dev/v4.8.39_wmh

wenmenghao321 2 years ago
parent
commit
8766b5a366

+ 2 - 2
src/jfw/front/classificationTag.go

@@ -73,12 +73,12 @@ func GetWinnerInfo() (data []BuyerList) {
 	from := randGen.Intn(100)
 	from := randGen.Intn(100)
 
 
 	//关联中标企业
 	//关联中标企业
-	r := elastic.Get("winner", "winner", fmt.Sprintf(`{"query": {"bool": {"must": []}},"_source": ["_id","name"],"from": %d,"size": 200}`, from))
+	r := elastic.Get("qyxy", "qyxy", fmt.Sprintf(`{"query": {"bool": {"must": []}},"_source": ["_id","company_name"],"from": %d,"size": 200}`, from))
 	if r != nil {
 	if r != nil {
 		for _, v := range *r {
 		for _, v := range *r {
 			var vs BuyerList
 			var vs BuyerList
 			id := encrypt.EncodeArticleId2ByCheck(qu.InterfaceToStr(v["_id"]))
 			id := encrypt.EncodeArticleId2ByCheck(qu.InterfaceToStr(v["_id"]))
-			vs.Name = qu.InterfaceToStr(v["name"])
+			vs.Name = qu.InterfaceToStr(v["company_name"])
 			vs.Url = fmt.Sprintf("/swordfish/page_big_pc/ent_portrait/%s", id)
 			vs.Url = fmt.Sprintf("/swordfish/page_big_pc/ent_portrait/%s", id)
 			data = append(data, vs)
 			data = append(data, vs)
 		}
 		}

+ 3 - 1
src/jfw/modules/bigmember/src/entity/portrait.go

@@ -125,13 +125,15 @@ func NoLoginAssociatedInfo(entId string) []map[string]interface{} {
 		randGen := rand.New(rand.NewSource(time.Now().UnixNano()))
 		randGen := rand.New(rand.NewSource(time.Now().UnixNano()))
 		from := randGen.Intn(100)
 		from := randGen.Intn(100)
 		//关联中标企业
 		//关联中标企业
-		r := es.Get("winner", "winner", fmt.Sprintf(`{"query": {"bool": {"must": [{"query_string": {"default_field": "city","query": "%s*"}}]}},"_source": ["_id","name"],"from": %d,"size": 30}`, qutil.InterfaceToStr((*entinfo)["company_area"]), from))
+		r := es.Get("qyxy", "qyxy", fmt.Sprintf(`{"query": {"bool": {"must": [{"query_string": {"default_field": "company_area","query": "%s*"}}]}},"_source": ["_id","company_name"],"from": %d,"size": 30}`, qutil.InterfaceToStr((*entinfo)["company_area"]), from))
 		if r != nil {
 		if r != nil {
 			winnerData = *r
 			winnerData = *r
 		}
 		}
 
 
 		for _, v := range winnerData {
 		for _, v := range winnerData {
 			v["_id"] = encrypt.EncodeArticleId2ByCheck(qutil.InterfaceToStr(v["_id"]))
 			v["_id"] = encrypt.EncodeArticleId2ByCheck(qutil.InterfaceToStr(v["_id"]))
+			v["name"] = qutil.InterfaceToStr(v["company_name"])
+			delete(v, "company_name")
 		}
 		}
 	}
 	}
 	return winnerData
 	return winnerData

+ 485 - 486
src/jfw/modules/bigmember/src/service/portrait/subvipPortraitAction.go

@@ -1,557 +1,556 @@
 package portrait
 package portrait
 
 
 import (
 import (
-    "app.yhyue.com/moapp/jybase/redis"
-    "encoding/json"
-    "errors"
-    "fmt"
-    "jy/src/jfw/modules/bigmember/src/config"
-    "jy/src/jfw/modules/bigmember/src/db"
-    "jy/src/jfw/modules/bigmember/src/entity"
-    "jy/src/jfw/modules/bigmember/src/util"
-    "log"
-    "strings"
-    "time"
+	"app.yhyue.com/moapp/jybase/redis"
+	"encoding/json"
+	"errors"
+	"fmt"
+	"jy/src/jfw/modules/bigmember/src/config"
+	"jy/src/jfw/modules/bigmember/src/db"
+	"jy/src/jfw/modules/bigmember/src/entity"
+	"jy/src/jfw/modules/bigmember/src/util"
+	"log"
+	"strings"
+	"time"
 
 
-    . "app.yhyue.com/moapp/jybase/api"
-    qutil "app.yhyue.com/moapp/jybase/common"
-    . "app.yhyue.com/moapp/jybase/date"
-    elastic "app.yhyue.com/moapp/jybase/es"
-    "app.yhyue.com/moapp/jybase/go-xweb/xweb"
-    "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	. "app.yhyue.com/moapp/jybase/api"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	. "app.yhyue.com/moapp/jybase/date"
+	elastic "app.yhyue.com/moapp/jybase/es"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 )
 
 
 // SubVipPortrait 超级订阅升级版画像接口
 // SubVipPortrait 超级订阅升级版画像接口
 type SubVipPortrait struct {
 type SubVipPortrait struct {
-    *xweb.Action
-    portraitUsage  xweb.Mapper `xweb:"/portrait/subVipPortrait/usage"`  //超级订阅升级版画像浏览详情
-    portraitRecord xweb.Mapper `xweb:"/portrait/subVipPortrait/record"` //超级订阅升级版画像浏览记录
+	*xweb.Action
+	portraitUsage  xweb.Mapper `xweb:"/portrait/subVipPortrait/usage"`  //超级订阅升级版画像浏览详情
+	portraitRecord xweb.Mapper `xweb:"/portrait/subVipPortrait/record"` //超级订阅升级版画像浏览记录
 
 
-    subVipEntDetail     xweb.Mapper `xweb:"/portrait/subVipPortrait/entDetail"`          //企业基本信息
-    subVipPortrait      xweb.Mapper `xweb:"/portrait/subVipPortrait/winner"`             //超级订阅升级版查看画像
-    subVipWinnerNewMsg  xweb.Mapper `xweb:"/portrait/subVipPortrait/winnerNewMsg"`       //超级订阅升级版查看最新项目动态
-    winnerNewMsgExport  xweb.Mapper `xweb:"/portrait/subVipPortrait/winnerNewMsgExport"` //最新项目动态数据导出
-    subVipNewMsgSelects xweb.Mapper `xweb:"/portrait/subVipPortrait/selects"`            //最新招标信息可筛选项
+	subVipEntDetail     xweb.Mapper `xweb:"/portrait/subVipPortrait/entDetail"`          //企业基本信息
+	subVipPortrait      xweb.Mapper `xweb:"/portrait/subVipPortrait/winner"`             //超级订阅升级版查看画像
+	subVipWinnerNewMsg  xweb.Mapper `xweb:"/portrait/subVipPortrait/winnerNewMsg"`       //超级订阅升级版查看最新项目动态
+	winnerNewMsgExport  xweb.Mapper `xweb:"/portrait/subVipPortrait/winnerNewMsgExport"` //最新项目动态数据导出
+	subVipNewMsgSelects xweb.Mapper `xweb:"/portrait/subVipPortrait/selects"`            //最新招标信息可筛选项
 
 
-    buyerContacts     xweb.Mapper `xweb:"/subVipPortrait/buyer/contacts"`        //采购项目联系方式
-    buyerSelects      xweb.Mapper `xweb:"/subVipPortrait/buyer/selects"`         //采购单位画像可筛选项
-    buyerNewMsg       xweb.Mapper `xweb:"/subVipPortrait/buyer/getNewMsg"`       //最新项目动态[筛选]
-    buyerNewMsgExport xweb.Mapper `xweb:"/subVipPortrait/buyer/getNewMsgExport"` //最新项目动态数据导出[筛选]
-    buyerPortrait     xweb.Mapper `xweb:"/subVipPortrait/buyer/getData"`         //采购单位画像数据[筛选]
+	buyerContacts     xweb.Mapper `xweb:"/subVipPortrait/buyer/contacts"`        //采购项目联系方式
+	buyerSelects      xweb.Mapper `xweb:"/subVipPortrait/buyer/selects"`         //采购单位画像可筛选项
+	buyerNewMsg       xweb.Mapper `xweb:"/subVipPortrait/buyer/getNewMsg"`       //最新项目动态[筛选]
+	buyerNewMsgExport xweb.Mapper `xweb:"/subVipPortrait/buyer/getNewMsgExport"` //最新项目动态数据导出[筛选]
+	buyerPortrait     xweb.Mapper `xweb:"/subVipPortrait/buyer/getData"`         //采购单位画像数据[筛选]
 }
 }
 
 
 // SubVipEntDetail 超级订阅升级版查询基本信息
 // SubVipEntDetail 超级订阅升级版查询基本信息
 func (this *SubVipPortrait) SubVipEntDetail() {
 func (this *SubVipPortrait) SubVipEntDetail() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        entId := util.DecodeId(this.GetString("entId"))
-        if entId == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        cepm, _, err, _ := entity.CreateSubVipPortraitManager(userId, "entDetail", entId, true, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        entInfo, err := cepm.GetEntInfo(entId)
-        if err != nil {
-            return nil, err
-        }
-        return entInfo, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s 企业画像-查询企业基本信息:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		entId := util.DecodeId(this.GetString("entId"))
+		if entId == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		cepm, _, err, _ := entity.CreateSubVipPortraitManager(userId, "entDetail", entId, true, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		entInfo, err := cepm.GetEntInfo(entId)
+		if err != nil {
+			return nil, err
+		}
+		return entInfo, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s 企业画像-查询企业基本信息:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // SubVipWinnerNewMsg 超级订阅升级版查看最新中标动态
 // SubVipWinnerNewMsg 超级订阅升级版查看最新中标动态
 func (this *SubVipPortrait) SubVipWinnerNewMsg() {
 func (this *SubVipPortrait) SubVipWinnerNewMsg() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        entId := util.DecodeId(this.GetString("entId"))
-        if entId == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        cepm, power, err, _ := entity.CreateSubVipPortraitManager(userId, "entNewMsg", entId, true, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        if power <= 1 {
-            return nil, errors.New("非法请求")
-        }
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		entId := util.DecodeId(this.GetString("entId"))
+		if entId == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		cepm, power, err, _ := entity.CreateSubVipPortraitManager(userId, "entNewMsg", entId, true, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		if power <= 1 {
+			return nil, errors.New("非法请求")
+		}
 
 
-        pageNum, _ := this.GetInteger("pageNum")
-        pageSize, _ := this.GetInteger("pageSize")
+		pageNum, _ := this.GetInteger("pageNum")
+		pageSize, _ := this.GetInteger("pageSize")
 
 
-        rData, total, err := cepm.GetWinnerNewMsg(&entity.PortraitProjectScreen{
-            Screen: &entity.PortraitScreen{
-                Ent:        entId,
-                Match:      this.GetString("match"),
-                ExactMatch: this.GetString("matchType") == "1",
-                MatchRange: this.GetString("matchRange"),
-                Area:       this.GetString("area"),
-                ScopeClass: this.GetString("scopeClass"),
-                TimeRange:  this.GetString("timeRange"),
-                HasPower:   true,
-            },
-            PageNum:  pageNum,
-            PageSize: pageSize,
-        })
-        if err != nil {
-            return nil, err
-        }
-        return map[string]interface{}{
-            "list":  rData,
-            "count": total,
-        }, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s SubVipPortrait-SubVipWinnerNewMsg 获取企业最新中标信息出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+		rData, total, err := cepm.GetWinnerNewMsg(&entity.PortraitProjectScreen{
+			Screen: &entity.PortraitScreen{
+				Ent:        entId,
+				Match:      this.GetString("match"),
+				ExactMatch: this.GetString("matchType") == "1",
+				MatchRange: this.GetString("matchRange"),
+				Area:       this.GetString("area"),
+				ScopeClass: this.GetString("scopeClass"),
+				TimeRange:  this.GetString("timeRange"),
+				HasPower:   true,
+			},
+			PageNum:  pageNum,
+			PageSize: pageSize,
+		})
+		if err != nil {
+			return nil, err
+		}
+		return map[string]interface{}{
+			"list":  rData,
+			"count": total,
+		}, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s SubVipPortrait-SubVipWinnerNewMsg 获取企业最新中标信息出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // WinnerNewMsgExport 超级订阅升级版查看最新中标动态数据导出
 // WinnerNewMsgExport 超级订阅升级版查看最新中标动态数据导出
 func (this *SubVipPortrait) WinnerNewMsgExport() {
 func (this *SubVipPortrait) WinnerNewMsgExport() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        entId := util.DecodeId(this.GetString("entId"))
-        if entId == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        cepm, power, err, free := entity.CreateSubVipPortraitManager(userId, "entNewMsg", entId, true, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        if power <= 1 {
-            return nil, errors.New("非法请求")
-        }
-        //查询数据导出数据id列
-        pps := &entity.PortraitProjectScreen{
-            Screen: &entity.PortraitScreen{
-                Ent:        entId,
-                Match:      this.GetString("match"),
-                ExactMatch: this.GetString("exactMatch") == "1",
-                MatchRange: this.GetString("matchRange"),
-                Area:       this.GetString("area"),
-                ScopeClass: this.GetString("scopeClass"),
-                TimeRange:  this.GetString("timeRange"),
-                HasPower:   true,
-            },
-            IsExport: true,
-            Free:     free,
-        }
-        ids := getSelectIds(this.GetString("selectIds"))
-        if ids == nil || len(ids) == 0 {
-            ids, err = cepm.GetWinnerNewExport(pps)
-            if err != nil {
-                return nil, err
-            }
-        } else {
-            pps.CommonPare(true)
-        }
-        _id, err := cepm.SaveExportRecord(pps, ids, entId, "winnerPortrait")
-        if err != nil {
-            return nil, err
-        }
-        return _id, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s SubVipPortrait-WinnerNewMsgExport 获取企业最新中标信息出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		entId := util.DecodeId(this.GetString("entId"))
+		if entId == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		cepm, power, err, free := entity.CreateSubVipPortraitManager(userId, "entNewMsg", entId, true, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		if power <= 1 {
+			return nil, errors.New("非法请求")
+		}
+		//查询数据导出数据id列
+		pps := &entity.PortraitProjectScreen{
+			Screen: &entity.PortraitScreen{
+				Ent:        entId,
+				Match:      this.GetString("match"),
+				ExactMatch: this.GetString("exactMatch") == "1",
+				MatchRange: this.GetString("matchRange"),
+				Area:       this.GetString("area"),
+				ScopeClass: this.GetString("scopeClass"),
+				TimeRange:  this.GetString("timeRange"),
+				HasPower:   true,
+			},
+			IsExport: true,
+			Free:     free,
+		}
+		ids := getSelectIds(this.GetString("selectIds"))
+		if ids == nil || len(ids) == 0 {
+			ids, err = cepm.GetWinnerNewExport(pps)
+			if err != nil {
+				return nil, err
+			}
+		} else {
+			pps.CommonPare(true)
+		}
+		_id, err := cepm.SaveExportRecord(pps, ids, entId, "winnerPortrait")
+		if err != nil {
+			return nil, err
+		}
+		return _id, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s SubVipPortrait-WinnerNewMsgExport 获取企业最新中标信息出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // SubVipNewMsgSelects 获取画像可筛选项
 // SubVipNewMsgSelects 获取画像可筛选项
 func (this *SubVipPortrait) SubVipNewMsgSelects() {
 func (this *SubVipPortrait) SubVipNewMsgSelects() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        entId := util.DecodeId(this.GetString("entId"))
-        if entId == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        _, _, err, _ := entity.CreateSubVipPortraitManager(userId, "entNewMsg", entId, true, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        pwp := &entity.PortraitScreen{Ent: entId}
-        return pwp.GetProjectSelectItems(true)
-    }()
-    if errMsg != nil {
-        log.Printf("%s SubVipNewMsgSelects 获取企业最新中标信息筛选条件出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		entId := util.DecodeId(this.GetString("entId"))
+		if entId == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		_, _, err, _ := entity.CreateSubVipPortraitManager(userId, "entNewMsg", entId, true, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		pwp := &entity.PortraitScreen{Ent: entId}
+		return pwp.GetProjectSelectItems(true)
+	}()
+	if errMsg != nil {
+		log.Printf("%s SubVipNewMsgSelects 获取企业最新中标信息筛选条件出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // SubVipPortrait 超级订阅升级版查看企业画像
 // SubVipPortrait 超级订阅升级版查看企业画像
 func (this *SubVipPortrait) SubVipPortrait() {
 func (this *SubVipPortrait) SubVipPortrait() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        entId := util.DecodeId(this.GetString("entId"))
-        if entId == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        cepm, power, err, _ := entity.CreateSubVipPortraitManager(userId, "entPortrait", entId, true, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        rData, err := cepm.WinnerPortraitData(&entity.PortraitScreen{
-            Ent:        entId,
-            Match:      this.GetString("match"),
-            ExactMatch: this.GetString("exactMatch") == "1",
-            MatchRange: this.GetString("matchRange"),
-            Area:       this.GetString("area"),
-            ScopeClass: this.GetString("scopeClass"),
-            TimeRange:  this.GetString("timeRange"),
-            HasPower:   power > 1,
-        })
-        if power == 3 {
-            rData["onTrial"] = true
-        }
-        return rData, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s SubVipPortrait 获取企业画像标信息出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		entId := util.DecodeId(this.GetString("entId"))
+		if entId == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		cepm, power, err, _ := entity.CreateSubVipPortraitManager(userId, "entPortrait", entId, true, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		rData, err := cepm.WinnerPortraitData(&entity.PortraitScreen{
+			Ent:        entId,
+			Match:      this.GetString("match"),
+			ExactMatch: this.GetString("exactMatch") == "1",
+			MatchRange: this.GetString("matchRange"),
+			Area:       this.GetString("area"),
+			ScopeClass: this.GetString("scopeClass"),
+			TimeRange:  this.GetString("timeRange"),
+			HasPower:   power > 1,
+		})
+		if power == 3 {
+			rData["onTrial"] = true
+		}
+		return rData, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s SubVipPortrait 获取企业画像标信息出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // PortraitUsage 超级订阅升级版画像浏览量查询
 // PortraitUsage 超级订阅升级版画像浏览量查询
 func (this *SubVipPortrait) PortraitUsage() {
 func (this *SubVipPortrait) PortraitUsage() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        bigMsg := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
-        if bigMsg.VipStatus <= 0 || bigMsg.Vip_BuySet.Upgrade != 1 {
-            return nil, fmt.Errorf("非法请求")
-        }
-        isWinner, queryEnt := this.GetString("p_type") != "1", ""
-        if isWinner {
-            queryEnt = util.DecodeId(this.GetString("entId"))
-        } else {
-            queryEnt = this.GetString("buyer")
-        }
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		bigMsg := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
+		if bigMsg.VipStatus <= 0 || bigMsg.Vip_BuySet.Upgrade != 1 {
+			return nil, fmt.Errorf("非法请求")
+		}
+		isWinner, queryEnt := this.GetString("p_type") != "1", ""
+		if isWinner {
+			queryEnt = util.DecodeId(this.GetString("entId"))
+		} else {
+			queryEnt = this.GetString("buyer")
+		}
 
 
-        vipTotal, vipSurplus, packSurplus, isUsed := bigMsg.NewSubVipPortrait(db.Mysql, queryEnt, isWinner).AccountStatus()
-        returnMap := map[string]interface{}{
-            "total":   vipTotal, //超级订阅数量+流量包数量
-            "balance": vipSurplus + packSurplus,
-            "usage":   vipTotal - (vipSurplus + packSurplus),
-            "provin":  bigMsg.Vip_BuySet.AreaCount,
-        }
-        if queryEnt != "" {
-            returnMap["visited"] = isUsed
-        }
-        return returnMap, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s SubVipPortrait-portraitUsage 企业画像浏览量查询出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+		vipTotal, vipSurplus, packSurplus, isUsed := bigMsg.NewSubVipPortrait(db.Mysql, queryEnt, isWinner).AccountStatus()
+		returnMap := map[string]interface{}{
+			"total":   vipTotal, //超级订阅数量+流量包数量
+			"balance": vipSurplus + packSurplus,
+			"usage":   vipTotal - (vipSurplus + packSurplus),
+			"provin":  bigMsg.Vip_BuySet.AreaCount,
+		}
+		if queryEnt != "" {
+			returnMap["visited"] = isUsed
+		}
+		return returnMap, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s SubVipPortrait-portraitUsage 企业画像浏览量查询出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // PortraitRecord 超级订阅升级版画像查看记录
 // PortraitRecord 超级订阅升级版画像查看记录
 func (this *SubVipPortrait) PortraitRecord() {
 func (this *SubVipPortrait) PortraitRecord() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        year, _ := this.GetInteger("year")
-        month, _ := this.GetInteger("month")
-        pageNum, _ := this.GetInteger("pageNum")
-        pageSize, _ := this.GetInteger("pageSize")
-        if year == 0 || month == 0 {
-            return nil, fmt.Errorf("请求参数异常")
-        }
-        queryDate := time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.Local)
-        if pageSize < 1 || pageSize > 50 {
-            pageSize = 50
-        }
-        bigMsg := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
-        if bigMsg.VipStatus <= 0 || bigMsg.Vip_BuySet.Upgrade != 1 {
-            return nil, fmt.Errorf("非法请求")
-        }
-        isWinner := this.GetString("p_type") != "1"
-        //获取画像企业id
-        recordList, total := bigMsg.NewSubVipPortrait(db.Mysql, "", isWinner).GetPortraitRecord(queryDate, pageNum, pageSize, pageNum == 0)
-        var infoList []map[string]interface{}
-        if isWinner { //企业画像
-            entDetailMap := getEntListMsg(recordList)
-            for _, eid := range recordList {
-                if entDetail, ok := entDetailMap[eid]; ok && entDetail != nil {
-                    entDetail["id"] = util.EncodeId(eid)
-                    infoList = append(infoList, entDetail)
-                }
-            }
-        } else { //采购单位画像
-            buyerDetailMap := getBuyerListMsg(recordList)
-            for _, buyerName := range recordList {
-                if buyerDetail, ok := buyerDetailMap[buyerName]; ok && buyerDetail != nil {
-                    infoList = append(infoList, buyerDetail)
-                } else {
-                    infoList = append(infoList, map[string]interface{}{"name": buyerName})
-                }
-            }
-        }
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		year, _ := this.GetInteger("year")
+		month, _ := this.GetInteger("month")
+		pageNum, _ := this.GetInteger("pageNum")
+		pageSize, _ := this.GetInteger("pageSize")
+		if year == 0 || month == 0 {
+			return nil, fmt.Errorf("请求参数异常")
+		}
+		queryDate := time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.Local)
+		if pageSize < 1 || pageSize > 50 {
+			pageSize = 50
+		}
+		bigMsg := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
+		if bigMsg.VipStatus <= 0 || bigMsg.Vip_BuySet.Upgrade != 1 {
+			return nil, fmt.Errorf("非法请求")
+		}
+		isWinner := this.GetString("p_type") != "1"
+		//获取画像企业id
+		recordList, total := bigMsg.NewSubVipPortrait(db.Mysql, "", isWinner).GetPortraitRecord(queryDate, pageNum, pageSize, pageNum == 0)
+		var infoList []map[string]interface{}
+		if isWinner { //企业画像
+			entDetailMap := getEntListMsg(recordList)
+			for _, eid := range recordList {
+				if entDetail, ok := entDetailMap[eid]; ok && entDetail != nil {
+					entDetail["id"] = util.EncodeId(eid)
+					infoList = append(infoList, entDetail)
+				}
+			}
+		} else { //采购单位画像
+			buyerDetailMap := getBuyerListMsg(recordList)
+			for _, buyerName := range recordList {
+				if buyerDetail, ok := buyerDetailMap[buyerName]; ok && buyerDetail != nil {
+					infoList = append(infoList, buyerDetail)
+				} else {
+					infoList = append(infoList, map[string]interface{}{"name": buyerName})
+				}
+			}
+		}
 
 
-        returnMap := map[string]interface{}{
-            "list": infoList,
-        }
-        if total != -1 {
-            returnMap["total"] = total
-        }
-        return returnMap, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s SubVipPortrait-PortraitRecord 企业画像浏览记录查询出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+		returnMap := map[string]interface{}{
+			"list": infoList,
+		}
+		if total != -1 {
+			returnMap["total"] = total
+		}
+		return returnMap, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s SubVipPortrait-PortraitRecord 企业画像浏览记录查询出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // BuyerSelects 超级订阅筛选画像
 // BuyerSelects 超级订阅筛选画像
 func (this *SubVipPortrait) BuyerSelects() {
 func (this *SubVipPortrait) BuyerSelects() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        buyer := this.GetString("buyer")
-        if buyer == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        _, _, err, _ := entity.CreateSubVipPortraitManager(userId, "buyerPortrait", buyer, false, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        pwp := &entity.PortraitScreen{Ent: buyer}
-        return pwp.GetProjectSelectItems(false)
-    }()
-    if errMsg != nil {
-        log.Printf("%s BuyerSelects 获取采购的单位画像可筛选条件出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		buyer := this.GetString("buyer")
+		if buyer == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		_, _, err, _ := entity.CreateSubVipPortraitManager(userId, "buyerPortrait", buyer, false, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		pwp := &entity.PortraitScreen{Ent: buyer}
+		return pwp.GetProjectSelectItems(false)
+	}()
+	if errMsg != nil {
+		log.Printf("%s BuyerSelects 获取采购的单位画像可筛选条件出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // BuyerNewMsg 超级订阅采购单位画像动态
 // BuyerNewMsg 超级订阅采购单位画像动态
 func (this *SubVipPortrait) BuyerNewMsg() {
 func (this *SubVipPortrait) BuyerNewMsg() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        buyer := this.GetString("buyer")
-        if buyer == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        if userId == "" {
-            return nil, fmt.Errorf("未登录")
-        }
-        pageNum, _ := this.GetInteger("pageNum")
-        pageSize, _ := this.GetInteger("pageSize")
-        cepm, power, err, _ := entity.CreateSubVipPortraitManagerForOpen(userId, "buyerPortrait", buyer, false, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        //免费用户仅可查看三条记录
-        rData, total, err := cepm.GetBuyerNewMsg(&entity.PortraitProjectScreen{
-            Screen: &entity.PortraitScreen{
-                Ent:        buyer,
-                Match:      this.GetString("match"),
-                ExactMatch: this.GetString("exactMatch") == "1",
-                MatchRange: this.GetString("matchRange"),
-                Area:       this.GetString("area"),
-                ScopeClass: this.GetString("scopeClass"),
-                TimeRange:  this.GetString("timeRange"),
-                HasPower:   power > 1,
-            },
-            PageNum:  pageNum,
-            PageSize: pageSize,
-        })
-        if err != nil {
-            return nil, err
-        }
-        return map[string]interface{}{
-            "list":  rData,
-            "count": total,
-        }, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s BuyerNewMsg获取采购单位最新招标信息出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		buyer := this.GetString("buyer")
+		if buyer == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		if userId == "" {
+			return nil, fmt.Errorf("未登录")
+		}
+		pageNum, _ := this.GetInteger("pageNum")
+		pageSize, _ := this.GetInteger("pageSize")
+		cepm, power, err, _ := entity.CreateSubVipPortraitManagerForOpen(userId, "buyerPortrait", buyer, false, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		//免费用户仅可查看三条记录
+		rData, total, err := cepm.GetBuyerNewMsg(&entity.PortraitProjectScreen{
+			Screen: &entity.PortraitScreen{
+				Ent:        buyer,
+				Match:      this.GetString("match"),
+				ExactMatch: this.GetString("exactMatch") == "1",
+				MatchRange: this.GetString("matchRange"),
+				Area:       this.GetString("area"),
+				ScopeClass: this.GetString("scopeClass"),
+				TimeRange:  this.GetString("timeRange"),
+				HasPower:   power > 1,
+			},
+			PageNum:  pageNum,
+			PageSize: pageSize,
+		})
+		if err != nil {
+			return nil, err
+		}
+		return map[string]interface{}{
+			"list":  rData,
+			"count": total,
+		}, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s BuyerNewMsg获取采购单位最新招标信息出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // BuyerNewMsgExport 超级订阅采购单位画像动态数据导出
 // BuyerNewMsgExport 超级订阅采购单位画像动态数据导出
 func (this *SubVipPortrait) BuyerNewMsgExport() {
 func (this *SubVipPortrait) BuyerNewMsgExport() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        buyer := this.GetString("buyer")
-        if buyer == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        cepm, power, err, free := entity.CreateSubVipPortraitManager(userId, "buyerPortrait", buyer, false, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        pps := &entity.PortraitProjectScreen{
-            Screen: &entity.PortraitScreen{
-                Ent:        buyer,
-                Match:      this.GetString("match"),
-                ExactMatch: this.GetString("exactMatch") == "1",
-                MatchRange: this.GetString("matchRange"),
-                Area:       this.GetString("area"),
-                ScopeClass: this.GetString("scopeClass"),
-                TimeRange:  this.GetString("timeRange"),
-                HasPower:   power > 1,
-            },
-            IsExport: true,
-            Free:     free,
-        }
-        ids := getSelectIds(this.GetString("selectIds"))
-        if ids == nil || len(ids) == 0 {
-            ids, err = cepm.GetBuyerNewMsgExport(pps)
-            if err != nil {
-                return nil, err
-            }
-        } else {
-            pps.CommonPare(false)
-        }
-        _id, err := cepm.SaveExportRecord(pps, ids, buyer, "buyerPortrait")
-        if err != nil {
-            return nil, err
-        }
-        return _id, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s BuyerNewMsgExport获取采购单位最新招标信息出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		buyer := this.GetString("buyer")
+		if buyer == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		cepm, power, err, free := entity.CreateSubVipPortraitManager(userId, "buyerPortrait", buyer, false, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		pps := &entity.PortraitProjectScreen{
+			Screen: &entity.PortraitScreen{
+				Ent:        buyer,
+				Match:      this.GetString("match"),
+				ExactMatch: this.GetString("exactMatch") == "1",
+				MatchRange: this.GetString("matchRange"),
+				Area:       this.GetString("area"),
+				ScopeClass: this.GetString("scopeClass"),
+				TimeRange:  this.GetString("timeRange"),
+				HasPower:   power > 1,
+			},
+			IsExport: true,
+			Free:     free,
+		}
+		ids := getSelectIds(this.GetString("selectIds"))
+		if ids == nil || len(ids) == 0 {
+			ids, err = cepm.GetBuyerNewMsgExport(pps)
+			if err != nil {
+				return nil, err
+			}
+		} else {
+			pps.CommonPare(false)
+		}
+		_id, err := cepm.SaveExportRecord(pps, ids, buyer, "buyerPortrait")
+		if err != nil {
+			return nil, err
+		}
+		return _id, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s BuyerNewMsgExport获取采购单位最新招标信息出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // BuyerContacts 超级订阅采购单位联系人
 // BuyerContacts 超级订阅采购单位联系人
 func (this *SubVipPortrait) BuyerContacts() {
 func (this *SubVipPortrait) BuyerContacts() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        buyerName := this.GetString("buyer")
-        if buyerName == "" {
-            return nil, fmt.Errorf("企业参数异常")
-        }
-        cepm, power, err, _ := entity.CreateSubVipPortraitManager(userId, "buyerPortrait", buyerName, false, this.Session())
-        if err != nil {
-            return nil, err
-        }
-        if power <= 1 {
-            return nil, errors.New("非法请求")
-        }
-        rData, err := cepm.GetBuyerContactsMsg(buyerName)
-        if err != nil {
-            return nil, err
-        }
-        return map[string]interface{}{
-            "list": rData,
-        }, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s BuyerContacts获取历史项目联系方式出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		buyerName := this.GetString("buyer")
+		if buyerName == "" {
+			return nil, fmt.Errorf("企业参数异常")
+		}
+		cepm, power, err, _ := entity.CreateSubVipPortraitManager(userId, "buyerPortrait", buyerName, false, this.Session())
+		if err != nil {
+			return nil, err
+		}
+		if power <= 1 {
+			return nil, errors.New("非法请求")
+		}
+		rData, err := cepm.GetBuyerContactsMsg(buyerName)
+		if err != nil {
+			return nil, err
+		}
+		return map[string]interface{}{
+			"list": rData,
+		}, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s BuyerContacts获取历史项目联系方式出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // BuyerPortrait 超级订阅采购单位画像-数据
 // BuyerPortrait 超级订阅采购单位画像-数据
 func (this *SubVipPortrait) BuyerPortrait() {
 func (this *SubVipPortrait) BuyerPortrait() {
-    userId := qutil.ObjToString(this.GetSession("userId"))
-    rData, errMsg := func() (interface{}, error) {
-        buyerName := this.GetString("buyer")
-        if buyerName == "" {
-            return nil, fmt.Errorf("参数异常")
-        }
-        redisKey := fmt.Sprintf("buyerPortraitKey_%s", buyerName)
-        if userId == "" {
-            if bytes, err := redis.GetBytes("other", redisKey); err == nil && bytes != nil {
-                rData := make(map[string]interface{})
-                if err = json.Unmarshal(*bytes, &rData); err != nil {
-                    log.Printf("[MANAGER-ERR]RegionAndInformationAndTender  GetData Error %v \n", err)
-                    return rData, nil
-                }
-            }
-        }
-        cepm, power, err, isFree := entity.CreateSubVipPortraitManagerForOpen(userId, "buyerPortrait", buyerName, false, this.Session())
-        cepm.Session = this.Session()
-        if err != nil {
-            return nil, err
-        }
-        flag := this.GetString("flag") //分段请求标识
-        userLevel := 3
-        if userId != "" {
-            userLevel = qutil.If(isFree, 2, 1).(int)
-        }
-        rData, err := cepm.BuyerPortraitData(&entity.PortraitScreen{
-            Ent:        buyerName,
-            Match:      this.GetString("match"),
-            ExactMatch: this.GetString("exactMatch") == "1",
-            MatchRange: this.GetString("matchRange"),
-            Area:       this.GetString("area"),
-            ScopeClass: this.GetString("scopeClass"),
-            TimeRange:  this.GetString("timeRange"),
-            HasPower:   power > 1,
-            UserLevel:  userLevel,
-        }, flag)
-        if err != nil {
-            return nil, err
-        }
-        if power == 3 {
-            rData["onTrial"] = true
-        }
-        if userId == "" { //未登录用户限制字段
-            rData = map[string]interface{}{
-                "city":       rData["city"],
-                "buyerclass": rData["buyerclass"],
-                "province":   rData["province"],
-            }
-
-            if bytes, err := json.Marshal(rData); err == nil && bytes != nil {
-                _ = redis.PutBytes("other", redisKey, &bytes, 2*24*60*60)
-            }
-        }
-        return rData, nil
-    }()
-    if errMsg != nil {
-        log.Printf("%s BuyerPortrait获取采购单位画像标信息出错:%s\n", userId, errMsg.Error())
-    }
-    this.ServeJson(NewResult(rData, errMsg))
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		buyerName := this.GetString("buyer")
+		if buyerName == "" {
+			return nil, fmt.Errorf("参数异常")
+		}
+		redisKey := fmt.Sprintf("buyerPortraitKey_%s", buyerName)
+		if userId == "" {
+			if bytes, err := redis.GetBytes("other", redisKey); err == nil && bytes != nil {
+				rData := make(map[string]interface{})
+				if err = json.Unmarshal(*bytes, &rData); err != nil {
+					log.Printf("[MANAGER-ERR]buyerPortraitKey_  GetData Error %v \n", err)
+					return rData, nil
+				}
+			}
+			q := `{"size": 1,"_source": ["buyerclass","province","city"],"query": {"match_phrase": {"name": "%s"}}}`
+			data := elastic.Get("buyer", "buyer", fmt.Sprintf(q, buyerName))
+			if data != nil && len(*data) > 0 {
+				rData := (*data)[0]
+				if bytes, err := json.Marshal(rData); err == nil && bytes != nil {
+					_ = redis.PutBytes("other", redisKey, &bytes, 2*24*60*60)
+				}
+				return rData, nil
+			}
+			return nil, nil
+		}
+		cepm, power, err, isFree := entity.CreateSubVipPortraitManagerForOpen(userId, "buyerPortrait", buyerName, false, this.Session())
+		cepm.Session = this.Session()
+		if err != nil {
+			return nil, err
+		}
+		flag := this.GetString("flag") //分段请求标识
+		userLevel := 3
+		if userId != "" {
+			userLevel = qutil.If(isFree, 2, 1).(int)
+		}
+		rData, err := cepm.BuyerPortraitData(&entity.PortraitScreen{
+			Ent:        buyerName,
+			Match:      this.GetString("match"),
+			ExactMatch: this.GetString("exactMatch") == "1",
+			MatchRange: this.GetString("matchRange"),
+			Area:       this.GetString("area"),
+			ScopeClass: this.GetString("scopeClass"),
+			TimeRange:  this.GetString("timeRange"),
+			HasPower:   power > 1,
+			UserLevel:  userLevel,
+		}, flag)
+		if err != nil {
+			return nil, err
+		}
+		if power == 3 {
+			rData["onTrial"] = true
+		}
+		return rData, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s BuyerPortrait获取采购单位画像标信息出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 }
 
 
 // getEntListMsg 获取企业基本信息
 // getEntListMsg 获取企业基本信息
 func getEntListMsg(ids []string) (dMap map[string]map[string]interface{}) {
 func getEntListMsg(ids []string) (dMap map[string]map[string]interface{}) {
-    dMap = make(map[string]map[string]interface{})
-    rData := elastic.Get("qyxy", "qyxy", fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"id":["%s"]}}]}},"_source":["_id","company_name","company_status","legal_person","capital","company_address","company_shortname","company_phone","establish_date"],"size":%d}`, strings.Join(ids, `","`), len(ids)))
-    if rData == nil || len(*rData) == 0 {
-        return
-    }
-    for _, data := range *rData {
-        if id, ok := data["_id"].(string); ok && id != "" {
-            if dateTimestamp := qutil.Int64All(data["establish_date"]); dateTimestamp > 0 {
-                data["establish_date"] = time.Unix(dateTimestamp, 0).Format(Date_Short_Layout)
-            }
-            dMap[id] = data
-        }
-    }
-    return
+	dMap = make(map[string]map[string]interface{})
+	rData := elastic.Get("qyxy", "qyxy", fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"id":["%s"]}}]}},"_source":["_id","company_name","company_status","legal_person","capital","company_address","company_shortname","company_phone","establish_date"],"size":%d}`, strings.Join(ids, `","`), len(ids)))
+	if rData == nil || len(*rData) == 0 {
+		return
+	}
+	for _, data := range *rData {
+		if id, ok := data["_id"].(string); ok && id != "" {
+			if dateTimestamp := qutil.Int64All(data["establish_date"]); dateTimestamp > 0 {
+				data["establish_date"] = time.Unix(dateTimestamp, 0).Format(Date_Short_Layout)
+			}
+			dMap[id] = data
+		}
+	}
+	return
 }
 }
 
 
 // getBuyerListMsg 获取采购单位基本信息
 // getBuyerListMsg 获取采购单位基本信息
 func getBuyerListMsg(buyerNames []string) (dMap map[string]map[string]interface{}) {
 func getBuyerListMsg(buyerNames []string) (dMap map[string]map[string]interface{}) {
-    dMap = make(map[string]map[string]interface{})
-    rData := elastic.Get("buyer", "buyer", fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"buyer_name":["%s"]}}]}},"size":%d,"_source":["buyer_name","city","province","buyerclass"]}`, strings.Join(buyerNames, `","`), len(buyerNames)))
-    if rData == nil || len(*rData) == 0 {
-        return
-    }
-    for _, data := range *rData {
-        if id, ok := data["_id"].(string); ok && id != "" {
-            if dateTimestamp := qutil.Int64All(data["establish_date"]); dateTimestamp > 0 {
-                data["establish_date"] = time.Unix(dateTimestamp, 0).Format(Date_Short_Layout)
-            }
-            dMap[id] = data
-        }
-        if buyerName, _ := data["buyer_name"].(string); buyerName != "" {
-            dMap[buyerName] = map[string]interface{}{
-                "name":       buyerName,
-                "city":       data["city"],
-                "province":   data["province"],
-                "buyerclass": data["buyerclass"],
-            }
-        }
-    }
-    return
+	dMap = make(map[string]map[string]interface{})
+	rData := elastic.Get("buyer", "buyer", fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"buyer_name":["%s"]}}]}},"size":%d,"_source":["buyer_name","city","province","buyerclass"]}`, strings.Join(buyerNames, `","`), len(buyerNames)))
+	if rData == nil || len(*rData) == 0 {
+		return
+	}
+	for _, data := range *rData {
+		if id, ok := data["_id"].(string); ok && id != "" {
+			if dateTimestamp := qutil.Int64All(data["establish_date"]); dateTimestamp > 0 {
+				data["establish_date"] = time.Unix(dateTimestamp, 0).Format(Date_Short_Layout)
+			}
+			dMap[id] = data
+		}
+		if buyerName, _ := data["buyer_name"].(string); buyerName != "" {
+			dMap[buyerName] = map[string]interface{}{
+				"name":       buyerName,
+				"city":       data["city"],
+				"province":   data["province"],
+				"buyerclass": data["buyerclass"],
+			}
+		}
+	}
+	return
 }
 }