package util import ( "app.yhyue.com/moapp/jybase/common" "app.yhyue.com/moapp/jybase/date" "app.yhyue.com/moapp/jybase/encrypt" "app.yhyue.com/moapp/jybase/esv1" "app.yhyue.com/moapp/jybase/mongodb" "app.yhyue.com/moapp/jybase/mysql" "app.yhyue.com/moapp/jybase/redis" "encoding/json" "fmt" "github.com/zeromicro/go-zero/core/logx" "go.mongodb.org/mongo-driver/bson/primitive" IC "jyBXSubscribe/rpc/init" "jyBXSubscribe/rpc/type/bxsubscribe" "strconv" "strings" "time" ) // const ( pageSize = 50 pageSizes = 10 AllSubPushCacheSize = 250 query = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","area", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "buyerclass","bidamount","budget","projectname","buyer","bidopentime","s_winner","filetext"],"from":0,"size":%d}` mongodb_fields = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "buyerclass":1,"budget":1,"bidamount":1,"s_winner":1,"bidopentime":1,"buyer":1,"projectname":1}` SubFreeFlag = "fType" SubVipFlag = "vType" MemberFlag = "mType" EntnicheFlag = "eType" oneDay = 24 * 60 * 60 ) var aboutDbMsg map[string]*AboutDbMsg = map[string]*AboutDbMsg{ SubFreeFlag: &AboutDbMsg{"pushsubscribe", "subpush"}, SubVipFlag: &AboutDbMsg{"pushsubscribe", "subpush"}, MemberFlag: &AboutDbMsg{"pushmember", "memberpush"}, EntnicheFlag: &AboutDbMsg{"pushentniche", "pushentniche"}, } type AboutDbMsg struct { MysqlTable string RedisKeyFlag string } type SubPush struct { Date string Datas []*bxsubscribe.SubscribeInfo Count int64 } type PushCa struct { Date int64 InfoId string Visit int Index int64 Keys []string Type int Isvip int FileExists bool } //查询参数 type SubPushQueryParam struct { Mgo_bidding mongodb.MongodbSim // Bidding string // Bidding_back string // PushMysql *mysql.Mysql // UserId string //用户id PageNum int //页面 PageSize int //每页数量 SelectTime string //时间 Area string //区域 City string //城市 Buyerclass string //采购单位行业 Subtype string //信息类型 二级分类 Subscopeclass string //信息行业 Key string //订阅词 Export bool //导出 EntId int //企业id Price string //价格 FileExists string //是否有附件;默认全部;1:有附件;-1:无附件 } func (spqp *SubPushQueryParam) IsEmpty() bool { return spqp.SelectTime == "" && spqp.Area == "" && spqp.City == "" && spqp.Buyerclass == "" && spqp.Subscopeclass == "" && spqp.Subtype == "" && spqp.Key == "" && spqp.Price == "" && spqp.FileExists == "" } type subscribePush struct { ModuleFlag string } func NewSubscribePush(module ...string) *subscribePush { m := "" if len(module) > 0 { m = module[0] } return &subscribePush{m} } //从pushcache_2_a中取 func (h *subscribePush) GetTodayCache(userId string) (*SubPush, error) { pc_a, err := redis.GetNewBytes("pushcache_2_b", h.todayKey(userId)) if err != nil { return nil, err } if pc_a == nil { return nil, nil } var p *SubPush if err := json.Unmarshal(*pc_a, &p); err != nil { return nil, err } return p, nil } //往pushcache_2_a中放 func (h *subscribePush) PutTodayCache(userId string, pc_a *SubPush) { redis.Put("pushcache_2_b", h.todayKey(userId), pc_a, oneDay) } //获取redis key func (s *subscribePush) todayKey(userId string) string { return fmt.Sprintf("%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId) } func (s *subscribePush) allKey(userId string) string { logx.Info(fmt.Sprintf("all_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId)) return fmt.Sprintf("all_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId) } //历史推送记录中单条信息格式化 func (s *subscribePush) InfoFormat(p *PushCa, info *map[string]interface{}) *bxsubscribe.SubscribeInfo { area := common.ObjToString((*info)["area"]) if area == "A" { area = "全国" } industry := common.ObjToString((*info)["s_subscopeclass"]) scs := strings.Split(industry, ",") if len(scs) > 0 { industry = scs[0] if industry != "" { iss := strings.Split(industry, "_") if len(iss) > 0 { industry = iss[0] } } } infotype := common.ObjToString((*info)["subtype"]) if infotype == "" { infotype = common.ObjToString((*info)["toptype"]) } if infotype == "" { infotype = common.ObjToString((*info)["type"]) if infotype == "tender" { infotype = "招标" } else if infotype == "bid" { infotype = "中标" } } _id := p.InfoId if _id == "" { _id = common.ObjToString((*info)["_id"]) } return &bxsubscribe.SubscribeInfo{ Id: encrypt.EncodeArticleId2ByCheck(_id), Title: common.ObjToString((*info)["title"]), Area: area, BuyerClass: common.ObjToString((*info)["buyerclass"]), Subtype: infotype, Industry: industry, PublishTime: common.Int64All((*info)["publishtime"]), CaIndex: p.Index, CaDate: p.Date, CaIsvisit: int64(p.Visit), CaIsvip: int64(p.Isvip), CaType: int64(p.Type), MatchKeys: p.Keys, Budget: common.ObjToString((*info)["budget"]), BidAmount: common.ObjToString((*info)["bidamount"]), Buyer: common.ObjToString((*info)["buyer"]), ProjectName: common.ObjToString((*info)["projectname"]), Winner: common.ObjToString((*info)["s_winner"]), BidOpenTime: common.ObjToString((*info)["bidopentime"]), CaFileExists: p.FileExists, } } func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total int64, result []*bxsubscribe.SubscribeInfo) { logx.Info(spqp.UserId, s.ModuleFlag, "subscribePush query param:", "SelectTime:", spqp.SelectTime, "Area:", spqp.Area, "City:", spqp.City, "Subtype:", spqp.Subtype, "Subscopeclass:", spqp.Subscopeclass, "Buyerclass:", spqp.Buyerclass, "Key:", spqp.Key, "PageNum:", spqp.PageNum, "Price:", spqp.Price, "FileExists:", spqp.FileExists) if spqp.UserId == "" { return } if spqp.PageNum < 1 { spqp.PageNum = 1 } if spqp.PageSize < 1 || spqp.PageSize > pageSize { if !spqp.Export { spqp.PageSize = pageSize } else { //数据导出查询20000条限制 if spqp.PageSize < 1 || spqp.PageSize > 20000 { spqp.PageSize = 20000 } } } starttime, endtime := int64(0), int64(0) st, et := "", "" now := time.Now() logx.Info(4444) if spqp.SelectTime == "today" { //今天 starttime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix() } else if spqp.SelectTime == "yesterday" { //昨天 starttime = time.Date(now.Year(), now.Month(), now.Day()-1, 0, 0, 0, 0, time.Local).Unix() endtime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix() } else if spqp.SelectTime == "lately-7" { //最近7天 starttime = time.Date(now.Year(), now.Month(), now.Day()-7, 0, 0, 0, 0, time.Local).Unix() } else if spqp.SelectTime == "lately-30" { //最近30天 starttime = time.Date(now.Year(), now.Month(), now.Day()-30, 0, 0, 0, 0, time.Local).Unix() } else if spqp.SelectTime == "lastyear" { //去年 starttime = time.Date(now.Year()-1, 1, 1, 0, 0, 0, 0, time.Local).Unix() endtime = time.Date(now.Year()-1, 12, 31, 23, 59, 59, 0, time.Local).Unix() } else if len(strings.Split(spqp.SelectTime, "_")) == 2 { st = strings.Split(spqp.SelectTime, "_")[0] starttime, _ = strconv.ParseInt(st, 0, 64) et = strings.Split(spqp.SelectTime, "_")[1] endtime, _ = strconv.ParseInt(et, 0, 64) if endtime > 0 { etTime := time.Unix(endtime, 0) endtime = time.Date(etTime.Year(), etTime.Month(), etTime.Day(), 23, 59, 59, 0, time.Local).Unix() } } logx.Info(2222) nowFormat := date.NowFormat(date.Date_Short_Layout) start := (spqp.PageNum - 1) * spqp.PageSize end := start + spqp.PageSize //时间是今天,没有别的过滤条件 if nowFormat == date.FormatDateByInt64(&starttime, date.Date_Short_Layout) && spqp.Area == "" && spqp.City == "" && spqp.Buyerclass == "" && spqp.Subscopeclass == "" && spqp.Subtype == "" && spqp.Key == "" && spqp.Price == "" && spqp.FileExists == "" { logx.Info("a1") subPush, err := s.GetTodayCache(spqp.UserId) if err != nil { logx.Info(spqp.UserId, "GetTodayCache Error", err) } if err != nil || subPush == nil || subPush.Date != nowFormat || len(subPush.Datas) == 0 { list, countSearch := s.getDatasFromMysql(spqp, starttime, endtime, spqp.PageSize, false) subPush = &SubPush{ Date: nowFormat, Datas: list, Count: countSearch, } s.PutTodayCache(spqp.UserId, subPush) } length := len(subPush.Datas) if end > length { end = length } if start < length { result = subPush.Datas[start:end] } total = int64(length) } else if spqp.IsEmpty() && (spqp.PageNum-1)*spqp.PageSize <= 250 { //全部,没有过滤条件 之前缓存5页*50条=250 logx.Info("a2") allCache, err := s.GetAllCache(spqp.UserId) if err != nil { logx.Info(spqp.UserId, "GetAllCache Error", err) } if err != nil || allCache == nil || allCache.Date != nowFormat || len(allCache.Datas) == 0 { spqp.PageNum = 1 logx.Info(1111) list, countSearch := s.getDatasFromMysql(spqp, starttime, endtime, AllSubPushCacheSize, true) allCache = &SubPush{ Date: nowFormat, Datas: list, Count: countSearch, } s.PutAllCache(spqp.UserId, allCache) } length := len(allCache.Datas) if end > length { end = length } if start < length { result = allCache.Datas[start:end] } total = allCache.Count } else { logx.Info("a4") result, total = s.getDatasFromMysql(spqp, starttime, endtime, spqp.PageSize, true) } logx.Info("-------------------------------------------------", len(result)) if result == nil { result = []*bxsubscribe.SubscribeInfo{} } hasNextPage = len(result) >= spqp.PageSize return } // func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) { querys := []string{fmt.Sprintf("userid='%s'", spqp.UserId)} //时间 if starttime > 0 && endtime > 0 { querys = append(querys, fmt.Sprintf("date>=%d and date<=%d", starttime, endtime)) } else if starttime > 0 && endtime == 0 { querys = append(querys, fmt.Sprintf("date>=%d", starttime)) } else if starttime == 0 && endtime > 0 { querys = append(querys, fmt.Sprintf("date<=%d", endtime)) } if spqp.Area != "" || spqp.City != "" { var sqlAreaCity = "" //城市 city := []string{} for _, v := range strings.Split(spqp.City, ",") { if IC.PushMapping.City[v] > 0 { city = append(city, fmt.Sprint(IC.PushMapping.City[v])) } else { city = append(city, "-1") } } if len(city) == 1 { city = append(city, "9999") } if len(city) > 0 { sqlAreaCity = fmt.Sprintf("city in (%s)", strings.Join(city, ",")) } //区域 var sqlArea = "" area := []string{} for _, v := range strings.Split(spqp.Area, ",") { if IC.PushMapping.Area[v] > 0 { area = append(area, fmt.Sprint(IC.PushMapping.Area[v])) } else { area = append(area, "-1") } } if len(area) == 1 { area = append(area, "9999") } if len(area) > 0 { sqlArea = fmt.Sprintf("area in (%s)", strings.Join(area, ",")) } if sqlAreaCity != "" && sqlArea != "" { sqlAreaCity = "( " + sqlAreaCity + " or " + sqlArea + " )" } else if sqlAreaCity == "" && sqlArea != "" { sqlAreaCity = sqlArea } if sqlAreaCity != "" { querys = append(querys, sqlAreaCity) } } //采购单位行业 if spqp.Buyerclass != "" { buyerclass := []string{} for _, v := range strings.Split(spqp.Buyerclass, ",") { buyerclass = append(buyerclass, fmt.Sprint(IC.PushMapping.Buyerclass[v])) } if len(buyerclass) == 1 { buyerclass = append(buyerclass, "9999") } if len(buyerclass) > 0 { querys = append(querys, fmt.Sprintf("buyerclass in (%s)", strings.Join(buyerclass, ","))) } } //信息类型 if spqp.Subtype != "" { subtype := []string{} for _, v := range strings.Split(spqp.Subtype, ",") { subtype = append(subtype, fmt.Sprint(IC.PushMapping.Subtype[v])) } if len(subtype) == 1 { subtype = append(subtype, "9999") } if len(subtype) > 0 { querys = append(querys, fmt.Sprintf("subtype in (%s)", strings.Join(subtype, ","))) } } //信息行业 if spqp.Subscopeclass != "" { find_in_set := []string{} for _, v := range strings.Split(spqp.Subscopeclass, ",") { find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%d',subscopeclass)", IC.PushMapping.Subscopeclass[v])) } if len(find_in_set) == 1 { querys = append(querys, find_in_set[0]) } else if len(find_in_set) > 1 { querys = append(querys, fmt.Sprintf("(%s)", strings.Join(find_in_set, " or "))) } } //关键词 if spqp.Key != "" { find_in_set := []string{} for _, v := range strings.Split(spqp.Key, ",") { find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(matchkeys,'+',','),' ',','))", v)) } if len(find_in_set) == 1 { querys = append(querys, find_in_set[0]) } else if len(find_in_set) > 1 { querys = append(querys, fmt.Sprintf("(%s)", strings.Join(find_in_set, " or "))) } } //价格- 预算和中标金额 if spqp.Price != "" && strings.Contains(spqp.Price, "-") { minPrice_str, maxPrice_str := strings.Split(spqp.Price, "-")[0], strings.Split(spqp.Price, "-")[1] minPrice := common.Int64All(common.Float64All(minPrice_str) * 10000) //换成元 maxPrice := common.Int64All(common.Float64All(maxPrice_str) * 10000) //换成元 querys = append(querys, fmt.Sprintf("((bidamount>=%d and bidamount<=%d) or (budget>=%d and budget<=%d and bidamount is null))", minPrice, maxPrice, minPrice, maxPrice)) } //附件 if spqp.FileExists != "" { if spqp.FileExists == "1" { querys = append(querys, fmt.Sprintf("attachment_count is not null")) } else if spqp.FileExists == "-1" { querys = append(querys, fmt.Sprintf("attachment_count is null")) } } searchSql := fmt.Sprintf(" from %s where %s order by id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and ")) fmt.Println("searchSql", searchSql) //查询总数 count = spqp.PushMysql.CountBySql(fmt.Sprintf("select count(id)" + searchSql)) logx.Info("count:", count, "---", s.ModuleFlag) findSql := "select id,date,infoid,isvisit,matchkeys,type" if s.ModuleFlag != MemberFlag { if s.ModuleFlag == EntnicheFlag { } else { findSql += ",isvip" } } findSql += searchSql if isLimit { findSql += fmt.Sprintf(" limit %d,%d", (spqp.PageNum-1)*size, size) } logx.Info(spqp.UserId, "subscribePush query sql:", findSql) list := spqp.PushMysql.SelectBySql(findSql) if list != nil && len(*list) > 0 { pushCas := s.GetJyPushs(*list) result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas) } else { result = []*bxsubscribe.SubscribeInfo{} } logx.Info("------ooooo----:", len(result)) return } //根据id取内容 func (s *subscribePush) GetInfoByIds(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, pushCas []*PushCa) []*bxsubscribe.SubscribeInfo { array := make([]*bxsubscribe.SubscribeInfo, len(pushCas)) if len(pushCas) == 0 { return array } m := map[string]bool{} ids := []string{} for _, v := range pushCas { if m[v.InfoId] { continue } m[v.InfoId] = true ids = append(ids, v.InfoId) } infos := map[string]map[string]interface{}{} //redis es_ids := []string{} for _, v := range ids { //剑鱼程序未找到赋值 位置;猜测在推送程序中 info_i := redis.Get("pushcache_1", fmt.Sprintf("info_%s", v)) if info_i != nil { info_m, _ := info_i.(map[string]interface{}) info_m["_id"] = v infos[v] = info_m logx.Info("----", info_m, "----") } else { es_ids = append(es_ids, v) } } //elasticsearch if len(es_ids) > 0 { list := elastic.Get("bidding", "bidding", fmt.Sprintf(query, strings.Join(es_ids, `","`), len(es_ids))) if list != nil { for _, v := range *list { _id := common.ObjToString(v["_id"]) infos[_id] = v } } } //mongodb bidding mgo_ids := []primitive.ObjectID{} for _, v := range es_ids { if infos[v] == nil { _id, _ := primitive.ObjectIDFromHex(v) mgo_ids = append(mgo_ids, _id) } } if len(mgo_ids) > 0 { list, ok := Mgo_bidding.Find(bidding, map[string]interface{}{"_id": map[string]interface{}{"$in": mgo_ids}}, nil, mongodb_fields, false, -1, -1) if ok && *list != nil { for _, v := range *list { _id := mongodb.BsonIdToSId(v["_id"]) v["_id"] = _id infos[_id] = v } } } //mongodb bidding_back mgo_back_ids := []primitive.ObjectID{} for _, v := range mgo_ids { if infos[mongodb.BsonIdToSId(v)] == nil { mgo_back_ids = append(mgo_back_ids, v) } } if len(mgo_back_ids) > 0 { list, ok := Mgo_bidding.Find(bidding_back, map[string]interface{}{"_id": map[string]interface{}{"$in": mgo_back_ids}}, nil, mongodb_fields, false, -1, -1) if ok && *list != nil { for _, v := range *list { _id := mongodb.BsonIdToSId(v["_id"]) v["_id"] = _id infos[_id] = v } } } // for k, v := range pushCas { info := infos[v.InfoId] if info == nil { info = map[string]interface{}{} } array[k] = s.InfoFormat(v, &info) } return array } //获取历史推送 func (s *subscribePush) GetJyPushs(datas []map[string]interface{}) (pushCas []*PushCa) { pushCas = []*PushCa{} for _, v := range datas { keys := []string{} if matchkeys := common.ObjToString(v["matchkeys"]); matchkeys != "" { keys = strings.Split(matchkeys, " ") } pushCas = append(pushCas, &PushCa{ Date: common.Int64All(v["date"]), InfoId: common.ObjToString(v["infoid"]), Visit: common.IntAll(v["isvisit"]), Index: common.Int64All(v["id"]), Keys: keys, Type: common.IntAll(v["type"]), Isvip: common.IntAll(v["isvip"]), FileExists: common.IntAll(v["attachment_count"]) > 0, }) } return } //查看全部列表缓存 func (s *subscribePush) PutAllCache(userId string, datas *SubPush) { redis.Put("pushcache_2_a", s.allKey(userId), datas, oneDay) } func (s *subscribePush) GetAllCache(userId string) (*SubPush, error) { return s.GetCache("pushcache_2_a", s.allKey(userId)) } func (s *subscribePush) GetCache(code, key string) (*SubPush, error) { pc_a, err := redis.GetNewBytes(code, key) if err != nil { return nil, err } if pc_a == nil { return nil, nil } var p *SubPush if err := json.Unmarshal(*pc_a, &p); err != nil { return nil, err } return p, nil } //是否收藏 func (s *subscribePush) MakeCollection(userId string, list []*bxsubscribe.SubscribeInfo) { if list == nil || len(list) == 0 { return } param := []interface{}{userId} wh := []string{} for _, v := range list { array := encrypt.DecodeArticleId2ByCheck(v.Id) if len(array) == 1 && array[0] != "" { param = append(param, array[0]) wh = append(wh, "?") } } if len(wh) > 0 { result := IC.MainMysql.SelectBySql(`select bid from bdcollection where userid=? and bid in (`+strings.Join(wh, ",")+`)`, param...) bid_map := map[string]bool{} if result != nil { for _, v := range *result { bid_map[encrypt.EncodeArticleId2ByCheck(common.ObjToString(v["bid"]))] = true } } for _, v := range list { if bid_map[v.Id] { v.Collection = 1 } } } } //仅移动端首页使用,历史推送7天信息 func (s *subscribePush) sevenDayKey(userId string) string { return fmt.Sprintf("7day_subpush_%s", userId) } func (s *subscribePush) PutSevenDayCache(userId string, datas []*bxsubscribe.SubscribeInfo) { redis.Put("pushcache_2_a", s.sevenDayKey(userId), SubPush{Datas: datas}, 7*24*60*60) } //从pushcache_2_a中取 func (s *subscribePush) GetSevenDayCache(userId string) ([]*bxsubscribe.SubscribeInfo, error) { allPush, _ := s.GetCache("pushcache_2_a", s.sevenDayKey(userId)) if allPush != nil && allPush.Datas != nil && len(allPush.Datas) > 0 { return allPush.Datas, nil } return nil, nil } //历史推送记录中单条信息格式化 func InfoFormats(info map[string]interface{}, tmp map[string]interface{}) map[string]interface{} { area := common.ObjToString(info["area"]) if area == "A" { area = "全国" } industry := common.ObjToString(info["s_subscopeclass"]) scs := strings.Split(industry, ",") if len(scs) > 0 { industry = scs[0] if industry != "" { iss := strings.Split(industry, "_") if len(iss) > 0 { industry = iss[0] } } } infotype := common.ObjToString(info["subtype"]) if infotype == "" { infotype = common.ObjToString(info["toptype"]) } if infotype == "" { infotype = common.ObjToString(info["type"]) if infotype == "tender" { infotype = "招标" } else if infotype == "bid" { infotype = "中标" } } info["type"] = infotype return info } //UpdateUserPushUnread 更新app未读标识为已读 func UpdateUserPushUnread(userid string, vt string) { if vt == MemberFlag { IC.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_member_apppushunread": 0}}) } else if vt == EntnicheFlag { IC.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_entniche_apppushunread": 0}}) } else { IC.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_apppushunread": 0}}) } } // //获取用户信息 func (s *subscribePush) UserInfo(userId string) (*map[string]interface{}, int64) { user, ok := IC.Mgo.FindById("user", userId, `{"s_m_openid":1,"a_m_openid":1,"s_phone":1,"a_mergeorder":1,"o_jy":1,"l_firstpushtime":1,"i_vip_status":1,"l_vip_endtime":1,"o_vipjy":1,"i_member_status":1,"o_member_jy":1}`) if !ok || user == nil { return nil, 0 } return user, common.Int64All((*user)["l_firstpushtime"]) } //是否有订阅词 func GetKeySet(t string, u *map[string]interface{}, data []string) (bool, []string) { var industry_ = []string{} if u != nil { if t == SubFreeFlag { o_jy, _ := (*u)["o_jy"].(map[string]interface{}) a_key, _ := o_jy["a_key"].([]interface{}) logx.Info(industry_, "--------------------------", len(a_key)) return len(a_key) > 0, industry_ } else { var obj map[string]interface{} if t == SubVipFlag { obj, _ = (*u)["o_vipjy"].(map[string]interface{}) } else if t == MemberFlag { obj, _ = (*u)["o_member_jy"].(map[string]interface{}) } else if t == EntnicheFlag { if len(data) > 0 { return true, data } else { return false, data } } if obj != nil { if buyerclassObj, ok := obj["a_buyerclass"].([]interface{}); ok { industry_ = common.ObjArrToStringArr(buyerclassObj) } itmes, _ := obj["a_items"].([]interface{}) for _, v := range itmes { item, _ := v.(map[string]interface{}) keys, _ := item["a_key"].([]interface{}) if len(keys) > 0 { return true, industry_ } } } } } return false, industry_ }