welcome page update

This commit is contained in:
Simon Ding
2024-07-05 17:47:07 +08:00
parent 2cdb2b3332
commit c703552267
16 changed files with 516 additions and 86 deletions

View File

@@ -12,6 +12,7 @@ func HttpHandler(f func(*gin.Context) (interface{}, error)) gin.HandlerFunc {
r, err := f(ctx)
if err != nil {
log.Errorf("url %v return error: %v", ctx.Request.URL, err)
ctx.JSON(200, Response{
Code: 1,
Message: fmt.Sprintf("%v", err),

View File

@@ -31,17 +31,19 @@ type addWatchlistIn struct {
func (s *Server) AddWatchlist(c *gin.Context) (interface{}, error) {
var in addWatchlistIn
if err := c.ShouldBindQuery(&in); err != nil {
if err := c.ShouldBindJSON(&in); err != nil {
return nil, errors.Wrap(err, "bind query")
}
detail, err := s.MustTMDB().GetTvDetails(in.ID, s.language)
if err != nil {
return nil, errors.Wrap(err, "get tv detail")
}
log.Infof("find detail for tv id %d: %v", in.ID, detail)
if err := s.db.AddWatchlist(in.RootFolder, detail); err != nil {
return nil, errors.Wrap(err, "add to list")
}
log.Infof("save watchlist success: %s", detail.Name)
for _, season := range detail.Seasons {
seasonId := season.SeasonNumber