面包店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 regels
1.0 KiB

  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. }