예제 #1
0
 /**
  * 获取详情
  * PUT /books/123
  * @method GET_infoAction
  * @param  integer        $id [资源id]
  * @author NewFuture
  */
 public function PUT_infoAction($id = 0)
 {
     $pid = $this->authPrinter();
     $book = [];
     if (Input::put('name', $name, 'title')) {
         $book['name'] = $name;
     }
     if (Input::put('detail', $detail, 'text')) {
         $book['detail'] = $detail;
     }
     if (Input::put('price', $price, 'float')) {
         $book['price'] = $price;
     }
     if (empty($book)) {
         $this->response(0, '无修改内容');
     } elseif (BookModel::where('id', $id)->where('pri_id', $pid)->update($book)) {
         $this->response(1, $book);
     } else {
         $this->response(0, '修改失败');
     }
 }