[0] ThrowableError in Goods.php line 110

致命错误: Call to a member function comments() on null

  1. * @return mixed
  2. * @throws \think\db\exception\DataNotFoundException
  3. * @throws \think\db\exception\ModelNotFoundException
  4. * @throws \think\exception\DbException
  5. */
  6. public function getGoodsInfo($id)
  7. {
  8. $auth = new Auth();
  9. $data = GoodsModel::get($id);
  10. $data['comment'] = $data->comments()->where('is_show',1)->order('id','desc')->select();
  11. if(count($data['specPrice'])>0){
  12. $data['specList'] = $this->getSpec($id);
  13. }
  14. $data['is_sc'] = 0;
  15. if ($auth->checkLoginGlobal()){
  16. $list = CollectModel::where('user_id', $auth->member_info->id)->where('info_id',$id)->where('type_id',0)->find();
  17. if(!empty($list)){
  18. $data['is_sc'] = 1;
  19. }

Call Stack

  1. in Goods.php line 110
  2. at Goods->getGoodsInfo('27') in Goods.php line 117
  3. at Goods->show('27')
  4. at ReflectionMethod->invokeArgs(object(Goods), ['27']) in Container.php line 395
  5. at Container->invokeReflectMethod(object(Goods), object(ReflectionMethod), ['id' => '27', 'convert' => false]) in Module.php line 131
  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 136
  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 32

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Session
idea_ { "pid": 0 }
Server/Request Data
REDIRECT_REDIRECT_UNIQUE_ID Zga@iosKoBVFtZw9AaHs7wAAAAE
REDIRECT_REDIRECT_PHPRC /home/szanyehsszqaknayge/others
REDIRECT_REDIRECT_STATUS 200
REDIRECT_UNIQUE_ID Zga@iosKoBVFtZw9AaHs7wAAAAE
REDIRECT_PHPRC /home/szanyehsszqaknayge/others
REDIRECT_HANDLER php-cgi
REDIRECT_STATUS 200
UNIQUE_ID Zga@iosKoBVFtZw9AaHs7wAAAAE
PHPRC /home/szanyehsszqaknayge/others
HTTP_X_FORWARDED_FOR 54.196.105.235
HTTP_X_REAL_IP 211.149.140.180
HTTP_HOST b2c.ideacms.net
HTTP_CONNECTION close
HTTP_ACCEPT_ENCODING gzip
HTTP_X_FORWARDED_PROTO http
HTTP_ACCEPT */*
HTTP_USER_AGENT claudebot
PATH /sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE <address>Apache Server at b2c.ideacms.net Port 80</address>
SERVER_SOFTWARE Apache
SERVER_NAME b2c.ideacms.net
SERVER_ADDR 127.0.0.1
SERVER_PORT 80
REMOTE_ADDR 54.196.105.235
DOCUMENT_ROOT /home/szanyehsszqaknayge/wwwroot
REQUEST_SCHEME http
CONTEXT_PREFIX /php-run-as-cgi
CONTEXT_DOCUMENT_ROOT /usr/php7.0/bin
SERVER_ADMIN webmaster@szanye
SCRIPT_FILENAME /home/szanyehsszqaknayge/wwwroot/index.php
REMOTE_PORT 42150
REDIRECT_URL /index.php/goods/item/27.html
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.0
REQUEST_METHOD GET
QUERY_STRING
REQUEST_URI /goods/item/27.html
SCRIPT_NAME /index.php
PATH_INFO /goods/item/27.html
PATH_TRANSLATED /home/szanyehsszqaknayge/wwwroot/goods/item/27.html
ORIG_PATH_INFO /index.php/goods/item/27.html
ORIG_SCRIPT_NAME /php-run-as-cgi/php-cgi
ORIG_SCRIPT_FILENAME /usr/php7.0/bin/php-cgi
ORIG_PATH_TRANSLATED /home/szanyehsszqaknayge/wwwroot/index.php/goods/item/27.html
PHP_SELF /index.php/goods/item/27.html
REQUEST_TIME_FLOAT 1711718026.3546
REQUEST_TIME 1711718026
Environment Variablesempty
ThinkPHP Constants
PUBLIC_PATH /public/
UPLOAD_PATH /upload/
VIEW_PATH ./template/skin001/pc/html_8768/