Arrivalnotice.php 2.7 KB

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