Arrivalnotice.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class Arrivalnotice extends BaseModel
  16. {
  17. /**
  18. * 通知列表
  19. * @access public
  20. * @author csdeshang
  21. * @param array $condition 条件
  22. * @param string $field 字段
  23. * @param number $limit 数量限制
  24. * @param string $order 排序
  25. * @return array
  26. */
  27. public function getArrivalNoticeList($condition = array(), $field = '*', $limit = 0, $order = 'arrivalnotice_id desc',$pagesize = '') {
  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. return Db::name('arrivalnotice')->where($condition)->field($field)->find();
  46. }
  47. /**
  48. * 通知数量
  49. * @access public
  50. * @author csdeshang
  51. * @param array $condition 条件
  52. * @param string $field 字段
  53. * @param string $order 排序
  54. * @return array
  55. */
  56. public function getArrivalNoticeCount($condition) {
  57. return Db::name('arrivalnotice')->where($condition)->count();
  58. }
  59. /**
  60. * 添加通知
  61. * @access public
  62. * @author csdeshang
  63. * @param array $data 参数内容
  64. * @return bool
  65. */
  66. public function addArrivalNotice($data) {
  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. return Db::name('arrivalnotice')->where($condition)->delete();
  90. }
  91. }