Pārlūkot izejas kodu

订单和核销还原

zhangxiaobin 1 gadu atpakaļ
vecāks
revīzija
88e26ee927

+ 5 - 10
application/api/controller/company/Coupon.php

@@ -112,19 +112,14 @@ class Coupon extends Apic
                 $check['action'] = $action;
             }
         }else{
-            $p = 'package';
-            $o = 'order';
             $map = [
-                $o.'.company_id' => $this->auth->company_id,
-                $o.'.check_code' => $id,
-                $o.'.ordertype'  => 3,
-                $o.'.status'     => 1, //1=待核销
+                'company_id' => $this->auth->company_id,
+                'check_code' => $id,
+                'ordertype'  => 3,
+                'status'     => 1, //1=待核销
             ];
-            $check = Db::name($o)->alias($o)->field($o.'.id,server_info as name,pay_fee as price,'.$p.'.title as `package_title`')
-                ->join($p,$p.'.id = '.$o.'.package_id','LEFT')
-                ->where($map)->find();
+            $check = Db::name('order')->field('id,server_info as name,pay_fee as price')->where($map)->find();
             if(!empty($check)){
-                $check['name'] = $check['package_title'];
                 $check['getfrom'] = '购买';
                 $check['action'] = $action;
             }

+ 16 - 23
application/api/controller/company/Order.php

@@ -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);

+ 1 - 1
application/common/service/OrderService.php

@@ -238,7 +238,7 @@ class OrderService
                 'pre_order_id'    => 0,//预约单ID
                 'package_id'      => isset($package['id']) ? $package['id'] : 0,//套餐ID
                 'servicetype_id'  => isset($package['servicetype_id']) ? $package['servicetype_id'] : 0,//服务类型
-                'server_info'     => isset($package['info']) ? $package['info'] : '',//套餐内容
+                'server_info'     => isset($package['title']) ? $package['title'] : '',//套餐主标题
                 'server_images'   => isset($package['images']) ? $package['images'] : '',//套餐图片
                 'pay_fee'         => isset($package['price']) ? $package['price'] : 0.00,//套餐价格
                 'status'          => $orderStatus,//状态:1=待核销,2=待处理,3=已完成,4=已取消