|
@@ -5,6 +5,7 @@ namespace App\Modules\Mini\Services;
|
|
use App\Base\BaseService;
|
|
use App\Base\BaseService;
|
|
use App\Exceptions\ClientException;
|
|
use App\Exceptions\ClientException;
|
|
use App\Models\Goods\Goods;
|
|
use App\Models\Goods\Goods;
|
|
|
|
+use App\Models\Goods\GoodsCategoryMap;
|
|
use App\Models\Goods\GoodsSku;
|
|
use App\Models\Goods\GoodsSku;
|
|
use App\Models\Goods\Spec;
|
|
use App\Models\Goods\Spec;
|
|
use App\Models\Goods\SpecAttr;
|
|
use App\Models\Goods\SpecAttr;
|
|
@@ -20,6 +21,10 @@ class GoodsService extends BaseService
|
|
$goods->save();
|
|
$goods->save();
|
|
return [
|
|
return [
|
|
"id" => $goods->id,
|
|
"id" => $goods->id,
|
|
|
|
+ "name" => $goods->name,
|
|
|
|
+ "category_name" => $goods->map->map(function (GoodsCategoryMap $map) {
|
|
|
|
+ return optional($map->category)->name;
|
|
|
|
+ })->implode("/"),
|
|
"image_list" => $goods->image_list,
|
|
"image_list" => $goods->image_list,
|
|
"spec" => array_map(function ($specId) {
|
|
"spec" => array_map(function ($specId) {
|
|
try {
|
|
try {
|