123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package model
- import (
- MC "app.yhyue.com/moapp/jybase/common"
- ME "app.yhyue.com/moapp/jybase/encrypt"
- "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXBase/rpc/bxbase"
- IC "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXBase/rpc/init"
- "strings"
- )
- //是否收藏
- func MakeCollection(userId string, list []*bxbase.NewestList) {
- if list == nil || len(list) == 0 {
- return
- }
- param := []interface{}{userId}
- wh := []string{}
- for _, v := range list {
- array := ME.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[ME.EncodeArticleId2ByCheck(MC.ObjToString(v["bid"]))] = true
- }
- }
- for _, v := range list {
- if !IC.C.FileSignBool {
- v.FileExists = false
- }
- if bid_map[v.Id] {
- v.IsCol = true
- }
- }
- }
- }
|