|
@@ -37,6 +37,7 @@ type SubPushList struct {
|
|
|
Matchkeys []string `json:"matchkeys"`
|
|
|
Budget interface{} `json:"budget"`
|
|
|
Bidamount interface{} `json:"bidamount"`
|
|
|
+ Collection int `json:"collection"`
|
|
|
}
|
|
|
|
|
|
const (
|
|
@@ -624,6 +625,36 @@ func (s *subscribePush) GetCache(code, key string) ([]*SubPushList, error) {
|
|
|
return p, nil
|
|
|
}
|
|
|
|
|
|
+//是否收藏
|
|
|
+func (s *subscribePush) MakeCollection(userId string, m *mysql.Mysql, list []*SubPushList) {
|
|
|
+ if list == nil || len(list) == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ param := []interface{}{userId}
|
|
|
+ wh := []string{}
|
|
|
+ for _, v := range list {
|
|
|
+ array := DecodeArticleId2ByCheck(v.Id)
|
|
|
+ if len(array) == 1 && array[0] != "" {
|
|
|
+ param = append(param, array[0])
|
|
|
+ wh = append(wh, "?")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(wh) > 0 {
|
|
|
+ result := m.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[EncodeArticleId2ByCheck(ObjToString(v["bid"]))] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, v := range list {
|
|
|
+ if bid_map[v.Id] {
|
|
|
+ v.Collection = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//历史推送记录中单条信息格式化
|
|
|
func InfoFormats(info map[string]interface{}, tmp map[string]interface{}) map[string]interface{} {
|
|
|
area := ObjToString(info["area"])
|