lihaiMiddleOffice/app/psi/controller/StoreProductPriceController.php

114 lines
2.6 KiB
PHP
Raw Normal View History

2025-04-03 16:25:57 +08:00
<?php
namespace app\psi\controller;
use app\admin\controller\BaseAdminController;
use app\psi\lists\StoreProductPriceLists;
use app\psi\logic\StoreProductPriceLogic;
use app\psi\validate\StoreProductPriceValidate;
/**
* StoreProductPrice控制器
* Class StoreProductPriceController
* @package app\psi\controller
*/
class StoreProductPriceController extends BaseAdminController
{
/**
* @notes 获取列表
* @author admin
* @date 2025/04/03 15:19
*/
public function lists()
{
return $this->dataLists(new StoreProductPriceLists());
}
/**
* @notes 添加
* @author admin
* @date 2025/04/03 15:19
*/
public function add()
{
$params = (new StoreProductPriceValidate())->post()->goCheck('add');
$result = StoreProductPriceLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(StoreProductPriceLogic::getError());
}
/**
* @notes 编辑
* @author admin
* @date 2025/04/03 15:19
*/
public function edit()
{
$params = (new StoreProductPriceValidate())->post()->goCheck('edit');
$result = StoreProductPriceLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(StoreProductPriceLogic::getError());
}
/**
* @notes 删除
* @author admin
* @date 2025/04/03 15:19
*/
public function delete()
{
$params = (new StoreProductPriceValidate())->post()->goCheck('delete');
StoreProductPriceLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @author admin
* @date 2025/04/03 15:19
*/
public function detail()
{
$params = (new StoreProductPriceValidate())->goCheck('detail');
$result = StoreProductPriceLogic::detail($params);
return $this->data($result);
}
/**
* @notes 确认改价
*/
public function enterPrice()
{
$params = $this->request->post();
$result = StoreProductPriceLogic::enterPrice($params);
return $this->success('设置成功', [], 1, 1);
}
public function export()
{
$params = $this->request->post();
$file_path = StoreProductPriceLogic::export($params);
return $this->success('导出成功', ['url' => $file_path]);
}
public function chart()
{
$params = $this->request->get();
$data = StoreProductPriceLogic::chart($params);
return $this->data($data);
}
}