Storemsg.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 Storemsg extends BaseModel
  16. {
  17. public $page_info;
  18. /**
  19. * 新增店铺消息
  20. * @access public
  21. * @author csdeshang
  22. * @param array $data 参数内容
  23. * @return type
  24. */
  25. public function addStoremsg($data) {
  26. $data['storemsg_addtime'] = TIMESTAMP;
  27. $storemsg_id = Db::name('storemsg')->insertGetId($data);
  28. return $storemsg_id;
  29. }
  30. /**
  31. * 更新店铺消息表
  32. * @access public
  33. * @author csdeshang
  34. * @param array $condition 条件
  35. * @param array $update 更新数据
  36. * @return bool
  37. */
  38. public function editStoremsg($condition, $update) {
  39. return Db::name('storemsg')->where($condition)->update($update);
  40. }
  41. /**
  42. * 查看店铺消息详细
  43. * @access public
  44. * @author csdeshang
  45. * @param unknown $condition 条件
  46. * @param string $field 字段
  47. * @return bool
  48. */
  49. public function getStoremsgInfo($condition, $field = '*') {
  50. return Db::name('storemsg')->field($field)->where($condition)->find();
  51. }
  52. /**
  53. * 店铺消息列表
  54. * @access public
  55. * @author csdeshang
  56. * @param type $condition 条件
  57. * @param type $field 字段
  58. * @param type $pagesize 分页
  59. * @param type $order 排序
  60. * @return type
  61. */
  62. public function getStoremsgList($condition, $field = '*', $pagesize = '0', $order = 'storemsg_id desc') {
  63. $return =Db::name('storemsg')->field($field)->where($condition)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  64. $this->page_info=$return;
  65. return $return->items();
  66. }
  67. /**
  68. * 计算消息数量
  69. * @access public
  70. * @author csdeshang
  71. * @param array $condition 条件
  72. * @return int
  73. */
  74. public function getStoremsgCount($condition) {
  75. return Db::name('storemsg')->where($condition)->count();
  76. }
  77. /**
  78. * 删除店铺消息
  79. * @access public
  80. * @author csdeshang
  81. * @param type $condition 条件
  82. * @return bool
  83. */
  84. public function delStoremsg($condition) {
  85. Db::name('storemsg')->where($condition)->delete();
  86. }
  87. }