面包店
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

dbs_user_profile.go 1.0 KiB

pirms 9 mēnešiem
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package db
  2. import (
  3. "xorm.io/xorm"
  4. "applet/app/db/model"
  5. "applet/app/utils/logx"
  6. )
  7. // UserProfileFindByIDs is in sql by ids
  8. func DbsUserProfileFindByIDs(eg *xorm.Engine, uids ...int) (*[]model.UserProfile, error) {
  9. var m []model.UserProfile
  10. if err := eg.In("uid", uids).Find(&m); err != nil {
  11. return nil, logx.Warn(err)
  12. }
  13. return &m, nil
  14. }
  15. func DbsUserProfileFindByIDsList(eg *xorm.Engine, uids []int) (*[]model.UserProfile, error) {
  16. var m []model.UserProfile
  17. col := "uid"
  18. if err := eg.In(col, uids).Find(&m); err != nil {
  19. return nil, logx.Warn(err)
  20. }
  21. if len(m) == 0 {
  22. return nil, nil
  23. }
  24. return &m, nil
  25. }
  26. func DbsUserProfileFindByTbPids(eg *xorm.Engine, pids []int64, isShare bool) (*[]model.UserProfile, error) {
  27. var m []model.UserProfile
  28. col := "acc_taobao_self_id"
  29. col_where := "acc_taobao_self_id>0"
  30. if isShare {
  31. col = "acc_taobao_share_id"
  32. col_where = "acc_taobao_share_id>0"
  33. }
  34. if err := eg.Where(col_where).In(col, pids).Find(&m); err != nil {
  35. return nil, logx.Warn(err)
  36. }
  37. if len(m) == 0 {
  38. return nil, nil
  39. }
  40. return &m, nil
  41. }