|
@@ -37,28 +37,27 @@ class Order extends Apic
|
|
|
$endtime = input('endtime',0);
|
|
|
$servicetype_id = intval(input('servicetype_id',0));
|
|
|
$status = intval(input('status',0));
|
|
|
- $o = 'order';
|
|
|
- $p = 'package';
|
|
|
- $order = $o.'.id desc';
|
|
|
+
|
|
|
+ $order = 'order.id desc';
|
|
|
|
|
|
$where = [
|
|
|
- $o.'.company_id' => $this->auth->company_id,
|
|
|
+ 'company_id' => $this->auth->company_id,
|
|
|
];
|
|
|
//员工
|
|
|
if($this->auth->type == 2){
|
|
|
- $where[$o.'.staff_id'] = $this->auth->id;
|
|
|
+ $where['staff_id'] = $this->auth->id;
|
|
|
}//员工
|
|
|
|
|
|
if($starttime || $endtime){
|
|
|
- $where[$o.'.createtime'] = ['between',$starttime,$endtime];
|
|
|
+ $where['createtime'] = ['between',$starttime,$endtime];
|
|
|
}
|
|
|
if($servicetype_id){
|
|
|
- $where[$o.'.servicetype_id'] = $servicetype_id;
|
|
|
+ $where['servicetype_id'] = $servicetype_id;
|
|
|
}
|
|
|
if($status){
|
|
|
- $where[$o.'.status'] = $status; //状态:2=待处理,3=已核销(完成),4=已取消
|
|
|
+ $where['status'] = $status; //状态:2=待处理,3=已核销(完成),4=已取消
|
|
|
if($status > 2){
|
|
|
- $order = $o.'.finish_time desc';
|
|
|
+ $order = 'order.finish_time desc';
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -67,15 +66,12 @@ class Order extends Apic
|
|
|
{
|
|
|
$where['user_car_number|user_mobile'] = ['LIKE','%'.$keyword.'%'];
|
|
|
}
|
|
|
- $list = Db::name('order')->alias($o)
|
|
|
- ->join('servicetype',$o.'.servicetype_id = servicetype.id','LEFT')
|
|
|
- ->join($p,$p.'.id = '.$o.'.package_id','LEFT')
|
|
|
- ->field($o.'.id,orderno,ordertype,user_name,user_mobile,user_car_number,'.
|
|
|
- $o.'.createtime,'.$o.'.servicetype_id,server_info,server_time,'.$o.'.status,finish_time,cancel_reason,hexiao_time,cancel_time,servicetype.title as servicetype_title,servicetype.baoyang_switch,'.$p.'.title as `package_title`')->where($where)->order($order)->autopage()->select();
|
|
|
+ $list = Db::name('order')->alias('order')
|
|
|
+ ->join('servicetype','order.servicetype_id = servicetype.id','LEFT')
|
|
|
+ ->field('order.id,orderno,ordertype,user_name,user_mobile,user_car_number,createtime,servicetype_id,server_info,server_time,status,finish_time,cancel_reason,hexiao_time,cancel_time,servicetype.title as servicetype_title,servicetype.baoyang_switch')->where($where)->order($order)->autopage()->select();
|
|
|
|
|
|
foreach($list as $key => &$val){
|
|
|
$val['status_text'] = $this->status_text($val['status']);
|
|
|
- $val['server_info'] = $val['package_title'];
|
|
|
}
|
|
|
$this->success(1,$list);
|
|
|
}
|
|
@@ -84,17 +80,14 @@ class Order extends Apic
|
|
|
//详情
|
|
|
public function info(){
|
|
|
$id = input('id',0);
|
|
|
- $o = 'order';
|
|
|
- $p = 'package';
|
|
|
- $info = Db::name('order')->alias($o)
|
|
|
- ->join('servicetype',$o.'.servicetype_id = servicetype.id','LEFT')
|
|
|
- ->join($p,$p.'.id = '.$o.'.package_id','LEFT')
|
|
|
- ->field($o.'.*,servicetype.title as servicetype_title,servicetype.baoyang_switch,'.$p.'.title as package_title')
|
|
|
- ->where($o.'.id',$id)->find();
|
|
|
+ $info = Db::name('order')->alias('order')
|
|
|
+ ->join('servicetype','order.servicetype_id = servicetype.id','LEFT')
|
|
|
+ ->field('order.*,servicetype.title as servicetype_title,servicetype.baoyang_switch')
|
|
|
+ ->where('order.id',$id)->find();
|
|
|
$info = info_domain_image($info,['server_images']);
|
|
|
$info['status_text'] = $this->status_text($info['status']);
|
|
|
$info['total_fee'] = bcadd($info['pay_fee'],$info['appen_fee'],2);
|
|
|
- $info['server_info'] = $info['package_title'];
|
|
|
+
|
|
|
$info['appen_list'] = Db::name('order_appen')->where('order_id',$id)->select();
|
|
|
|
|
|
$this->success(1,$info);
|