Example #1
0
 public function book()
 {
     $type = \Hnust\input('type');
     $book = new \Hnust\Analyse\Book($this->sid, $this->passwd);
     if ('renew' === $type) {
         $barcode = \Hnust\input('barcode');
         $department = \Hnust\input('department');
         $library = \Hnust\input('library');
         $this->code = Config::RETURN_ALERT;
         $this->data = $this->msg = $book->doRenew($barcode, $department, $library);
     } elseif ('search' === $type) {
         $this->data = $book->getBookList($this->key, $this->page);
         if (empty($this->data)) {
             $this->code = Config::RETURN_ERROR;
             $this->msg = 1 === $this->page ? '未找到相关书籍' : '没有更多了...';
         }
     } elseif ('info' === $type) {
         $id = \Hnust\input('id');
         $this->data = $book->getBookInfo($id);
     } else {
         $this->data = $book->getLoanList();
         if (0 === count($this->data)) {
             $this->code = Config::RETURN_ERROR;
             $this->msg = '未找到相关借书记录';
         }
     }
 }