delivery_point.model.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /**
  3. * 物流自提服务站模型
  4. *
  5. */
  6. defined('InShopNC') or exit('Access Invalid!');
  7. class delivery_pointModel extends Model {
  8. const STATE1 = 1; // 开启
  9. const STATE0 = 0; // 关闭
  10. const STATE10 = 10; // 等待审核
  11. const STATE20 = 20; // 等待失败
  12. private $state = array(
  13. self::STATE0 => '关闭',
  14. self::STATE1 => '开启',
  15. self::STATE10 => '等待审核',
  16. self::STATE20 => '审核失败'
  17. );
  18. public function __construct(){
  19. parent::__construct('delivery_point');
  20. }
  21. /**
  22. * 插入数据
  23. *
  24. * @param unknown $insert
  25. * @return boolean
  26. */
  27. public function addDeliveryPoint($insert) {
  28. return $this->insert($insert);
  29. }
  30. /**
  31. * 查询物流自提服务站列表
  32. * @param array $condition
  33. * @param int $page
  34. * @param string $order
  35. */
  36. public function getDeliveryPointList($condition, $page = 0, $order = 'dlyp_id desc') {
  37. return $this->where($condition)->page($page)->order($order)->select();
  38. }
  39. /**
  40. * 等待审核的物流自提服务站列表
  41. * @param unknown $condition
  42. * @param number $page
  43. * @param string $order
  44. */
  45. public function getDeliveryPointWaitVerifyList($condition, $page = 0, $order = 'dlyp_id desc') {
  46. $condition['dlyp_state'] = self::STATE10;
  47. return $this->getDeliveryPointList($condition, $page, $order);
  48. }
  49. /**
  50. * 等待审核的物流自提服务站列表
  51. * @param unknown $condition
  52. * @param number $page
  53. * @param string $order
  54. */
  55. public function getDeliveryPointWaitVerifyCount($condition) {
  56. $condition['dlyp_state'] = self::STATE10;
  57. return $this->where($condition)->count();
  58. }
  59. /**
  60. * 开启中物流自提服务列表
  61. * @param unknown $condition
  62. * @param number $page
  63. * @param string $order
  64. */
  65. public function getDeliveryPointOpenList($condition, $page = 0, $order = 'dlyp_id desc') {
  66. $condition['dlyp_state'] = self::STATE1;
  67. return $this->getDeliveryPointList($condition, $page, $order);
  68. }
  69. /**
  70. * 取得物流自提服务站详细信息
  71. * @param unknown $condition
  72. * @param string $field
  73. */
  74. public function getDeliveryPointInfo($condition, $field = '*') {
  75. return $this->where($condition)->field($field)->find();
  76. }
  77. /**
  78. * 取得开启中物流自提服务信息
  79. * @param unknown $condition
  80. * @param string $field
  81. */
  82. public function getDeliveryPointOpenInfo($condition, $field = '*') {
  83. $condition['dlyp_state'] = self::STATE1;
  84. return $this->where($condition)->field($field)->find();
  85. }
  86. /**
  87. * 取得开启中物流自提服务信息
  88. * @param unknown $condition
  89. * @param string $field
  90. */
  91. public function getDeliveryPointFailInfo($condition, $field = '*') {
  92. $condition['dlyp_state'] = self::STATE20;
  93. return $this->where($condition)->field($field)->find();
  94. }
  95. /**
  96. * 物流自提服务站信息
  97. * @param array $update
  98. * @param array $condition
  99. */
  100. public function editDeliveryPoint($update, $condition) {
  101. return $this->where($condition)->update($update);
  102. }
  103. /**
  104. * 返回状态数组
  105. * @return multitype:string
  106. */
  107. public function getDeliveryState() {
  108. return $this->state;
  109. }
  110. }