wangchuanjin 4 éve
szülő
commit
11750c8b81

+ 2 - 0
src/jfw/front/swordfish.go

@@ -1981,6 +1981,7 @@ func (f *Front) HasPushHistory() {
 			}
 		}
 	}
+	jy.SubscribePush.MakeCollection(userId, public.Mysql, list)
 	//
 	f.ServeJson(map[string]interface{}{
 		"haskey":      hasKeyFlag,
@@ -2095,6 +2096,7 @@ func (f *Front) HistorypushPaging() error {
 			Subscopeclass: f.GetString("subscopeclass"),
 			Key:           f.GetString("key"),
 		})
+		jy.SubscribePush.MakeCollection(userId, public.Mysql, list)
 		//		hasNextPage, list, _ := public.HistoryPush.Datas(userId, pageNum, firstPushTime, formatTime)
 		f.ServeJson(map[string]interface{}{
 			"hasNextPage": hasNextPage,

+ 2 - 0
src/jfw/modules/app/src/app/front/swordfish.go

@@ -448,6 +448,7 @@ func (f *Front) HasPushHistory() {
 		Key:           f.GetString("key"),
 	}
 	hasNextPage, list := jy.SubscribePush.Datas(spqp)
+	jy.SubscribePush.MakeCollection(userId, public.Mysql, list)
 	//首次用户推送查询“其他”
 	t, _ := time.ParseInLocation("2006-01-02", time.Now().Format("2006-01-02"), time.Local)
 	today_1 := t.Unix()
@@ -532,6 +533,7 @@ func (f *Front) HistorypushPaging() error {
 		Subscopeclass: f.GetString("subscopeclass"),
 		Key:           f.GetString("key"),
 	})
+	jy.SubscribePush.MakeCollection(userId, public.Mysql, list)
 	f.ServeJson(map[string]interface{}{
 		"hasNextPage": hasNextPage,
 		"data":        list,

+ 31 - 0
src/jfw/modules/common/src/qfw/util/jy/subscribepush.go

@@ -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"])