🎨 新增余额记录功能

This commit is contained in:
2025-09-10 00:33:06 +08:00
parent c588e9efe7
commit b8b859f890
7 changed files with 122 additions and 4 deletions

View File

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