[8] ErrorException in Books.php line 44

Trying to get property 'tags' of non-object

  1. } else {
  2. $book = Book::with(['chapters' => function ($query) {
  3. $query->order('chapter_order');
  4. }])->where('unique_id','=', $id)->find();
  5. }
  6. if (empty($book['cover_url'])) {
  7. $book['cover_url'] = $this->img_site.'/static/upload/book/'.$book['id'].'/cover.jpg';
  8. }
  9. $tags = [];
  10. if (!empty($book->tags) || is_null($book->tags)) {
  11. $tags = explode('|', $book->tags);
  12. }
  13. cache('book:' . $id, $book, null, 'redis');
  14. cache('tags:book:' . $id, $tags, null, 'redis');
  15. }
  16. $redis = RedisHelper::GetInstance();
  17. $day = date("Y-m-d", time());
  18. //以当前日期为键,增加点击数
  19. $redis->zIncrBy('click:' . $day, 1, $book->id);

Call Stack

  1. in Books.php line 44
  2. at Error::appError(8, 'Trying to get proper...', '/www/wwwroot/www.iwx...', 44, ['id' => '29989', 'book' => ['cover_url' => 'http://www.iwxshw.co...'], 'tags' => [], ...]) in Books.php line 44
  3. at Books->index()
  4. at ReflectionMethod->invokeArgs(object(Books), []) in Container.php line 395
  5. at Container->invokeReflectMethod(object(Books), object(ReflectionMethod), ['id' => '29989', '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
Cookies
nav_switch booklist
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_REFERER http://www.iwxshw.com/book/29989
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_HOST www.iwxshw.com
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME www.iwxshw.com
SERVER_PORT 443
SERVER_ADDR 10.0.8.3
REMOTE_PORT 35678
REMOTE_ADDR 3.81.97.37
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 /book/29989
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=//book/29989
SCRIPT_FILENAME /www/wwwroot/www.iwxshw.com/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711911660.3115
REQUEST_TIME 1711911660
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