|
@@ -4,8 +4,10 @@ import (
|
|
|
. "app.yhyue.com/moapp/jybase/api"
|
|
|
qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
+ elastic "app.yhyue.com/moapp/jybase/es"
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
. "app.yhyue.com/moapp/jypkg/ent/util"
|
|
|
+ db "app.yhyue.com/moapp/jypkg/ent/util"
|
|
|
"entniche_new/src/entity"
|
|
|
"fmt"
|
|
|
"log"
|
|
@@ -146,6 +148,11 @@ func (this *EntPortrait) BuyerPortrait() {
|
|
|
userId := qutil.ObjToString(this.GetSession("userId"))
|
|
|
rData, errMsg := func() (interface{}, error) {
|
|
|
buyerName := this.GetString("buyer")
|
|
|
+ //id转中文
|
|
|
+ if len(buyerName) > 0 && len([]rune(buyerName)) == len(buyerName) {
|
|
|
+ //获取中文名字
|
|
|
+ buyerName = getBuyerNameById(db.DecodeId(buyerName))
|
|
|
+ }
|
|
|
if buyerName == "" {
|
|
|
return nil, fmt.Errorf("参数异常")
|
|
|
}
|
|
@@ -172,6 +179,7 @@ func (this *EntPortrait) BuyerPortrait() {
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
+ rData["name"] = buyerName
|
|
|
return rData, nil
|
|
|
}()
|
|
|
if errMsg != nil {
|
|
@@ -293,3 +301,12 @@ func getSelectIds(selectIds string) (ids []string) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func getBuyerNameById(buyerId string) (buyerName string) {
|
|
|
+ r := elastic.Get("buyer", "buyer", fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"_id":["%s"]}}]}},"size":1,"_source":["name"]}`, buyerId))
|
|
|
+ if r == nil || len(*r) == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ buyerName, _ = (*r)[0]["name"].(string)
|
|
|
+ return
|
|
|
+}
|