multi-store/app/admin/controller/warehouse_product/WarehouseProductController.php

108 lines
2.9 KiB
PHP

<?php
namespace app\admin\controller\warehouse_product;
use app\admin\controller\BaseAdminController;
use app\admin\lists\warehouse_product\WarehouseProductLists;
use app\admin\logic\warehouse_product\WarehouseProductLogic;
use app\admin\validate\warehouse_product\WarehouseProductValidate;
use app\common\model\warehouse_product\WarehouseProduct;
/**
* 商品仓储信息控制器
* Class WarehouseProductController
* @package app\admin\controller\warehouse_product
*/
class WarehouseProductController extends BaseAdminController
{
/**
* @notes 获取商品仓储信息列表
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function lists()
{
return $this->dataLists(new WarehouseProductLists());
}
/**
* @notes 添加商品仓储信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function add()
{
$params = (new WarehouseProductValidate())->post()->goCheck('add');
$params['admin_id']=$this->adminId;
$result = WarehouseProductLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(WarehouseProductLogic::getError());
}
/**
* @notes 编辑商品仓储信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function edit()
{
$params = (new WarehouseProductValidate())->post()->goCheck('edit');
$params['admin_id']=$this->adminId;
$result = WarehouseProductLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(WarehouseProductLogic::getError());
}
/**
* @notes 删除商品仓储信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function delete()
{
$params = (new WarehouseProductValidate())->post()->goCheck('delete');
WarehouseProductLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取商品仓储信息详情
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function detail()
{
$params = (new WarehouseProductValidate())->goCheck('detail');
$result = WarehouseProductLogic::detail($params);
return $this->data($result);
}
/**
* 确认操作
*/
public function enter(){
$id=$this->request->post('id');
$result = WarehouseProductLogic::enter($id);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(WarehouseProductLogic::getError());
return $this->success($result);
}
}