53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\BaseApp\BaseController;
|
|
use App\Service\business\PackageService;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
/**
|
|
* 后台套餐搭配
|
|
*/
|
|
class PackageController extends BaseController
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->service = PackageService::getInstance();
|
|
$this->insertField = ['name'];
|
|
$this->updateField = ['id', 'name'];
|
|
$this->notRequest = ['cover', 'subtitle', 'remark', 'is_hot', 'sort', 'status', 'package_amount'];
|
|
}
|
|
|
|
/**
|
|
* 上架 / 下架
|
|
* @Method POST
|
|
*/
|
|
public function status(): JsonResponse
|
|
{
|
|
return jok(
|
|
$this->service->status((int) request()->post('id'), request()->post('status')),
|
|
'操作成功'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 保存搭配明细并重算原价 / 补差价
|
|
* @Method POST
|
|
*/
|
|
public function saveItems(): JsonResponse
|
|
{
|
|
return jok($this->service->saveItems(request()->post()), '搭配已保存');
|
|
}
|
|
|
|
/**
|
|
* 搭配搜索:带回封面和规格,无有效报价的规格 selectable=false
|
|
* @Method GET
|
|
*/
|
|
public function searchCatalog(): JsonResponse
|
|
{
|
|
return jok($this->service->searchCatalog());
|
|
}
|
|
}
|