StoreService.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. * DSKMS多用户商城
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 数据层模型
  13. */
  14. class StoreService extends BaseModel
  15. {
  16. public $page_info;
  17. public function getStoreServiceList($condition, $field = '*', $pagesize = 10, $order = 'store_service_id asc')
  18. {
  19. if ($pagesize) {
  20. $result = Db::name('store_service')->field($field)->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  21. $this->page_info = $result;
  22. return $result->items();
  23. } else {
  24. $result = Db::name('store_service')->field($field)->where($condition)->order($order)->select()->toArray();
  25. return $result;
  26. }
  27. }
  28. /**
  29. * 取单个内容
  30. * @access public
  31. * @author csdeshang
  32. * @param int $id 分类ID
  33. * @return array 数组类型的返回结果
  34. */
  35. public function getStoreServiceInfo($condition)
  36. {
  37. $result = Db::name('store_service')->where($condition)->find();
  38. return $result;
  39. }
  40. /**
  41. * 新增
  42. * @access public
  43. * @author csdeshang
  44. * @param array $data 参数内容
  45. * @return bool 布尔类型的返回结果
  46. */
  47. public function addStoreService($data)
  48. {
  49. $result = Db::name('store_service')->insertGetId($data);
  50. return $result;
  51. }
  52. /**
  53. * 更新信息
  54. * @access public
  55. * @author csdeshang
  56. * @param array $data 数据
  57. * @param array $condition 条件
  58. * @return bool
  59. */
  60. public function editStoreService($data, $condition)
  61. {
  62. $result = Db::name('store_service')->where($condition)->update($data);
  63. return $result;
  64. }
  65. /**
  66. * 删除分类
  67. * @access public
  68. * @author csdeshang
  69. * @param int $condition 记录ID
  70. * @return bool
  71. */
  72. public function delStoreService($condition)
  73. {
  74. return Db::name('store_service')->where($condition)->delete();
  75. }
  76. }