|
@@ -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
|
|
|
+}
|