🎨 新增余额记录功能
This commit is contained in:
@@ -375,6 +375,7 @@ func (u *AppUserService) IsFollowTeacher(userId, teacherId uint) (bool, error) {
|
||||
return count > 0, nil
|
||||
}
|
||||
|
||||
// GetVipTeacherList 获取用户购买的讲师VIP列表
|
||||
func (u *AppUserService) GetVipTeacherList(p common.PageInfo, userId uint) (list []vo.TeacherInfo, total int64, err error) {
|
||||
limit := p.PageSize
|
||||
offset := (p.Page - 1) * p.PageSize
|
||||
@@ -416,3 +417,24 @@ func (u *AppUserService) GetVipTeacherList(p common.PageInfo, userId uint) (list
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetBalanceLog 获取用户余额变动日志
|
||||
func (u *AppUserService) GetBalanceLog(id uint, p common.PageInfo) (list []app.BalanceLog, total int64, err error) {
|
||||
limit := p.PageSize
|
||||
offset := (p.Page - 1) * p.PageSize
|
||||
|
||||
db := global.GVA_DB.Model(&app.BalanceLog{}).Where("user_id = ?", id)
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询余额变动总数失败", zap.Error(err))
|
||||
return nil, 0, err
|
||||
}
|
||||
err = db.Limit(limit).Offset(offset).Order("created_at desc").Find(&list).Error
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询余额变动列表失败", zap.Error(err))
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user