Comment.php 635 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\store\model;
  10. use app\common\model\Comment as CommentModel;
  11. /**
  12. * 商品评价模型
  13. * Class Comment
  14. * @package app\store\model
  15. */
  16. class Comment extends CommentModel
  17. {
  18. /**
  19. * 软删除
  20. * @return false|int
  21. */
  22. public function setDelete()
  23. {
  24. return $this->save(['is_delete' => 1]);
  25. }
  26. /**
  27. * 获取评价总数量
  28. * @return int|string
  29. */
  30. public function getCommentTotal()
  31. {
  32. return $this->where(['is_delete' => 0])->count();
  33. }
  34. }