123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- //以下是定义结算单状态
- //默认
- define('BILL_STATE_CREATE', 1);
- //店铺已确认
- define('BILL_STATE_STORE_COFIRM', 2);
- //平台已审核
- define('BILL_STATE_SYSTEM_CHECK', 3);
- //结算完成
- define('BILL_STATE_SUCCESS', 4);
- /**
- * ============================================================================
- *
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
- * ----------------------------------------------------------------------------
- *
- * ============================================================================
- * 数据层模型
- */
- class Bill extends BaseModel {
- public $page_info;
- /**
- * 取得平台月结算单
- * @access public
- * @author csdeshang
- * @param array $condition 检索条件
- * @param str $fields 字段
- * @param int $pagesize 分页信息
- * @param str $order 排序
- * @param int $limit 数量限制
- * @return array
- */
- public function getOrderstatisList($condition = array(), $fields = '*', $pagesize = null, $order = '', $limit = 0) {
- if($pagesize){
- $result = Db::name('orderstatis')->where($condition)->field($fields)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
- $this->page_info = $result;
- return $result->items();
- }else{
- return Db::name('orderstatis')->where($condition)->field($fields)->order($order)->limit($limit)->select()->toArray();
- }
- }
- /**
- * 取得平台月结算单条信息
- * @access public
- * @author csdeshang
- * @param array $condition 检索条件
- * @param string $fields 字段
- * @param string $order 排序
- * @return array
- */
- public function getOrderstatisInfo($condition = array(), $fields = '*', $order = null) {
- return Db::name('orderstatis')->where($condition)->field($fields)->order($order)->find();
- }
-
- /**
- * 取得店铺月结算单列表
- * @access public
- * @author csdeshang
- * @param array $condition 检索条件
- * @param str $fields 字段
- * @param int $pagesize 分页信息
- * @param str $order 排序
- * @param int $limit 数量限制
- * @return array
- */
- public function getOrderbillList($condition = array(), $fields = '*', $pagesize = null, $order = '', $limit = 0) {
- if($pagesize){
- $result = Db::name('orderbill')->where($condition)->field($fields)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
- $this->page_info = $result;
- return $result->items();
- }else{
- return Db::name('orderbill')->where($condition)->field($fields)->order($order)->limit($limit)->select()->toArray();
- }
-
-
- }
- /**
- * 取得店铺月结算单单条
- * @access public
- * @author csdeshang
- * @param array $condition 检索条件
- * @param string $fields 字段
- * @return array
- */
- public function getOrderbillInfo($condition = array(), $fields = '*') {
- return Db::name('orderbill')->where($condition)->field($fields)->find();
- }
- /**
- * 取得订单数量
- * @access public
- * @author csdeshang
- * @param array $condition 检索条件
- * @return int
- */
- public function getOrderbillCount($condition) {
- return Db::name('orderbill')->where($condition)->count();
- }
- /**
- * 取得平台月结算单数量
- * @access public
- * @author csdeshang
- * @param array $condition 检索条件
- * @return int
- */
- public function getOrderstatisCount($condition) {
- return Db::name('orderstatis')->where($condition)->count();
- }
- /**
- * 添加订单统计
- * @access public
- * @author csdeshang
- * @param type $data 参数内容
- * @return type
- */
- public function addOrderstatis($data) {
- return Db::name('orderstatis')->insert($data);
- }
- /**
- * 添加订单账单
- * @access public
- * @author csdeshang
- * @param array $data 参数数据
- * @return type
- */
- public function addOrderbill($data) {
- return Db::name('orderbill')->insertGetId($data);
- }
-
- /**
- * 编辑订单账单
- * @access public
- * @author csdeshang
- * @param array $data 更新数据
- * @param array $condition 条件
- * @return bool
- */
- public function editOrderbill($data, $condition = array()) {
- return Db::name('orderbill')->where($condition)->update($data);
- }
- }
- ?>
|