初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
63
app/Http/Controllers/Api/PriceSheetController.php
Normal file
63
app/Http/Controllers/Api/PriceSheetController.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\business\PriceSheetService;
|
||||
use Exception;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* 报价单(商品规格)
|
||||
*/
|
||||
class PriceSheetController extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = PriceSheetService::getInstance();
|
||||
$this->insertField = ['catalogue_id'];
|
||||
$this->updateField = ['id'];
|
||||
$this->notRequest = ['specification', 'dimension', 'routine', 'rows', 'status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 某商品的全部规格行(报价单抽屉回填用)
|
||||
* @Method GET
|
||||
*/
|
||||
public function rows(): JsonResponse
|
||||
{
|
||||
return jok($this->service->rowsOf((int) request()->get('catalogue_id', 0)), '列表获取成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 覆盖式保存某商品的全部规格行
|
||||
* @Method POST
|
||||
* @throws Exception
|
||||
*/
|
||||
public function saveRows(): JsonResponse
|
||||
{
|
||||
$this->insertField = ['catalogue_id'];
|
||||
$this->notRequest = ['rows'];
|
||||
$this->checkRequiredFields(request()->post());
|
||||
return jok(
|
||||
$this->service->saveRows(
|
||||
(int) request()->post('catalogue_id'),
|
||||
(array) request()->post('rows', [])
|
||||
),
|
||||
'保存成功'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用 / 禁用
|
||||
* @Method POST
|
||||
* @throws Exception
|
||||
*/
|
||||
public function status(): JsonResponse
|
||||
{
|
||||
$this->insertField = ['id', 'status'];
|
||||
$params = $this->checkRequiredFields(request()->post());
|
||||
return jok($this->service->status($params['id'], $params['status']), '操作成功');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user