Storereopen.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 数据层模型
  13. */
  14. class Storereopen extends BaseModel {
  15. public $page_info;
  16. /**
  17. * 取得列表
  18. * @access public
  19. * @author csdeshang
  20. * @param array $condition 条件
  21. * @param int $pagesize 分页
  22. * @param string $order 排序
  23. * @return array
  24. */
  25. public function getStorereopenList($condition = array(), $pagesize = '', $order = 'storereopen_id desc') {
  26. if($pagesize){
  27. $result = Db::name('storereopen')->where($condition)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  28. $this->page_info = $result;
  29. return $result->items();
  30. }else{
  31. return Db::name('storereopen')->where($condition)->order($order)->select()->toArray();
  32. }
  33. }
  34. /**
  35. * 增加新记录
  36. * @access public
  37. * @author csdeshang
  38. * @param arrat $data 参数内容
  39. * @return bool
  40. */
  41. public function addStorereopen($data) {
  42. return Db::name('storereopen')->insertGetId($data);
  43. }
  44. /**
  45. * 取单条信息
  46. * @access public
  47. * @author csdeshang
  48. * @param type $condition 条件
  49. * @return type
  50. */
  51. public function getStorereopenInfo($condition) {
  52. return Db::name('storereopen')->where($condition)->find();
  53. }
  54. /**更新记录
  55. * @access public
  56. * @author csdeshang
  57. * @param type $data 更新数据
  58. * @param type $condition 条件
  59. * @return type
  60. */
  61. public function editStorereopen($data, $condition) {
  62. return Db::name('storereopen')->where($condition)->update($data);
  63. }
  64. /**
  65. * 取得数量
  66. * @access public
  67. * @author csdeshang
  68. * @param array $condition 条件
  69. * @return int
  70. */
  71. public function getStorereopenCount($condition) {
  72. return Db::name('storereopen')->where($condition)->count();
  73. }
  74. /**
  75. * 删除记录
  76. * @access public
  77. * @author csdeshang
  78. * @param array $condition 条件
  79. * @return bool
  80. */
  81. public function delStorereopen($condition) {
  82. return Db::name('storereopen')->where($condition)->delete();
  83. }
  84. }