fix
This commit is contained in:
parent
10f401066b
commit
2f839ac85b
|
@ -62,8 +62,10 @@ func (m *FsUserMaterialModel) FindLatestOne(ctx context.Context, userId int64, g
|
|||
var cond string
|
||||
if userId != 0 {
|
||||
cond = fmt.Sprintf("user_id = %d", userId)
|
||||
} else {
|
||||
} else if guestId != 0 {
|
||||
cond = fmt.Sprintf("guest_id = %d", guestId)
|
||||
} else {
|
||||
cond = fmt.Sprintf("user_id = %d and guest_id = %d", userId, guestId)
|
||||
}
|
||||
db := m.db.WithContext(ctx).Model(&FsUserMaterial{}).
|
||||
Where(cond).
|
||||
|
@ -80,8 +82,10 @@ func (m *FsUserMaterialModel) GetListByUser(ctx context.Context, userId, guestId
|
|||
var cond string
|
||||
if userId != 0 {
|
||||
cond = fmt.Sprintf("user_id = %d", userId)
|
||||
} else {
|
||||
} else if guestId != 0 {
|
||||
cond = fmt.Sprintf("guest_id = %d", guestId)
|
||||
} else {
|
||||
cond = fmt.Sprintf("user_id = %d and guest_id = %d", userId, guestId)
|
||||
}
|
||||
err = m.db.WithContext(ctx).Model(&FsUserMaterial{}).
|
||||
Where(cond).Order("id DESC").Limit(limit).Find(&resp).Error
|
||||
|
|
Loading…
Reference in New Issue
Block a user