Bill.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. //以下是定义结算单状态
  5. //默认
  6. define('BILL_STATE_CREATE', 1);
  7. //店铺已确认
  8. define('BILL_STATE_STORE_COFIRM', 2);
  9. //平台已审核
  10. define('BILL_STATE_SYSTEM_CHECK', 3);
  11. //结算完成
  12. define('BILL_STATE_SUCCESS', 4);
  13. /**
  14. * ============================================================================
  15. *
  16. * ============================================================================
  17. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  18. * 网站地址: https://www.valimart.net/
  19. * ----------------------------------------------------------------------------
  20. *
  21. * ============================================================================
  22. * 数据层模型
  23. */
  24. class Bill extends BaseModel {
  25. public $page_info;
  26. /**
  27. * 取得平台月结算单
  28. * @access public
  29. * @author csdeshang
  30. * @param array $condition 检索条件
  31. * @param str $fields 字段
  32. * @param int $pagesize 分页信息
  33. * @param str $order 排序
  34. * @param int $limit 数量限制
  35. * @return array
  36. */
  37. public function getOrderstatisList($condition = array(), $fields = '*', $pagesize = null, $order = '', $limit = 0) {
  38. if($pagesize){
  39. $result = Db::name('orderstatis')->where($condition)->field($fields)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  40. $this->page_info = $result;
  41. return $result->items();
  42. }else{
  43. return Db::name('orderstatis')->where($condition)->field($fields)->order($order)->limit($limit)->select()->toArray();
  44. }
  45. }
  46. /**
  47. * 取得平台月结算单条信息
  48. * @access public
  49. * @author csdeshang
  50. * @param array $condition 检索条件
  51. * @param string $fields 字段
  52. * @param string $order 排序
  53. * @return array
  54. */
  55. public function getOrderstatisInfo($condition = array(), $fields = '*', $order = null) {
  56. return Db::name('orderstatis')->where($condition)->field($fields)->order($order)->find();
  57. }
  58. /**
  59. * 取得店铺月结算单列表
  60. * @access public
  61. * @author csdeshang
  62. * @param array $condition 检索条件
  63. * @param str $fields 字段
  64. * @param int $pagesize 分页信息
  65. * @param str $order 排序
  66. * @param int $limit 数量限制
  67. * @return array
  68. */
  69. public function getOrderbillList($condition = array(), $fields = '*', $pagesize = null, $order = '', $limit = 0) {
  70. if($pagesize){
  71. $result = Db::name('orderbill')->where($condition)->field($fields)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  72. $this->page_info = $result;
  73. return $result->items();
  74. }else{
  75. return Db::name('orderbill')->where($condition)->field($fields)->order($order)->limit($limit)->select()->toArray();
  76. }
  77. }
  78. /**
  79. * 取得店铺月结算单单条
  80. * @access public
  81. * @author csdeshang
  82. * @param array $condition 检索条件
  83. * @param string $fields 字段
  84. * @return array
  85. */
  86. public function getOrderbillInfo($condition = array(), $fields = '*') {
  87. return Db::name('orderbill')->where($condition)->field($fields)->find();
  88. }
  89. /**
  90. * 取得订单数量
  91. * @access public
  92. * @author csdeshang
  93. * @param array $condition 检索条件
  94. * @return int
  95. */
  96. public function getOrderbillCount($condition) {
  97. return Db::name('orderbill')->where($condition)->count();
  98. }
  99. /**
  100. * 取得平台月结算单数量
  101. * @access public
  102. * @author csdeshang
  103. * @param array $condition 检索条件
  104. * @return int
  105. */
  106. public function getOrderstatisCount($condition) {
  107. return Db::name('orderstatis')->where($condition)->count();
  108. }
  109. /**
  110. * 添加订单统计
  111. * @access public
  112. * @author csdeshang
  113. * @param type $data 参数内容
  114. * @return type
  115. */
  116. public function addOrderstatis($data) {
  117. return Db::name('orderstatis')->insert($data);
  118. }
  119. /**
  120. * 添加订单账单
  121. * @access public
  122. * @author csdeshang
  123. * @param array $data 参数数据
  124. * @return type
  125. */
  126. public function addOrderbill($data) {
  127. return Db::name('orderbill')->insertGetId($data);
  128. }
  129. /**
  130. * 编辑订单账单
  131. * @access public
  132. * @author csdeshang
  133. * @param array $data 更新数据
  134. * @param array $condition 条件
  135. * @return bool
  136. */
  137. public function editOrderbill($data, $condition = array()) {
  138. return Db::name('orderbill')->where($condition)->update($data);
  139. }
  140. }
  141. ?>