card_set_stars.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package show
  2. import (
  3. "go-common/app/admin/main/feed/model/common"
  4. "go-common/app/admin/main/feed/model/show"
  5. "go-common/library/log"
  6. )
  7. // PopularStarsAdd add popuar stars card
  8. func (d *Dao) PopularStarsAdd(param *show.PopularStarsAP) (err error) {
  9. if err = d.DB.Create(param).Error; err != nil {
  10. log.Error("dao.show.PopularStarsAdd error(%v)", err)
  11. return
  12. }
  13. return
  14. }
  15. // PopularStarsUpdate update popuar stars card
  16. func (d *Dao) PopularStarsUpdate(param *show.PopularStarsUP) (err error) {
  17. if err = d.DB.Model(&show.PopularStarsUP{}).Update(param).Error; err != nil {
  18. log.Error("dao.show.PopularStarsUpdate error(%v)", err)
  19. return
  20. }
  21. return
  22. }
  23. // PopularStarsDelete delete popuar stars card
  24. func (d *Dao) PopularStarsDelete(id int64, t string) (err error) {
  25. up := map[string]interface{}{
  26. "deleted": common.Deleted,
  27. }
  28. w := map[string]interface{}{
  29. "id": id,
  30. "type": t,
  31. }
  32. if err = d.DB.Model(&show.PopularStars{}).Where(w).Update(up).Error; err != nil {
  33. log.Error("dao.show.PopularStarsDelete error(%v)", err)
  34. return
  35. }
  36. return
  37. }
  38. // PopularStarsReject reject popuar stars card
  39. func (d *Dao) PopularStarsReject(id int64, t string) (err error) {
  40. up := map[string]interface{}{
  41. "status": common.Rejecte,
  42. }
  43. w := map[string]interface{}{
  44. "id": id,
  45. "type": t,
  46. }
  47. if err = d.DB.Model(&show.PopularStars{}).Where(w).Update(up).Error; err != nil {
  48. log.Error("dao.show.PopularStarsReject error(%v)", err)
  49. return
  50. }
  51. return
  52. }