ZjOrderModel.php 1.1 KB
<?php
/**
 * Created by PhpStorm.
 * User: wz
 * Date: 2018/7/2
 * Time: 17:57
 */

namespace app\admin\model;


use think\Model;
use think\Db;

class ZjOrderModel extends Model
{
    /**
     * 获取订单数据
     */
    public function selectAll($where)
    {
        $all=Db::name('zj_order')->alias('o')->join('zj_service s','o.service_id=s.id')->join('user u','o.user_id=u.id')->join('zj_contact c','o.contact_time=c.id')->join('user y','o.admin_id=y.id','left')->join('zj_service_type t','s.ser_type=t.id')
            ->field('o.*,s.ser_type,s.name as sname,u.user_nickname as uname,y.user_login as aname,c.contact,t.name as tname')
            ->where($where)->order('o.create_time','desc')->paginate(10);
        return $all;
    }

    /**
     * 新增订单数量统计
     */
    public function orderNum($where,$where1)
    {
        return Db::name('zj_order')->where($where)->where($where1)->count('id');
    }

    /**
     * 新增订单金额统计
     */
    public function priceNum($where,$where1)
    {
        return Db::name('zj_order')->where($where)->where($where1)->sum('whole');
    }


}