Arrivalnotice.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 数据层模型
  13. */
  14. class Arrivalnotice extends BaseModel
  15. {
  16. /**
  17. * 通知列表
  18. * @access public
  19. * @author csdeshang
  20. * @param array $condition 条件
  21. * @param string $field 字段
  22. * @param number $limit 数量限制
  23. * @param string $order 排序
  24. * @return array
  25. */
  26. public function getArrivalNoticeList($condition = array(), $field = '*', $limit = 0, $order = 'arrivalnotice_id desc', $pagesize = '')
  27. {
  28. if ($pagesize) {
  29. $result = Db::name('arrivalnotice')->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  30. $this->page_info = $result;
  31. return $result->items();
  32. } else {
  33. return Db::name('arrivalnotice')->where($condition)->field($field)->limit($limit)->order($order)->select()->toArray();
  34. }
  35. }
  36. /**
  37. * 单条通知
  38. * @access public
  39. * @author csdeshang
  40. * @param array $condition 查询条件
  41. * @param string $field 字段
  42. * @return type
  43. */
  44. public function getArrivalNoticeInfo($condition, $field = '*')
  45. {
  46. return Db::name('arrivalnotice')->where($condition)->field($field)->find();
  47. }
  48. /**
  49. * 通知数量
  50. * @access public
  51. * @author csdeshang
  52. * @param array $condition 条件
  53. * @param string $field 字段
  54. * @param string $order 排序
  55. * @return array
  56. */
  57. public function getArrivalNoticeCount($condition)
  58. {
  59. return Db::name('arrivalnotice')->where($condition)->count();
  60. }
  61. /**
  62. * 添加通知
  63. * @access public
  64. * @author csdeshang
  65. * @param array $data 参数内容
  66. * @return bool
  67. */
  68. public function addArrivalNotice($data)
  69. {
  70. $data['arrivalnotice_addtime'] = TIMESTAMP;
  71. return Db::name('arrivalnotice')->insertGetId($data);
  72. }
  73. /**
  74. * 修改通知
  75. * @access public
  76. * @author csdeshang
  77. * @param array $data 参数内容
  78. * @return bool
  79. */
  80. public function editArrivalNotice($data, $condition)
  81. {
  82. return Db::name('arrivalnotice')->where($condition)->update($data);
  83. }
  84. /**
  85. * 删除通知
  86. * @access public
  87. * @author csdeshang
  88. * @param array $condition 条件
  89. * @return bool
  90. */
  91. public function delArrivalNotice($condition)
  92. {
  93. return Db::name('arrivalnotice')->where($condition)->delete();
  94. }
  95. }