|
@@ -1,512 +0,0 @@
|
|
|
-package jy
|
|
|
-
|
|
|
-import (
|
|
|
- "encoding/json"
|
|
|
- "fmt"
|
|
|
- "log"
|
|
|
- . "qfw/util"
|
|
|
- "qfw/util/elastic"
|
|
|
- . "qfw/util/mongodb"
|
|
|
- "qfw/util/mysql"
|
|
|
- "qfw/util/redis"
|
|
|
- "strings"
|
|
|
- "time"
|
|
|
-
|
|
|
- "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
-)
|
|
|
-
|
|
|
-const (
|
|
|
- threeDay = 172800
|
|
|
- halfOfDay = 43200
|
|
|
-)
|
|
|
-
|
|
|
-type SubPushList struct {
|
|
|
- Id string `json:"_id"`
|
|
|
- Title string `json:"title"`
|
|
|
- Area string `json:"area"`
|
|
|
- Buyerclass string `json:"buyerclass"`
|
|
|
- Type string `json:"type"`
|
|
|
- S_subscopeclass string `json:"s_subscopeclass"`
|
|
|
- Publishtime int64 `json:"publishtime"`
|
|
|
- Ca_index int64 `json:"ca_index"`
|
|
|
- Ca_date int64 `json:"ca_date"`
|
|
|
- Ca_isvisit int `json:"ca_isvisit"`
|
|
|
- Ca_isvip int `json:"ca_isvip"`
|
|
|
- Ca_type int `json:"ca_type"`
|
|
|
- Matchkeys []string `json:"matchkeys"`
|
|
|
- Budget interface{} `json:"budget"`
|
|
|
- Bidamount interface{} `json:"bidamount"`
|
|
|
-}
|
|
|
-
|
|
|
-const (
|
|
|
- pageSize = 50
|
|
|
- AllSubPushCacheSize = 250
|
|
|
- query = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","area", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "buyerclass","bidamount","budget"],"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}`
|
|
|
-)
|
|
|
-
|
|
|
-var Mysql_table = "pushsubscribe"
|
|
|
-
|
|
|
-//
|
|
|
-
|
|
|
-type SubPush struct {
|
|
|
- Date string
|
|
|
- Datas []*SubPushList
|
|
|
-}
|
|
|
-
|
|
|
-type PushCa struct {
|
|
|
- Date int64
|
|
|
- InfoId string
|
|
|
- Visit int
|
|
|
- Index int64
|
|
|
- Keys []string
|
|
|
- Type int
|
|
|
- Isvip int
|
|
|
-}
|
|
|
-
|
|
|
-var SubscribePush = &subscribePush{}
|
|
|
-
|
|
|
-type subscribePush struct {
|
|
|
-}
|
|
|
-
|
|
|
-//从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, threeDay)
|
|
|
-}
|
|
|
-
|
|
|
-//获取redis key
|
|
|
-func (s *subscribePush) todayKey(userId string) string {
|
|
|
- return fmt.Sprintf("subpush_%s", userId)
|
|
|
-}
|
|
|
-
|
|
|
-//历史推送记录中单条信息格式化
|
|
|
-func (s *subscribePush) InfoFormat(p *PushCa, info *map[string]interface{}) *SubPushList {
|
|
|
- area := ObjToString((*info)["area"])
|
|
|
- if area == "A" {
|
|
|
- area = "全国"
|
|
|
- }
|
|
|
- industry := 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 := ObjToString((*info)["subtype"])
|
|
|
- if infotype == "" {
|
|
|
- infotype = ObjToString((*info)["toptype"])
|
|
|
- }
|
|
|
- if infotype == "" {
|
|
|
- infotype = ObjToString((*info)["type"])
|
|
|
- if infotype == "tender" {
|
|
|
- infotype = "招标"
|
|
|
- } else if infotype == "bid" {
|
|
|
- infotype = "中标"
|
|
|
- }
|
|
|
- }
|
|
|
- _id := p.InfoId
|
|
|
- if _id == "" {
|
|
|
- _id = ObjToString((*info)["_id"])
|
|
|
- }
|
|
|
- return &SubPushList{
|
|
|
- Id: EncodeArticleId2ByCheck(_id),
|
|
|
- Title: ObjToString((*info)["title"]),
|
|
|
- Area: area,
|
|
|
- Buyerclass: ObjToString((*info)["buyerclass"]),
|
|
|
- Type: infotype,
|
|
|
- S_subscopeclass: industry,
|
|
|
- Publishtime: Int64All((*info)["publishtime"]),
|
|
|
- Ca_index: p.Index,
|
|
|
- Ca_date: p.Date,
|
|
|
- Ca_isvisit: p.Visit,
|
|
|
- Ca_isvip: p.Isvip,
|
|
|
- Ca_type: p.Type,
|
|
|
- Matchkeys: p.Keys,
|
|
|
- Budget: (*info)["budget"],
|
|
|
- Bidamount: (*info)["bidamount"],
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-func (s *subscribePush) Datas(MQFW MongodbSim, PushMysql *mysql.Mysql, userId string, pageNum int, selectTime, area string) (hasNextPage bool, result []*SubPushList) {
|
|
|
- if userId == "" {
|
|
|
- return
|
|
|
- }
|
|
|
- if pageNum < 1 {
|
|
|
- pageNum = 1
|
|
|
- }
|
|
|
- now := NowFormat(Date_Short_Layout)
|
|
|
- start := (pageNum - 1) * pageSize
|
|
|
- end := start + pageSize
|
|
|
- if now == selectTime && area == "" {
|
|
|
- subPush, err := s.GetTodayCache(userId)
|
|
|
- if err != nil {
|
|
|
- log.Println(userId, "GetTodayCache Error", err)
|
|
|
- }
|
|
|
- if err != nil || subPush == nil || subPush.Date != now || len(subPush.Datas) == 0 {
|
|
|
- list := s.getDatasFromMysql(MQFW, PushMysql, userId, pageNum, pageSize, selectTime, area, false)
|
|
|
- subPush = &SubPush{
|
|
|
- Date: now,
|
|
|
- Datas: list,
|
|
|
- }
|
|
|
- s.PutTodayCache(userId, subPush)
|
|
|
- }
|
|
|
- length := len(subPush.Datas)
|
|
|
- if end > length {
|
|
|
- end = length
|
|
|
- }
|
|
|
- if start < length {
|
|
|
- result = subPush.Datas[start:end]
|
|
|
- }
|
|
|
- } else if selectTime == "" && area == "" && pageNum <= 5 {
|
|
|
- allCache, err := s.GetAllCache(userId)
|
|
|
- if err != nil {
|
|
|
- log.Println(userId, "GetAllCache Error", err)
|
|
|
- }
|
|
|
- if err != nil || allCache == nil || len(allCache) == 0 {
|
|
|
- allCache = s.getDatasFromMysql(MQFW, PushMysql, userId, 1, AllSubPushCacheSize, selectTime, area, true)
|
|
|
- s.PutAllCache(userId, allCache)
|
|
|
- }
|
|
|
- length := len(allCache)
|
|
|
- if end > length {
|
|
|
- end = length
|
|
|
- }
|
|
|
- if start < length {
|
|
|
- result = allCache[start:end]
|
|
|
- }
|
|
|
- } else {
|
|
|
- result = s.getDatasFromMysql(MQFW, PushMysql, userId, pageNum, pageSize, selectTime, area, true)
|
|
|
- }
|
|
|
- if result == nil {
|
|
|
- result = []*SubPushList{}
|
|
|
- }
|
|
|
- hasNextPage = len(result) >= pageSize
|
|
|
- return
|
|
|
-}
|
|
|
-func (s *subscribePush) getDatasFromMysql(MQFW MongodbSim, PushMysql *mysql.Mysql, userId string, pageNum, myPageSize int, selectTime, area string, isLimit bool) (result []*SubPushList) {
|
|
|
- findSQL := "select id,date,infoid,isvisit,matchkeys,type,isvip from pushsubscribe where userid = '" + userId + "'"
|
|
|
- findStr := ""
|
|
|
- if selectTime != "" {
|
|
|
- startTime := selectTime + " 00:00:00"
|
|
|
- endTime := selectTime + " 23:59:59"
|
|
|
- st, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, time.Local)
|
|
|
- et, _ := time.ParseInLocation("2006-01-02 15:04:05", endTime, time.Local)
|
|
|
- findStr += " and date < " + fmt.Sprint(et.Unix()) + " and date >= " + fmt.Sprint(st.Unix())
|
|
|
- }
|
|
|
- if area != "" {
|
|
|
- findStr += " and city in ("
|
|
|
- var _area = ""
|
|
|
- for _, v := range strings.Split(area, ",") {
|
|
|
- if v == "全部" {
|
|
|
- continue
|
|
|
- }
|
|
|
- if _area != "" {
|
|
|
- _area += ","
|
|
|
- }
|
|
|
- _area += fmt.Sprint(PushMapping.City[v])
|
|
|
- }
|
|
|
- findStr += _area + ")"
|
|
|
- }
|
|
|
- start := (pageNum - 1) * myPageSize
|
|
|
- findStr += " order by id desc"
|
|
|
- if isLimit {
|
|
|
- findStr += " limit " + fmt.Sprint(start) + "," + fmt.Sprint(myPageSize)
|
|
|
- }
|
|
|
- findSQL = findSQL + findStr
|
|
|
- // log.Println("findsql:", findSQL)
|
|
|
- list := PushMysql.SelectBySql(findSQL)
|
|
|
- if len(*list) > 0 {
|
|
|
- pushCas := s.GetJyPushs(*list)
|
|
|
- result = s.GetInfoByIds(MQFW, pushCas)
|
|
|
- } else {
|
|
|
- result = []*SubPushList{}
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-//获取历史推送
|
|
|
-func (s *subscribePush) GetJyPushs(datas []map[string]interface{}) (pushCas []*PushCa) {
|
|
|
- pushCas = []*PushCa{}
|
|
|
- for _, v := range datas {
|
|
|
- pushCas = append(pushCas, &PushCa{
|
|
|
- Date: Int64All(v["date"]),
|
|
|
- InfoId: ObjToString(v["infoid"]),
|
|
|
- Visit: IntAll(v["isvisit"]),
|
|
|
- Index: Int64All(v["id"]),
|
|
|
- Keys: strings.Split(ObjToString(v["matchkeys"]), " "),
|
|
|
- Type: IntAll(v["type"]),
|
|
|
- Isvip: IntAll(v["isvip"]),
|
|
|
- })
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-//根据id取内容
|
|
|
-func (s *subscribePush) GetInfoByIds(MQFW MongodbSim, pushCas []*PushCa) []*SubPushList {
|
|
|
- array := make([]*SubPushList, 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
|
|
|
- } else {
|
|
|
- es_ids = append(es_ids, v)
|
|
|
- }
|
|
|
- }
|
|
|
- // log.Println(es_ids)
|
|
|
- //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 := ObjToString(v["_id"])
|
|
|
- infos[_id] = v
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //mongodb bidding
|
|
|
- mgo_ids := []primitive.ObjectID{}
|
|
|
- for _, v := range es_ids {
|
|
|
- if infos[v] == nil {
|
|
|
- oid, _ := primitive.ObjectIDFromHex(v)
|
|
|
- mgo_ids = append(mgo_ids, oid)
|
|
|
- }
|
|
|
- }
|
|
|
- if len(mgo_ids) > 0 {
|
|
|
- list, ok := MQFW.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 := BsonIdToSId(v["_id"])
|
|
|
- v["_id"] = _id
|
|
|
- infos[_id] = v
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //mongodb bidding_back
|
|
|
- mgo_back_ids := []primitive.ObjectID{}
|
|
|
- for _, v := range mgo_ids {
|
|
|
- if infos[BsonIdToSId(v)] == nil {
|
|
|
- mgo_back_ids = append(mgo_back_ids, v)
|
|
|
- }
|
|
|
- }
|
|
|
- if len(mgo_back_ids) > 0 {
|
|
|
- list, ok := MQFW.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 := 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
|
|
|
-}
|
|
|
-
|
|
|
-//保存最近7天的数据到历史记录
|
|
|
-func (s *subscribePush) MakeHistoryDatas(MQFW MongodbSim, PushMysql *mysql.Mysql, userId string, PushView func(userid, allquery, field string, pageNum, pageSize int) (keys []interface{}, list *[]map[string]interface{})) (bool, []*SubPushList) {
|
|
|
- log.Println("匹配最近7天数据", userId)
|
|
|
- field := `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount"`
|
|
|
- allquery := `{"range":{"publishtime":{"gt":%s}}}`
|
|
|
- allquery = fmt.Sprintf(allquery, fmt.Sprint(time.Now().AddDate(0, 0, -7).Unix()))
|
|
|
- //allquery = ``
|
|
|
- keys, list := PushView(userId, allquery, field, 1, 50)
|
|
|
- if list == nil || len(*list) == 0 {
|
|
|
- return true, nil
|
|
|
- }
|
|
|
- matchkeys := []string{}
|
|
|
- for _, v := range keys {
|
|
|
- matchkeys = append(matchkeys, strings.Join(ObjArrToStringArr(v.([]interface{})), "+"))
|
|
|
- }
|
|
|
- publishTitle := map[string]bool{}
|
|
|
- now := time.Now().Unix()
|
|
|
- var array []*SubPushList
|
|
|
- for i := len(*list) - 1; i >= 0; i-- {
|
|
|
- v := (*list)[i]
|
|
|
- var myInsert = make(map[string]interface{})
|
|
|
- title := strings.Replace(v["title"].(string), "\n", "", -1)
|
|
|
- area_check := ObjToString(v["area"])
|
|
|
- if area_check == "A" {
|
|
|
- area_check = "全国"
|
|
|
- }
|
|
|
- if publishTitle[area_check+title] {
|
|
|
- continue
|
|
|
- } else {
|
|
|
- publishTitle[area_check+title] = true
|
|
|
- }
|
|
|
- myInsert["userid"] = userId
|
|
|
- _id := ObjToString(v["_id"])
|
|
|
- myInsert["infoid"] = _id
|
|
|
- redisKey := fmt.Sprintf("pushinfo_%s_%s", userId, _id)
|
|
|
- if isExists, _ := redis.Exists("pushcache_2_a", redisKey); isExists {
|
|
|
- continue
|
|
|
- }
|
|
|
- myInsert["date"] = now
|
|
|
- myInsert["matchkeys"] = strings.Join(matchkeys, " ")
|
|
|
- if area_check != "" {
|
|
|
- if area_check == "全国" {
|
|
|
- myInsert["area"] = 0
|
|
|
- } else if area_mapping, ok := PushMapping.Area[area_check]; ok {
|
|
|
- myInsert["area"] = area_mapping
|
|
|
- }
|
|
|
- }
|
|
|
- if city_check := ObjToString(v["city"]); city_check != "" {
|
|
|
- if city_mapping, ok := PushMapping.City[city_check]; ok {
|
|
|
- myInsert["city"] = city_mapping
|
|
|
- }
|
|
|
- }
|
|
|
- if subtype := ObjToString(v["subtype"]); subtype != "" {
|
|
|
- if subtype_mapping, ok := PushMapping.Subtype[subtype]; ok {
|
|
|
- myInsert["subtype"] = subtype_mapping
|
|
|
- }
|
|
|
- }
|
|
|
- if toptype := ObjToString(v["toptype"]); toptype != "" {
|
|
|
- if toptype_mapping, ok := PushMapping.Toptype[toptype]; ok {
|
|
|
- myInsert["toptype"] = toptype_mapping
|
|
|
- }
|
|
|
- }
|
|
|
- if buyerclass := ObjToString(v["buyerclass"]); buyerclass != "" {
|
|
|
- if buyerclass_mapping, ok := PushMapping.Buyerclass[buyerclass]; ok {
|
|
|
- myInsert["buyerclass"] = buyerclass_mapping
|
|
|
- }
|
|
|
- }
|
|
|
- id := PushMysql.Insert("pushsubscribe", myInsert)
|
|
|
- if id > 0 {
|
|
|
- redis.Put("pushcache_2_a", redisKey, 1, 86400)
|
|
|
- } else {
|
|
|
- continue
|
|
|
- }
|
|
|
- array = append(array, s.InfoFormat(&PushCa{
|
|
|
- InfoId: _id,
|
|
|
- Date: now,
|
|
|
- Index: id,
|
|
|
- Keys: matchkeys,
|
|
|
- }, &v))
|
|
|
- }
|
|
|
- var resultList []*SubPushList
|
|
|
- for i := len(array) - 1; i >= 0; i-- {
|
|
|
- resultList = append(resultList, array[i])
|
|
|
- }
|
|
|
- return true, resultList
|
|
|
-}
|
|
|
-
|
|
|
-//获取用户信息
|
|
|
-func (s *subscribePush) UserInfo(MQFW MongodbSim, userId string) (*map[string]interface{}, int64) {
|
|
|
- user, ok := MQFW.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}`)
|
|
|
- if !ok || user == nil {
|
|
|
- return nil, 0
|
|
|
- }
|
|
|
- return user, Int64All((*user)["l_firstpushtime"])
|
|
|
-}
|
|
|
-func (s *subscribePush) Visit(PushMysql *mysql.Mysql, userId string, id int) {
|
|
|
- if userId == "" {
|
|
|
- return
|
|
|
- }
|
|
|
- PushMysql.UpdateOrDeleteBySql("update pushsubscribe set isvisit=1 where userid=? and id=?", userId, id)
|
|
|
- todaySubPush, err := s.GetTodayCache(userId)
|
|
|
- if err == nil && todaySubPush != nil {
|
|
|
- for _, v := range todaySubPush.Datas {
|
|
|
- if v.Ca_index == Int64All(id) {
|
|
|
- v.Ca_isvisit = 1
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- s.PutTodayCache(userId, todaySubPush)
|
|
|
- }
|
|
|
- //
|
|
|
- allSubPush, err := s.GetAllCache(userId)
|
|
|
- if err == nil && allSubPush != nil {
|
|
|
- for _, v := range allSubPush {
|
|
|
- if v.Ca_index == Int64All(id) {
|
|
|
- v.Ca_isvisit = 1
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- s.PutAllCache(userId, allSubPush)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//查看全部列表缓存
|
|
|
-func (s *subscribePush) allKey(userId string) string {
|
|
|
- return fmt.Sprintf("all_subpush_%s", userId)
|
|
|
-}
|
|
|
-
|
|
|
-func (s *subscribePush) PutAllCache(userId string, datas []*SubPushList) {
|
|
|
- redis.Put("pushcache_2_a", s.allKey(userId), datas, threeDay)
|
|
|
-}
|
|
|
-
|
|
|
-func (s *subscribePush) GetAllCache(userId string) ([]*SubPushList, error) {
|
|
|
- return s.GetCache("pushcache_2_a", s.allKey(userId))
|
|
|
-}
|
|
|
-
|
|
|
-//最近7天50条缓存
|
|
|
-func (s *subscribePush) sevenDayKey(userId string) string {
|
|
|
- return fmt.Sprintf("7day_subpush_%s", userId)
|
|
|
-}
|
|
|
-
|
|
|
-func (s *subscribePush) PutSevenDayCache(userId string, datas []*SubPushList) {
|
|
|
- redis.Put("pushcache_2_a", s.sevenDayKey(userId), datas, 7*24*60*60)
|
|
|
-}
|
|
|
-
|
|
|
-//从pushcache_2_a中取
|
|
|
-func (s *subscribePush) GetSevenDayCache(userId string) ([]*SubPushList, error) {
|
|
|
- return s.GetCache("pushcache_2_a", s.sevenDayKey(userId))
|
|
|
-}
|
|
|
-
|
|
|
-func (s *subscribePush) GetCache(code, key string) ([]*SubPushList, error) {
|
|
|
- pc_a, err := redis.GetNewBytes(code, key)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
- if pc_a == nil {
|
|
|
- return nil, nil
|
|
|
- }
|
|
|
- var p []*SubPushList
|
|
|
- if err := json.Unmarshal(*pc_a, &p); err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
- return p, nil
|
|
|
-}
|