Groupbuypricerange.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 数据层模型
  10. */
  11. class Groupbuypricerange extends BaseModel
  12. {
  13. public $page_info;
  14. /**
  15. * 读取列表
  16. * @access public
  17. * @author csdeshang
  18. * @param array $condition 条件
  19. * @param int $pagesize 分页
  20. * @param string $order 排序
  21. * @return array
  22. */
  23. public function getGroupbuypricerangeList($condition = array(), $pagesize = '', $order = 'gprange_id desc')
  24. {
  25. if ($pagesize) {
  26. $res = Db::name('groupbuypricerange')->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  27. $this->page_info = $res;
  28. return $res->items();
  29. } else {
  30. return Db::name('groupbuypricerange')->where($condition)->order($order)->select()->toArray();
  31. }
  32. }
  33. /**
  34. * 根据编号获取单个内容
  35. * @access public
  36. * @author csdeshang
  37. * @param int $id 主键编号
  38. * @return array 数组类型的返回结果
  39. */
  40. public function getOneGroupbuypricerange($id)
  41. {
  42. $result = Db::name('groupbuypricerange')->where('gprange_id', intval($id))->find();
  43. return $result;
  44. }
  45. /**
  46. * 判断是否存在
  47. * @access public
  48. * @author csdeshang
  49. * @param type $condition 条件
  50. * @return bool
  51. */
  52. public function isGroupbuypricerangeExist($condition = '')
  53. {
  54. $list = Db::name('groupbuypricerange')->where($condition)->select()->toArray();
  55. return $list;
  56. }
  57. /**
  58. * 增加
  59. * @access public
  60. * @author csdeshang
  61. * @param array $data 参数内容
  62. * @return bool
  63. */
  64. public function addGroupbuypricerange($data)
  65. {
  66. return Db::name('groupbuypricerange')->insertGetId($data);
  67. }
  68. /**
  69. * 更新
  70. * @param array $update_array 更新数据
  71. * @param array $where_array 更新条件
  72. * @return bool
  73. */
  74. public function editGroupbuypricerange($update_array, $where_array)
  75. {
  76. return Db::name('groupbuypricerange')->where($where_array)->update($update_array);
  77. }
  78. /**
  79. * 删除
  80. * @access public
  81. * @author csdeshang
  82. * @param array $condition 检索条件
  83. * @return bool
  84. */
  85. public function delGroupbuypricerange($condition)
  86. {
  87. return Db::name('groupbuypricerange')->where($condition)->delete();
  88. }
  89. }