utility.go 457 B

123456789101112131415161718192021
  1. package utility
  2. import (
  3. "context"
  4. "github.com/gogf/gf/v2/frame/g"
  5. )
  6. //获取我的收藏
  7. func GetMyBidCollect(ctx context.Context, positionId int64) map[string]bool {
  8. m := map[string]bool{}
  9. res, err := g.DB().GetArray(ctx, `select bid from jianyu.bdcollection where userid=?`, positionId)
  10. if err != nil {
  11. g.Log().Error(ctx, positionId, "查询标讯收藏出错", err)
  12. return m
  13. }
  14. for _, v := range res {
  15. m[v.String()] = true
  16. }
  17. return m
  18. }