Files
nl-mall-api/app/Http/Controllers/Api/CodeGeneration/SkuController.php

38 lines
1017 B
PHP

<?php
namespace App\Http\Controllers\Api\CodeGeneration;
use App\BaseApp\BaseController;
use App\Service\CodeGeneration\SkuService;
use Illuminate\Http\JsonResponse;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class SkuController extends BaseController
{
//
public function __construct()
{
parent::__construct();
$this->insertField = ["product_id","cover", "name","inventory","price"];
$this->updateField = ["id","product_id","cover", "name","inventory","price"];
$this->service = SkuService::getInstance();
}
/**
* 获取sku列表根据商品id
* @Method GET
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getSkuByProductId()
{
$id = request()->get('id');
if (!$id) {
return jerr('参数错误');
}
return jok($this->service->getSkuByProductId($id));
}
}