share.go 449 B

12345678910111213141516171819
  1. package service
  2. import (
  3. "context"
  4. artmdl "go-common/app/interface/openplatform/article/model"
  5. "go-common/library/ecode"
  6. )
  7. // AddShare adds share stats count.
  8. func (s *Service) AddShare(c context.Context, id int64, mid int64, ip string) (err error) {
  9. var res *artmdl.Meta
  10. if res, err = s.ArticleMeta(c, id); (err != nil) || (res == nil) || (!res.IsNormal()) {
  11. err = ecode.NothingFound
  12. return
  13. }
  14. s.dao.PubShare(c, mid, id, ip)
  15. return
  16. }