123456789101112131415161718192021222324252627282930313233 |
- package user_record
- import "hongze/hongze_yb/global"
- // GetByUserId 根据用户id和平台id获取用户关系
- func GetByUserId(userId, platform int) (item *UserRecord, err error) {
- err = global.DEFAULT_MYSQL.Where("user_id = ? and create_platform = ?", userId, platform).First(&item).Error
- return
- }
- // GetByUnionID 根据用户UnionID和平台id获取用户关系
- func GetByUnionID(unionID string, platform int) (item *UserRecord, err error) {
- err = global.DEFAULT_MYSQL.Where("union_id = ? and create_platform = ?", unionID, platform).First(&item).Error
- return
- }
- // GetByOpenID 根据用户OpenID获取用户关系
- func GetByOpenID(openID string) (item *UserRecord, err error) {
- err = global.DEFAULT_MYSQL.Where("open_id = ? ", openID).First(&item).Error
- return
- }
- // GetUserThirdRecordByUserId 获取该用户第一个的 三方信息(微信头像信息)
- func GetUserThirdRecordByUserId(userId int) (item *UserRecord, err error) {
- err = global.DEFAULT_MYSQL.Where("user_id = ? ", userId).Order("user_record_id asc").First(&item).Error
- return
- }
- // GetFirstByUnionID 根据用户UnionID获取最小平台的用户关系(已经绑定了user_id的)
- func GetFirstByUnionID(unionID string) (item *UserRecord, err error) {
- err = global.DEFAULT_MYSQL.Where("union_id = ? and user_id>0", unionID).Order("create_platform asc").First(&item).Error
- return
- }
|