Browse Source

权限限制

lizhen_gitee 1 year ago
parent
commit
5142d2c2d3

+ 16 - 0
application/api/controller/company/Package.php

@@ -39,6 +39,10 @@ class Package extends Apic
 
     //新增
     public function add(){
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
         $field = ['title','info','servicetype_id','images','days','price','oldprice','content','content_images'];
         $data = request_post_hub($field);
 
@@ -53,6 +57,10 @@ class Package extends Apic
 
     //上下架
     public function changestatus(){
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
         $id = input('id',0);
         $status = Db::name('package')->where('id',$id)->value('status');
 
@@ -75,6 +83,10 @@ class Package extends Apic
 
     //编辑
     public function edit(){
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
         $id = input('id','');
 
         $check = Db::name('package')->where('id',$id)->where('company_id',$this->auth->company_id)->find();
@@ -93,6 +105,10 @@ class Package extends Apic
 
     //删除
     public function delete(){
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
         $id = input('id','');
 
         $check = Db::name('package')->where('id',$id)->where('company_id',$this->auth->company_id)->find();

+ 14 - 0
application/api/controller/company/Recharge.php

@@ -50,6 +50,11 @@ class Recharge extends Apic
 
     //新增
     public function add(){
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
+
         $field = ['price','giftprice'];
         $data = request_post_hub($field);
 
@@ -92,6 +97,10 @@ class Recharge extends Apic
 
     //上下架
     public function changestatus(){
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
         $id = input('id',0);
         $info = Db::name('recharge_config')->where('id',$id)->update(['status'=>0]);
         $this->success();
@@ -99,6 +108,11 @@ class Recharge extends Apic
 
     //删除
     public function delete(){
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
+
         $id = input('id','');
 
         $check = Db::name('recharge_config')->where('id',$id)->where('company_id',$this->auth->company_id)->find();

+ 8 - 0
application/api/controller/company/User.php

@@ -116,6 +116,10 @@ class User extends Apic
      */
     public function profile()
     {
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
         $field = [
             'mobile',
             'image',
@@ -136,6 +140,10 @@ class User extends Apic
      */
     public function setaddress()
     {
+        //验证
+        if($this->auth->type != 1){
+            $this->error('只有门店老板才能设置');
+        }
         $field = [
             'province_name',
             'city_name',