[8] ErrorException in Chapters.php line 30

Trying to get property 'book_id' of non-object

  1. {
  2. parent::initialize();
  3. $this->photoService = new 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(8, 'Trying to get proper...', '/www/wwwroot/www.iwx...', 30, ['id' => '230203', 'chapter' => null]) in Chapters.php line 30
  3. at Chapters->index('230203')
  4. at ReflectionMethod->invokeArgs(object(Chapters), ['230203']) in Container.php line 395
  5. at Container->invokeReflectMethod(object(Chapters), object(ReflectionMethod), ['id' => '230203', 'convert' => false]) in Module.php line 132
  6. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  7. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  8. at Middleware->think\{closure}(object(Request))
  9. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  10. at Middleware->dispatch(object(Request), 'controller') in Module.php line 137
  11. at Module->exec() in Dispatch.php line 168
  12. at Dispatch->run() in App.php line 432
  13. at App->think\{closure}(object(Request), object(Closure), null)
  14. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  15. at Middleware->think\{closure}(object(Request))
  16. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  17. at Middleware->dispatch(object(Request)) 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_REFERER http://iwxshw.com/chapter/230203
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_HOST iwxshw.com
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME www.iwxshw.com
SERVER_PORT 443
SERVER_ADDR 10.0.8.3
REMOTE_PORT 46688
REMOTE_ADDR 52.91.0.68
SERVER_SOFTWARE nginx/1.20.1
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/2.0
DOCUMENT_ROOT /www/wwwroot/www.iwxshw.com/public
DOCUMENT_URI /index.php
REQUEST_URI /chapter/230203
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=//chapter/230203
SCRIPT_FILENAME /www/wwwroot/www.iwxshw.com/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711910663.1458
REQUEST_TIME 1711910663
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