22 lines
546 B
Go
22 lines
546 B
Go
package book
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"server/internal/model"
|
|
"server/internal/service"
|
|
|
|
"server/api/book/v1"
|
|
)
|
|
|
|
func (c *ControllerV1) HistoryRemove(ctx context.Context, req *v1.HistoryRemoveReq) (res *v1.HistoryRemoveRes, err error) {
|
|
userId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
|
out, err := service.UserReadHistory().Remove(ctx, &model.UserReadHistoryDelIn{BookIds: req.BookIds, UserId: userId})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.HistoryRemoveRes{
|
|
Success: out.Success,
|
|
}, nil
|
|
}
|