瀏覽代碼

feat:p618 bxsubscribe rpc调整

fuwencai 7 月之前
父節點
當前提交
3fabdc9d8a

+ 7 - 1
jyBXSubscribe/rpc/bxsubscribe.proto

@@ -127,9 +127,15 @@ message SomeInfo{
   bool isRead = 7;//某个通知??是否已读
   repeated string  industry = 8;//会员订阅的行业
   string userId = 9;//用户id
-  string subsetinfo = 10;// 订阅设置信息
+  SubSetInfo subsetinfo = 10;// 订阅设置信息
 }
 //
+message SubSetInfo {
+    string  area =1;  // 地区
+    string    district = 2;  // 区县
+    repeated string key = 3; // 关键词
+    int64 areacount =4;  // 地区数量限制
+}
 message StatusResp{
   string error_msg = 1;
   int64 error_code = 2;

+ 1 - 0
jyBXSubscribe/rpc/bxsubscribe/bxsubscribe.go

@@ -47,6 +47,7 @@ type (
 	StaffSubscribeListResp  = bxsubscribe.StaffSubscribeListResp
 	StaffSubscribeReq       = bxsubscribe.StaffSubscribeReq
 	StatusResp              = bxsubscribe.StatusResp
+	SubSetInfo              = bxsubscribe.SubSetInfo
 	Subscribe               = bxsubscribe.Subscribe
 	SubscribeData           = bxsubscribe.SubscribeData
 	SubscribeInfo           = bxsubscribe.SubscribeInfo

+ 66 - 2
jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic.go

@@ -7,6 +7,7 @@ import (
 	"context"
 	"fmt"
 	"strconv"
+	"strings"
 	"time"
 
 	"bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/rpc/internal/svc"
@@ -50,6 +51,7 @@ func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsu
 			IsRead:      false,
 			Industry:    nil,
 			UserId:      "",
+			Subsetinfo:  &bxsubscribe.SubSetInfo{},
 		},
 	}
 	baseUserId, _ := strconv.ParseInt(in.NewUserId, 10, 64)
@@ -125,9 +127,32 @@ func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsu
 		}
 		data := IC.Compatible.Select(in.UserId, fmt.Sprintf(`{"%s":1,"i_ts_guide":1,"l_registedate":1}`, field))
 		if data != nil && len(*data) > 0 {
-			subinfo, b := (*data)["o_jy"].(map[string]interface{})
+			subinfo, b := (*data)[field].(map[string]interface{})
 			if b && subinfo != nil {
-				resp.Data.Subsetinfo = common.MapToJson(subinfo)
+				area := subinfo["o_area"].(map[string]interface{})
+				resp.Data.Subsetinfo.Area = common.MapToJson(area)
+				district := subinfo["o_district"].(map[string]interface{})
+				resp.Data.Subsetinfo.District = common.MapToJson(district)
+				switch in.UserType {
+				case SubFreeFlag:
+					resp.Data.Subsetinfo.Areacount = 1 // 地区数量
+					resp.Data.Subsetinfo.Key = freegetsubKey(subinfo)
+				case SubVipFlag:
+					o_buyset := common.ObjToMap(subinfo["o_buyset"])
+					if o_buyset != nil {
+						resp.Data.Subsetinfo.Areacount = common.Int64All((*o_buyset)["areacount"])
+					}
+					resp.Data.Subsetinfo.Key = freegetsubKey(subinfo)
+				case MemberFlag:
+					resp.Data.Subsetinfo.Areacount = -1
+					if common.Int64All(subinfo["i_areacount"]) > 0 {
+						resp.Data.Subsetinfo.Areacount = common.Int64All(subinfo["i_areacount"]) // 单省版大会员
+					}
+					resp.Data.Subsetinfo.Key = freegetsubKey(subinfo)
+				case EntnicheFlag:
+					resp.Data.Subsetinfo.Areacount = -1
+					resp.Data.Subsetinfo.Key = freegetsubKey(subinfo)
+				}
 			}
 			registedate := common.Int64All((*data)["l_registedate"])
 			if in.UserType == SubFreeFlag || registedate > IC.C.GuideRegistedate {
@@ -139,3 +164,42 @@ func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsu
 	}
 	return resp, nil
 }
+
+// 处理订阅词
+func freegetsubKey(subinfo map[string]interface{}) (arr []string) {
+	a_key, b := subinfo["a_key"].([]interface{})
+	if !b {
+		return
+	}
+	for i := 0; i < len(a_key); i++ {
+		a_keyi := common.ObjToMap(a_key[i])
+		if a_keyi != nil {
+			a_keyiarr := (*a_keyi)["key"].([]interface{})
+			arr = append(arr, common.ObjToString(a_keyiarr[0]))
+		}
+	}
+	return arr
+}
+func paygetsubKey(subinfo map[string]interface{}) (arr []string) {
+
+	a_items, b := subinfo["a_items"].([]interface{})
+	if !b || len(a_items) == 0 {
+		return
+	}
+	a_items0, b1 := a_items[0].(map[string]interface{})
+	if !b1 {
+		return
+	}
+	a_key, b3 := a_items0["a_key"].([]interface{})
+	if a_key == nil || !b3 {
+		return
+	}
+	for i := 0; i < len(a_key); i++ {
+		a_keyi := common.ObjToMap(a_key[i])
+		if a_keyi != nil {
+			a_keyiarr := (*a_keyi)["key"].([]interface{})
+			arr = append(arr, strings.Join(common.ObjArrToStringArr(a_keyiarr), " "))
+		}
+	}
+	return
+}

文件差異過大導致無法顯示
+ 182 - 111
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go


部分文件因文件數量過多而無法顯示