Groupbuypricerange.php 2.8 KB

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