lihaiMiddleOffice/app/psi/controller/WarehouseProductController.php

90 lines
2.0 KiB
PHP

<?php
namespace app\psi\controller;
use app\admin\controller\BaseAdminController;
use app\psi\lists\WarehouseProductLists;
use app\psi\logic\WarehouseProductLogic;
use app\psi\validate\WarehouseProductValidate;
/**
* PsiWarehouseProduct控制器
* Class WarehouseProductController
* @package app\psi\controller
*/
class WarehouseProductController extends BaseAdminController
{
/**
* @notes 获取列表
* @author admin
* @date 2025/03/10 11:08
*/
public function lists()
{
return $this->dataLists(new WarehouseProductLists());
}
/**
* @notes 添加
* @author admin
* @date 2025/03/10 11:08
*/
public function add()
{
$params = (new WarehouseProductValidate())->post()->goCheck('add');
$result = WarehouseProductLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(WarehouseProductLogic::getError());
}
/**
* @notes 编辑
* @author admin
* @date 2025/03/10 11:08
*/
public function edit()
{
$params = $this->request->post();
$result = WarehouseProductLogic::edit($params, $this->adminId);
if ($result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(WarehouseProductLogic::getError());
}
/**
* @notes 删除
* @author admin
* @date 2025/03/10 11:08
*/
public function delete()
{
$params = (new WarehouseProductValidate())->post()->goCheck('delete');
WarehouseProductLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @author admin
* @date 2025/03/10 11:08
*/
public function detail()
{
$params = (new WarehouseProductValidate())->goCheck('detail');
$result = WarehouseProductLogic::detail($params);
return $this->data($result);
}
}