Storeclass.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 Storeclass extends BaseModel {
  16. public $page_info;
  17. /**
  18. * 取店铺类别列表
  19. * @access public
  20. * @author csdeshang
  21. * @param type $condition 条件
  22. * @param type $pagesize 分页
  23. * @param type $limit 限制
  24. * @param type $order 排序
  25. * @return type
  26. */
  27. public function getStoreclassList($condition = array(), $pagesize = '', $limit = 0, $order = 'storeclass_sort asc,storeclass_id asc') {
  28. if($pagesize){
  29. $list = Db::name('storeclass')->where($condition)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  30. $this->page_info = $list;
  31. return $list->items();
  32. }else{
  33. return Db::name('storeclass')->where($condition)->order($order)->limit($limit)->select()->toArray();
  34. }
  35. }
  36. /**
  37. * 取得单条信息
  38. * @access public
  39. * @author csdeshang
  40. * @param type $condition 条件
  41. * @return type
  42. */
  43. public function getStoreclassInfo($condition = array()) {
  44. return Db::name('storeclass')->where($condition)->find();
  45. }
  46. /**
  47. * 删除类别
  48. * @access public
  49. * @author csdeshang
  50. * @param type $condition 条件
  51. * @return type
  52. */
  53. public function delStoreclass($condition = array()) {
  54. return Db::name('storeclass')->where($condition)->delete();
  55. }
  56. /**
  57. * 增加店铺分类
  58. * @access public
  59. * @author csdeshang
  60. * @param array $data 数据
  61. * @return bool
  62. */
  63. public function addStoreclass($data) {
  64. return Db::name('storeclass')->insertGetId($data);
  65. }
  66. /**
  67. * 更新分类
  68. * @access public
  69. * @author csdeshang
  70. * @param array $data 数据
  71. * @param array $condition 条件
  72. * @return bool
  73. */
  74. public function editStoreclass($data = array(),$condition = array()) {
  75. return Db::name('storeclass')->where($condition)->update($data);
  76. }
  77. }
  78. ?>