|
|
@ -3,7 +3,10 @@ |
|
|
namespace App\Controller\v3; |
|
|
namespace App\Controller\v3; |
|
|
|
|
|
|
|
|
use App\Controller\BaseController; |
|
|
use App\Controller\BaseController; |
|
|
|
|
|
use App\Model\v3\Category; |
|
|
|
|
|
use App\Model\v3\GoodsCategory; |
|
|
use App\Request\v3\GoodsEditorRequest; |
|
|
use App\Request\v3\GoodsEditorRequest; |
|
|
|
|
|
use App\Service\v3\Interfaces\CategoryServiceInterface; |
|
|
use App\Service\v3\Interfaces\ShopCartServiceInterface; |
|
|
use App\Service\v3\Interfaces\ShopCartServiceInterface; |
|
|
use App\Service\v3\Implementations\GoodsActivityService; |
|
|
use App\Service\v3\Implementations\GoodsActivityService; |
|
|
use App\Service\v3\Interfaces\CollectStoreServiceInterface; |
|
|
use App\Service\v3\Interfaces\CollectStoreServiceInterface; |
|
|
@ -38,6 +41,12 @@ class GoodsController extends BaseController |
|
|
*/ |
|
|
*/ |
|
|
protected $shopCartService; |
|
|
protected $shopCartService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Inject |
|
|
|
|
|
* @var CategoryServiceInterface |
|
|
|
|
|
*/ |
|
|
|
|
|
protected $categoryService; |
|
|
|
|
|
|
|
|
public function detail(GoodsRequest $request) |
|
|
public function detail(GoodsRequest $request) |
|
|
{ |
|
|
{ |
|
|
$params = $this->request->all(); |
|
|
$params = $this->request->all(); |
|
|
@ -88,7 +97,22 @@ class GoodsController extends BaseController |
|
|
public function info() |
|
|
public function info() |
|
|
{ |
|
|
{ |
|
|
$goodsId = $this->request->input('goods_id',0); |
|
|
$goodsId = $this->request->input('goods_id',0); |
|
|
$res = $this->goodsService->info($goodsId); |
|
|
|
|
|
return $this->success($res); |
|
|
|
|
|
|
|
|
$goods = $this->goodsService->info($goodsId); |
|
|
|
|
|
$goods['secend'] = Category::find($goods['category_id']); |
|
|
|
|
|
$goods['first'] = Category::find($goods['secend']['parent_id']); |
|
|
|
|
|
if(!empty($goods['goods_category_id'])){ |
|
|
|
|
|
$goods['third'] = GoodsCategory::find($goods['goods_category_id']); |
|
|
|
|
|
}else{ |
|
|
|
|
|
$goods['third'] = null; |
|
|
|
|
|
} |
|
|
|
|
|
$first = $this->categoryService->getByParentId(0); |
|
|
|
|
|
$secend = $this->categoryService->getByParentId($goods['category_id']); |
|
|
|
|
|
$third = $this->categoryService->getThird($goods['category_id']); |
|
|
|
|
|
return $this->success([ |
|
|
|
|
|
'goods' => $goods, |
|
|
|
|
|
'first' => $first, |
|
|
|
|
|
'secend' => $secend, |
|
|
|
|
|
'third' => $third |
|
|
|
|
|
]); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |