Bladeren bron

订单模块

lizhen_gitee 1 jaar geleden
bovenliggende
commit
e88919446e
1 gewijzigde bestanden met toevoegingen van 0 en 200 verwijderingen
  1. 0 200
      application/api/controller/company/Order.php

+ 0 - 200
application/api/controller/company/Order.php

@@ -73,73 +73,7 @@ class Order extends Apic
         $this->success(1,$list);
     }
 
-    //各个状态的订单数量
-    public function status_each_number(){
-        //全部
-        $where = [
-            'company_id' => $this->auth->id,
-        ];
-        $all = Db::name('order')->where($where)->count();
-        //待取车
-        $where = [
-            'company_id' => $this->auth->id,
-            'status' => 10
-        ];
-        $daiquche = Db::name('order')->where($where)->count();
-
-        //待还车
-        $where = [
-            'company_id' => $this->auth->id,
-            'status' => 20,
-            'endtime' => ['gt',time()],
-        ];
-        $daihuanche = Db::name('order')->where($where)->count();
-
-        //逾期
-        $where = [
-            'company_id' => $this->auth->id,
-            'status' => 20,
-            'endtime' => ['elt',time()],
-        ];
-        $yuqi = Db::name('order')->where($where)->count();
-
-        //完成/取消
-        $where = [
-            'company_id' => $this->auth->id,
-            'status' => ['IN',[-1,-2,30]],
-        ];
-        $wancheng = Db::name('order')->where($where)->count();
-
-        $result = [
-            'all' => $all,
-            'daiquche'   => $daiquche,
-            'daihuanche' => $daihuanche,
-            'yuqi'       => $yuqi,
-            'wancheng'   => $wancheng,
-        ];
-
-        $this->success(1,$result);
-    }
-
-    //状态
-    private function status_text($status,$endtime){
-        $arr = [
-            -1 => '未付款被取消',
-            -2 => '已付款被取消',
-             0 => '待付款',
-            10 => '已付款',
-            20 => '已取车',
-            30 => '完成',
-        ];
-        $status_text =  isset($arr[$status]) ? $arr[$status] : $status;
 
-        //取走了车没还,时间却超过了还车时间
-        if($status == 20 && time() >= $endtime){
-            $status_text = '已逾期';
-        }
-
-        return $status_text;
-    }
 
     //详情
     public function info(){
@@ -235,140 +169,6 @@ class Order extends Apic
         $this->success('取消成功');
 
     }
-    //确认取车
-    public function get_car(){
-        $id = input('id',0);
-
-        Db::startTrans();
-        $info = Db::name('order')->where('id',$id)->where('company_id',$this->auth->id)->lock(true)->find();
-        if($info['status'] != 10){
-            Db::rollback();
-            $this->error('当前订单状态不能取车');
-        }
-
-        //
-        $data = [
-            'idcard_images' => input('idcard_images',''),
-            'driver_images' => input('driver_images',''),
-            'get_yibiao_images' => input('get_yibiao_images',''),
-            'get_carvideo'  => input('get_carvideo',''),
-            'status' => 20,
-            'getcartime' => time(),
-        ];
-        Db::name('order')->where('id',$id)->update($data);
-        Db::commit();
-
-        $this->success('取车完成');
-    }
-    //还车车伤确认,配置
-    public function back_config(){
-        $list = Db::name('order_back_config')->order('id asc')->select();
-        $this->success(1,$list);
-    }
-    //还车
-    public function back_car(){
-        $id = input('id',0);
-
-        Db::startTrans();
-        $info = Db::name('order')->where('id',$id)->where('company_id',$this->auth->id)->lock(true)->find();
-        if($info['status'] != 20){
-            Db::rollback();
-            $this->error('当前订单状态不能还车');
-        }
-
-        //还车
-        $data = [
-            'back_yibiao_images' => input('back_yibiao_images',''),
-            'back_carvideo' => input('back_carvideo',''),
-            'back_remark' => input('back_remark',''),
-            'status' => 30,
-            'backcartime' => input('backcartime',''),
-            'back_oilfee' => input('back_oilfee',0),
-            'back_damage' => input('back_damage',''),
-        ];
-        $rs_update = Db::name('order')->where('id',$id)->update($data);
-        if($rs_update === false){
-            Db::rollback();
-            $this->error('还车失败');
-        }
-
-        //汽车解除占用
-        $rs_car = Db::name('car')->where('id',$info['car_id'])->update(['status'=>1]);
-        if($rs_car === false){
-            Db::rollback();
-            $this->error('还车失败');
-        }
-
-        //给上一级用户赠送一张满100减100的券
-        $intro_user = Db::name('user')->where('id',$info['user_id'])->value('intro_uid');
-        if($intro_user){
-            //检查送过没有
-            $where = [
-                'user_id' => $info['user_id'],
-                'status'  => 30,
-                'id' => ['neq',$info['id']],
-            ];
-            $check = Db::name('order')->where($where)->find();
-            if(!$check){
-                //赠送一个
-                $only_coupon = Db::name('coupons')->where('id',1)->lock(true)->find();
-                if($only_coupon['stock'] > 1){
-                    //送到
-                    $data = [
-                        'user_id' => $intro_user,
-                        'company_id' => $only_coupon['company_id'],
-                        'enough' => $only_coupon['enough'],
-                        'amount' => $only_coupon['amount'],
-                        'type' => $only_coupon['type'],
-                        'coupons_id' => $only_coupon['id'],
-
-                        'createtime' => time(),
-                        'usetimestart' => $only_coupon['usetimestart'],
-                        'usetimeend' => $only_coupon['usetimeend'],
-                    ];
-                    $rs_user_coupon = Db::name('user_coupons')->insertGetId($data);
-                    //减库存
-                    $rs_only_coupon = Db::name('coupons')->where('id',1)->update(['stock'=>$only_coupon['stock']-1]);
-                    if(!$rs_user_coupon || $rs_only_coupon === false){
-                        Db::rollback();
-                        $this->error('还车失败了');
-                    }
-                }
-
-                //给上级奖励money
-                $intro_money = config('site.yaoqing_user_backcar_money');
-                if($intro_money > 0){
-                    $wallet = new \app\common\model\Wallet;
-                    $wallet_rs = $wallet->lockChangeAccountRemain($intro_user,'money',$intro_money,3,'邀请新用户下单('.$info['user_id'].')','order',$info['id']);
-                    if($wallet_rs['status'] === false){
-                        Db::rollback();
-                        $this->error($wallet_rs['msg']);
-                    }
-                }
-
-
-            }
-        }
-
-
-        Db::commit();
-
-        $this->success('还车完成');
-    }
-
-
 
-    //回复评价
-    public function comment_reply(){
-        $comment_id = input('comment_id',0);
-        $reply = input('reply','');
 
-        $data = [
-            'reply' => $reply,
-            'replytime' => time(),
-        ];
-        Db::name('order_comment')->where('id',$comment_id)->update($data);
-
-        $this->success('回复完成');
-    }
 }