diff --git a/app/Http/Controllers/Api/GithubController.php b/app/Http/Controllers/Api/GithubController.php index bb5c121d..ebe69b24 100755 --- a/app/Http/Controllers/Api/GithubController.php +++ b/app/Http/Controllers/Api/GithubController.php @@ -127,7 +127,7 @@ class GithubController $aShip = $oShip->toArray(); $aGoodRand = ModelGoodPool::_rand($aArticle["ship_code"]); - $sGoodRand = ModelGoodPool::_goodToGithub($aGoodRand["good"]); + $sGoodRand = ModelGoodPool::_goodToGithub($aGoodRand["good"] ?? []); $ex["good_rand"] = $sGoodRand; $sGoodShip = ModelGoodPool::_goodToGithub($aShip["good"]); diff --git a/app/Models/GoodPool.php b/app/Models/GoodPool.php index ad271494..fc66047d 100755 --- a/app/Models/GoodPool.php +++ b/app/Models/GoodPool.php @@ -47,6 +47,11 @@ class GoodPool extends Model public static function _goodToGithub($sGood, $bEnter = true) { + + if (!$sGood) { + return ''; + } + $aGood = json_decode($sGood); $str = "";