Example #1
0
 /**
  * 用户权限修改
  */
 public function permission()
 {
     $req = req()->_plain();
     if ($req->is_post()) {
         lib()->load("UserControl");
         $uc = new UserControl();
         $uid = $req->post("id");
         $permission = $req->post("permission");
         try {
             switch ($req->post('operate')) {
                 case "add":
                     $uc->PermissionAdd($uid, $permission);
                     $this->rt_msg['status'] = true;
                     break;
                 case "set":
                     $uc->PermissionSet($uid, $permission);
                     $this->rt_msg['status'] = true;
                     break;
             }
         } catch (\Exception $ex) {
             $this->rt_msg['msg'] = $ex->getMessage();
         }
     } else {
         $this->rt_msg['msg'] = "必须以POST提交";
     }
 }