浏览代码

卡券上下架

lizhen_gitee 1 年之前
父节点
当前提交
f0833c2d60
共有 2 个文件被更改,包括 10 次插入3 次删除
  1. 8 2
      application/api/controller/company/Coupon.php
  2. 2 1
      application/api/controller/company/Preorder.php

+ 8 - 2
application/api/controller/company/Coupon.php

@@ -41,6 +41,14 @@ class Coupon extends Apic
         $this->success('添加成功');
     }
 
+    //上下架
+    public function changestatus(){
+        $id = input('id',0);
+        $info = Db::name('coupons')->where('id',$id)->update(['status'=>0]);
+        $this->success(1,$info);
+    }
+
+    //详情
     public function info(){
         $id = input('id',0);
         $info = Db::name('coupons')->where('id',$id)->find();
@@ -60,8 +68,6 @@ class Coupon extends Apic
         $field = ['name','info','days'];
         $data = request_post_hub($field);
 
-        $data['updatetime'] = time();
-
         Db::name('coupons')->where('id',$id)->update($data);
         $this->success('编辑成功');
     }

+ 2 - 1
application/api/controller/company/Preorder.php

@@ -69,7 +69,8 @@ class Preorder extends Apic
         //预约单
         $pre_order = [];
         if($pre_order_id > 0){
-            $pre_order = Db::name('pre_order')->where('id',$pre_order_id)->find();
+            $map = ['id'=>$pre_order_id,'company_id'=>$this->auth->company_id];
+            $pre_order = Db::name('pre_order')->where($map)->find();
             if(empty($pre_order)){
                 $this->error('不存在的预约单');
             }else{