multi-store/app/admin/controller/warehouse/WarehouseController.php

95 lines
2.2 KiB
PHP

<?php
namespace app\admin\controller\warehouse;
use app\admin\controller\BaseAdminController;
use app\admin\lists\warehouse\WarehouseLists;
use app\admin\logic\warehouse\WarehouseLogic;
use app\admin\validate\warehouse\WarehouseValidate;
/**
* 仓库信息控制器
* Class WarehouseController
* @package app\admin\controller\warehouse
*/
class WarehouseController extends BaseAdminController
{
/**
* @notes 获取仓库信息列表
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:10
*/
public function lists()
{
return $this->dataLists(new WarehouseLists());
}
/**
* @notes 添加仓库信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:10
*/
public function add()
{
$params = (new WarehouseValidate())->post()->goCheck('add');
$result = WarehouseLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(WarehouseLogic::getError());
}
/**
* @notes 编辑仓库信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:10
*/
public function edit()
{
$params = (new WarehouseValidate())->post()->goCheck('edit');
$result = WarehouseLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(WarehouseLogic::getError());
}
/**
* @notes 删除仓库信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:10
*/
public function delete()
{
$params = (new WarehouseValidate())->post()->goCheck('delete');
WarehouseLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取仓库信息详情
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:10
*/
public function detail()
{
$params = (new WarehouseValidate())->goCheck('detail');
$result = WarehouseLogic::detail($params);
return $this->data($result);
}
}