|
- package db
-
- import (
- "xorm.io/xorm"
-
- "applet/app/db/model"
- "applet/app/utils/logx"
- )
-
- // UserProfileFindByIDs is in sql by ids
- func DbsUserProfileFindByIDs(eg *xorm.Engine, uids ...int) (*[]model.UserProfile, error) {
- var m []model.UserProfile
- if err := eg.In("uid", uids).Find(&m); err != nil {
- return nil, logx.Warn(err)
- }
- return &m, nil
- }
- func DbsUserProfileFindByIDsList(eg *xorm.Engine, uids []int) (*[]model.UserProfile, error) {
- var m []model.UserProfile
- col := "uid"
- if err := eg.In(col, uids).Find(&m); err != nil {
- return nil, logx.Warn(err)
- }
- if len(m) == 0 {
- return nil, nil
- }
- return &m, nil
- }
- func DbsUserProfileFindByTbPids(eg *xorm.Engine, pids []int64, isShare bool) (*[]model.UserProfile, error) {
- var m []model.UserProfile
- col := "acc_taobao_self_id"
- col_where := "acc_taobao_self_id>0"
- if isShare {
- col = "acc_taobao_share_id"
- col_where = "acc_taobao_share_id>0"
- }
- if err := eg.Where(col_where).In(col, pids).Find(&m); err != nil {
- return nil, logx.Warn(err)
- }
- if len(m) == 0 {
- return nil, nil
- }
- return &m, nil
- }
|