你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
xiaoluyouyue
赞同来自: 长岛冰茶
admin
赞同来自:
Heishy
要回复问题请先登录或注册
3 个回复
xiaoluyouyue
赞同来自: 长岛冰茶
like this:
$list = DB::table($this->table)
->join('user', 'user.id', '=', $this->table . '.user_id')
->where(function($query) use($data) {
if (!empty($data['order_sn'])) {
$query->where($this->table . '.order_sn', 'like', '%' . $data['order_sn'] . '%');
}
})
->where(function($query) use($data) {
if (isset($data['order_status']) && is_numeric($data['order_status'])) {
$query->where($this->table . '.order_status', '=', $data['order_status']);
}
})
->where(function($query) use($data) {
if (isset($data['ship_status']) && is_numeric($data['ship_status'])) {
$query->where($this->table . '.ship_status', '=', $data['ship_status']);
}
})
->where(function($query) use($data) {
if (isset($data['pay_status']) && is_numeric($data['pay_status'])) {
$query->where($this->table . '.pay_status', '=', $data['pay_status']);
}
})
->where(function($query) use($data) {
if (!empty($data['start_time']) && !empty($data['end_time'])) {
$query->where($this->table . '.update_time', '>=', $data['start_time'])
->where($this->table . '.update_time', '<=', $data['end_time']);
} else if (!empty($data['start_time'])) {
$query->where($this->table . '.update_time', '>=', $data['start_time']);
} else if (!empty($data['end_time'])) {
$query->where($this->table . '.update_time', '<=', $data['end_time']);
}
})
->where($this->table . '.drugstore_id', '=', 0)
->where($this->table . '.user_id', '!=', 0)
->select($this->table . '.id as id',
$this->table . '.order_sn as order_sn',
$this->table . '.order_status as order_status',
$this->table . '.ship_status as ship_status',
$this->table . '.pay_status as pay_status',
$this->table . '.total_paid as total_paid',
$this->table . '.update_time as update_time',
'user.nickname as name',
'user.mobile as phone',
$this->table . '.is_remittance as is_remittance')
->orderBy($sortby, $sortvalue)
->take($data['pageSize'])
->skip($data['pageNo'] > 1 ? ($data['pageNo'] - 1) * $data['pageSize'] : 0)
->get();
admin
赞同来自:
Heishy
赞同来自: