初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
61
app/Http/Controllers/Api/ListController.php
Normal file
61
app/Http/Controllers/Api/ListController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\business\ListService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* 清单管理
|
||||
*/
|
||||
class ListController extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = ListService::getInstance();
|
||||
$this->insertField = ['name', 'user_id'];
|
||||
$this->updateField = ['id', 'name'];
|
||||
$this->notRequest = ['remark', 'enterprise_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 某用户的清单
|
||||
* @Method GET
|
||||
*/
|
||||
public function byUser(): JsonResponse
|
||||
{
|
||||
return jok($this->service->byUser((int) request()->get('user_id', 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清单生成订单
|
||||
* @Method POST
|
||||
*/
|
||||
public function toOrder(): JsonResponse
|
||||
{
|
||||
return jok(
|
||||
$this->service->toOrder((int) request()->post('id', 0), request()->post()),
|
||||
'订单已生成'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存清单明细
|
||||
* @Method POST
|
||||
*/
|
||||
public function saveItem(): JsonResponse
|
||||
{
|
||||
return jok($this->service->saveItem(request()->post()), '保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除清单明细
|
||||
* @Method POST
|
||||
*/
|
||||
public function deleteItem(): JsonResponse
|
||||
{
|
||||
return jok($this->service->deleteItem(request()->post('ids', [])), '删除成功');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user