[0] ThrowableError in Goods.php line 109

致命错误: 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::where('is_del',0)->get($id);
  10. $data['comment'] = $data->comments()->where('is_show',0)->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 109
  2. at Goods->getGoodsInfo('8328') in Goods.php line 273
  3. at Goods->show('8328')
  4. at ReflectionMethod->invokeArgs(object(Goods), ['8328']) in Container.php line 395
  5. at Container->invokeReflectMethod(object(Goods), object(ReflectionMethod), ['id' => '8328', '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 79

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Session
idea_ { "pid": 0 }
Server/Request Data
USER www
HOME /home/www
HTTP_HOST yuanfangshandong.com
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME yuanfang.99fuku.com
SERVER_PORT 80
SERVER_ADDR 172.26.253.57
REMOTE_PORT 44656
REMOTE_ADDR 54.166.223.204
SERVER_SOFTWARE nginx/1.18.0
GATEWAY_INTERFACE CGI/1.1
REQUEST_SCHEME http
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /www/wwwroot/yuanfang.99fuku.com
DOCUMENT_URI /index.php
REQUEST_URI /goods/item/8328.html
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/goods/item/8328.html
SCRIPT_FILENAME /www/wwwroot/yuanfang.99fuku.com/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711651775.5838
REQUEST_TIME 1711651775
Environment Variablesempty
ThinkPHP Constants
url /goods/item/8328.html
ref Resource
ent claudebot
site http://php.lai668.cc
road /?yuanfangshandong.com/goods/item/8328.html
regs @Baidu|Sogou|Yisou|Soso|Haosou|Spider|So.com|Sm.cn@i
area true
PUBLIC_PATH /public/
UPLOAD_PATH /upload/
VIEW_PATH ./template/skin001/pc/html_8768/