示例#1
0
文件: API.php 项目: asjs-dev/lab.coop
 protected function food()
 {
     if (!$this->session->status()) {
         return $this->_response("Authentication Required", 401);
     }
     $food = new Food();
     if ($this->method == 'GET') {
         if ($this->id) {
             return $food->getById($this->id);
         }
         return $food->getList();
     } else {
         if ($this->method == 'POST') {
             if ($this->data) {
                 return $food->create($this->data);
             }
         } else {
             if ($this->method == 'DELETE') {
                 if ($this->id) {
                     return $food->deleteById($this->id);
                 }
             }
         }
     }
     return "";
 }