[8] ErrorException in Chapters.php line 30

Trying to get property 'book_id' of non-object

  1. {
  2. parent::initialize();
  3. $this->photoService = app('photoService');
  4. }
  5. public function index($id)
  6. {
  7. $chapter = Chapter::with('book')->cache('chapter:' . $id, 600, 'redis')->find($id);
  8. if (empty($chapter->book->img_url)) {
  9. $chapter->book->cover_url = $this->img_site.'/static/upload/book/'.$chapter->book_id.'/cover.jpg';
  10. }
  11. if ($this->end_point == 'id') {
  12. $chapter->book['param'] = $chapter->book['id'];
  13. } else {
  14. $chapter->book['param'] = $chapter->book['unique_id'];
  15. }
  16. $flag = true;
  17. if ($chapter->book->start_pay >= 0) {
  18. if ($chapter->chapter_order >= $chapter->book->start_pay) { //如果本章序大于起始付费章节,则是付费章节

Call Stack

  1. in Chapters.php line 30
  2. at Error::appError() in Chapters.php line 30
  3. at Chapters->index()
  4. at ReflectionMethod->invokeArgs() in Container.php line 395
  5. at Container->invokeReflectMethod() in Module.php line 131
  6. at Module->think\route\dispatch\{closure}()
  7. at call_user_func_array() in Middleware.php line 185
  8. at Middleware->think\{closure}()
  9. at call_user_func() in Middleware.php line 130
  10. at Middleware->dispatch() in Module.php line 136
  11. at Module->exec() in Dispatch.php line 168
  12. at Dispatch->run() in App.php line 432
  13. at App->think\{closure}()
  14. at call_user_func_array() in Middleware.php line 185
  15. at Middleware->think\{closure}()
  16. at call_user_func() in Middleware.php line 130
  17. at Middleware->dispatch() in App.php line 435
  18. at App->run() in index.php line 21

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_HOST www.1rtm.com
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME www.1rtm.com
SERVER_PORT 443
SERVER_ADDR 172.17.14.103
REMOTE_PORT 57318
REMOTE_ADDR 44.215.110.142
SERVER_SOFTWARE nginx/1.22.1
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/2.0
DOCUMENT_ROOT /www/wwwroot/xiaohuanxiong/public
DOCUMENT_URI /index.php
REQUEST_URI /chapter/2930/
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/chapter/2930/
SCRIPT_FILENAME /www/wwwroot/xiaohuanxiong/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711621365.9472
REQUEST_TIME 1711621365
Environment Variablesempty
ThinkPHP Constants
BOOKCTRL book
CHAPTERCTRL chapter
TAGCTRL tag
BOOKLISTACT booklist
SEARCHCTRL search
RANKCTRL rank
UPDATEACT update
AUTHORCTRL author
spider_db_conn xxx
PINYIN_DEFAULT 4096
PINYIN_TONE 2
PINYIN_NO_TONE 4
PINYIN_ASCII_TONE 8
PINYIN_NAME 16
PINYIN_KEEP_NUMBER 32
PINYIN_KEEP_ENGLISH 64
PINYIN_UMLAUT_V 128
PINYIN_KEEP_PUNCTUATION 256