书籍列表接口新增参数

This commit is contained in:
2025-08-13 15:19:42 +08:00
parent 6ccc87f2bf
commit 8afe651c64
201 changed files with 6987 additions and 1066 deletions

View File

@ -0,0 +1,36 @@
package userreadhistory
import (
"context"
"server/internal/dao"
"server/internal/model"
"server/internal/service"
"server/utility/ecode"
)
type sUserReadHistory struct{}
func New() service.IUserReadHistory {
return &sUserReadHistory{}
}
func init() {
service.RegisterUserReadHistory(New())
}
func (s *sUserReadHistory) Remove(ctx context.Context, in *model.UserReadHistoryDelIn) (out *model.UserReadHistoryCRUDOut, err error) {
// 参数校验
if in.UserId == 0 || len(in.BookIds) == 0 {
return nil, ecode.Params.Sub("user_read_history_remove_param_invalid")
}
_, err = dao.UserReadHistory.Ctx(ctx).
Where(dao.UserReadHistory.Columns().UserId, in.UserId).
WhereIn(dao.UserReadHistory.Columns().BookId, in.BookIds).
Delete()
if err != nil {
return nil, ecode.Fail.Sub("user_read_history_remove_failed")
}
return &model.UserReadHistoryCRUDOut{Success: true}, nil
}