Parcourir la source

Merge branch 'dev/v4.8.40_dx' of qmx/jy into feature/v4.8.40

duxin il y a 2 ans
Parent
commit
4df7d1b64f

+ 20 - 10
src/jfw/modules/bigmember/src/service/portrait/subvipPortraitAction.go

@@ -72,10 +72,13 @@ func (this *SubVipPortrait) SubVipWinnerNewMsg() {
 		if entId == "" {
 			return nil, fmt.Errorf("参数异常")
 		}
-		cepm, power, err, _ := entity.CreateSubVipPortraitManager(userId, "entNewMsg", entId, true, this.Session())
+		cepm, power, err, free := entity.CreateSubVipPortraitManager(userId, "entNewMsg", entId, true, this.Session())
 		if err != nil {
 			return nil, err
 		}
+		if free {
+			return nil, errors.New("无查看权益")
+		}
 		if power <= 1 {
 			return nil, errors.New("非法请求")
 		}
@@ -191,10 +194,13 @@ func (this *SubVipPortrait) SubVipPortrait() {
 		if entId == "" {
 			return nil, fmt.Errorf("参数异常")
 		}
-		cepm, power, err, _ := entity.CreateSubVipPortraitManager(userId, "entPortrait", entId, true, this.Session())
+		cepm, power, err, free := entity.CreateSubVipPortraitManager(userId, "entPortrait", entId, true, this.Session())
 		if err != nil {
 			return nil, err
 		}
+		if free {
+			return nil, fmt.Errorf("无查看权益")
+		}
 		rData, err := cepm.WinnerPortraitData(&entity.PortraitScreen{
 			Ent:        entId,
 			Match:      this.GetString("match"),
@@ -339,10 +345,13 @@ func (this *SubVipPortrait) BuyerNewMsg() {
 		}
 		pageNum, _ := this.GetInteger("pageNum")
 		pageSize, _ := this.GetInteger("pageSize")
-		cepm, power, err, _ := entity.CreateSubVipPortraitManagerForOpen(userId, "buyerPortrait", buyer, false, this.Session())
+		cepm, power, err, free := entity.CreateSubVipPortraitManagerForOpen(userId, "buyerPortrait", buyer, false, this.Session())
 		if err != nil {
 			return nil, err
 		}
+		if free {
+			return nil, fmt.Errorf("无查看权益")
+		}
 		//免费用户仅可查看三条记录
 		rData, total, err := cepm.GetBuyerNewMsg(&entity.PortraitProjectScreen{
 			Screen: &entity.PortraitScreen{
@@ -461,8 +470,14 @@ func (this *SubVipPortrait) BuyerPortrait() {
 		if buyerName == "" {
 			return nil, fmt.Errorf("参数异常")
 		}
+
+		cepm, power, err, isFree := entity.CreateSubVipPortraitManagerForOpen(userId, "buyerPortrait", buyerName, false, this.Session())
+		cepm.Session = this.Session()
+		if err != nil {
+			return nil, err
+		}
 		redisKey := fmt.Sprintf("buyerPortraitKey_%s", buyerName)
-		if userId == "" {
+		if userId == "" || isFree {
 			if bytes, err := redis.GetBytes("other", redisKey); err == nil && bytes != nil {
 				rData := make(map[string]interface{})
 				if err = json.Unmarshal(*bytes, &rData); err != nil {
@@ -470,7 +485,7 @@ func (this *SubVipPortrait) BuyerPortrait() {
 					return rData, nil
 				}
 			}
-			q := `{"size": 1,"_source": ["buyerclass","province","city"],"query": {"match_phrase": {"name": "%s"}}}`
+			q := `{"size": 1,"_source": ["buyerclass","province","city","name"],"query": {"match_phrase": {"name": "%s"}}}`
 			data := elastic.Get("buyer", "buyer", fmt.Sprintf(q, buyerName))
 			if data != nil && len(*data) > 0 {
 				rData := (*data)[0]
@@ -481,11 +496,6 @@ func (this *SubVipPortrait) BuyerPortrait() {
 			}
 			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 != "" {