Comment.php 526 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\store\model;
  3. use app\common\model\Comment as CommentModel;
  4. /**
  5. * 商品评价模型
  6. * Class Comment
  7. * @package app\store\model
  8. */
  9. class Comment extends CommentModel
  10. {
  11. /**
  12. * 软删除
  13. * @return false|int
  14. */
  15. public function setDelete()
  16. {
  17. return $this->save(['is_delete' => 1]);
  18. }
  19. /**
  20. * 获取评价总数量
  21. * @return int|string
  22. */
  23. public function getCommentTotal()
  24. {
  25. return $this->where(['is_delete' => 0])->count();
  26. }
  27. }