浏览代码

后台预约单

lizhen_gitee 1 年之前
父节点
当前提交
e7c9bdef7c
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      application/admin/controller/Preorder.php

+ 7 - 4
application/admin/controller/Preorder.php

@@ -85,7 +85,7 @@ class Preorder extends Backend
     public function cancel(){
     public function cancel(){
 
 
         $id = input('id',0);
         $id = input('id',0);
-        if(!$this->request->post()){
+        if(!$this->request->ispost()){
             $this->assign('id',$id);
             $this->assign('id',$id);
             return $this->view->fetch();
             return $this->view->fetch();
         }
         }
@@ -111,7 +111,7 @@ class Preorder extends Backend
         $pre_order_id = input('id',0); //预约单id
         $pre_order_id = input('id',0); //预约单id
         $map = ['id'=>$pre_order_id];
         $map = ['id'=>$pre_order_id];
         $pre_order = Db::name('pre_order')->where($map)->find();
         $pre_order = Db::name('pre_order')->where($map)->find();
-        if(!$this->request->post()){
+        if(!$this->request->ispost()){
             $this->assign('id',$pre_order_id);
             $this->assign('id',$pre_order_id);
             $this->assign('row',$pre_order);
             $this->assign('row',$pre_order);
             $this->assign('staff_id',$this->auth->staff_id);
             $this->assign('staff_id',$this->auth->staff_id);
@@ -128,9 +128,12 @@ class Preorder extends Backend
 
 
         //预约单
         //预约单
 
 
-        $map = ['id'=>$pre_order_id];
+        $map = ['id'=>$pre_order_id,'pre_order_status'=>1];
         $pre_order = Db::name('pre_order')->where($map)->lock(true)->find();
         $pre_order = Db::name('pre_order')->where($map)->lock(true)->find();
-
+        if(empty($pre_order)){
+            Db::rollback();
+            $this->error('不存在的预约单');
+        }
 
 
         $data['pre_order_id'] = $pre_order_id;
         $data['pre_order_id'] = $pre_order_id;
         $data['user_id'] = $pre_order['user_id'];
         $data['user_id'] = $pre_order['user_id'];