ZjOrderModel.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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');
}
}