|
@@ -1,6 +1,8 @@
|
|
|
package portrait
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
+ "encoding/json"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"jy/src/jfw/modules/bigmember/src/config"
|
|
@@ -459,7 +461,26 @@ func (this *SubVipPortrait) BuyerPortrait() {
|
|
|
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 {
|
|
@@ -487,17 +508,7 @@ func (this *SubVipPortrait) BuyerPortrait() {
|
|
|
if power == 3 {
|
|
|
rData["onTrial"] = true
|
|
|
}
|
|
|
-<<<<<<< HEAD
|
|
|
rData["name"] = buyerName
|
|
|
-=======
|
|
|
- if userId == "" { //未登录用户限制字段
|
|
|
- rData = map[string]interface{}{
|
|
|
- "city": rData["city"],
|
|
|
- "buyerclass": rData["buyerclass"],
|
|
|
- "province": rData["province"],
|
|
|
- }
|
|
|
- }
|
|
|
->>>>>>> master
|
|
|
return rData, nil
|
|
|
}()
|
|
|
if errMsg != nil {
|