Storesnscomment.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class Storesnscomment extends BaseModel
  16. {
  17. public $page_info;
  18. /**
  19. * 店铺动态评论列表
  20. * @access public
  21. * @author csdeshang
  22. * @param array $condition 条件
  23. * @param string $field 字段
  24. * @param string $order 排序
  25. * @param int $limit 限制
  26. * @param int $pagesize 分页
  27. * @return array
  28. */
  29. public function getStoresnscommentList($condition, $field = '*', $order = 'storesnscomm_id desc', $limit = 0, $pagesize = 0) {
  30. if($pagesize){
  31. $res= Db::name('storesnscomment')->where($condition)->field($field)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  32. $this->page_info=$res;
  33. return $res->items();
  34. }else{
  35. return Db::name('storesnscomment')->where($condition)->field($field)->order($order)->select()->toArray();
  36. }
  37. }
  38. /**
  39. * 店铺评论数量
  40. * @access public
  41. * @author csdeshang
  42. * @param type $condition 条件
  43. * @return type
  44. */
  45. public function getStoresnscommentCount($condition) {
  46. return Db::name('storesnscomment')->where($condition)->count();
  47. }
  48. /**
  49. * 获取单条评论
  50. * @access public
  51. * @author csdeshang
  52. * @param array $condition 条件
  53. * @param string $field 字段
  54. * @return array
  55. */
  56. public function getStoresnscommentInfo($condition, $field = '*') {
  57. return Db::name('storesnscomment')->where($condition)->field($field)->find();
  58. }
  59. /**
  60. * 保存店铺评论
  61. * @access public
  62. * @author csdeshang
  63. * @param array $data 数据
  64. * @return boolean
  65. */
  66. public function addStoresnscomment($data) {
  67. return Db::name('storesnscomment')->insertGetId($data);
  68. }
  69. /**
  70. * 更新店铺评论
  71. * @access public
  72. * @author csdeshang
  73. * @param type $update 更新数据
  74. * @param type $condition 条件
  75. * @return type
  76. */
  77. public function editStoresnscomment($update, $condition) {
  78. return Db::name('storesnscomment')->where($condition)->update($update);
  79. }
  80. /**
  81. * 删除店铺动态评论
  82. * @access public
  83. * @author csdeshang
  84. * @param array $condition 条件
  85. * @return boolean
  86. */
  87. public function delStoresnscomment($condition) {
  88. return Db::name('storesnscomment')->where($condition)->delete();
  89. }
  90. }