multi-store/app/store/controller/change_price_log/ChangePriceLogController.php
mkm dbb7b9e4c8 feat(store): 添加价格变更日志功能
- 新增价格变更日志模型、控制器、列表、逻辑和验证器
- 在商品编辑时记录价格变更日志
- 实现价格变更日志的添加、编辑、删除和详情功能
2025-01-10 17:24:37 +08:00

95 lines
2.3 KiB
PHP

<?php
namespace app\store\controller\change_price_log;
use app\store\lists\change_price_log\ChangePriceLogLists;
use app\store\logic\change_price_log\ChangePriceLogLogic;
use app\store\validate\change_price_log\ChangePriceLogValidate;
use app\store\controller\BaseAdminController;
/**
* 价格变更记录控制器
* Class ChangePriceLogController
* @package app\store\controller\change_price_log
*/
class ChangePriceLogController extends BaseAdminController
{
/**
* @notes 获取价格变更记录列表
* @return \think\response\Json
* @author admin
* @date 2025/01/10 15:54
*/
public function lists()
{
return $this->dataLists(new ChangePriceLogLists());
}
/**
* @notes 添加价格变更记录
* @return \think\response\Json
* @author admin
* @date 2025/01/10 15:54
*/
public function add()
{
$params = (new ChangePriceLogValidate())->post()->goCheck('add');
$result = ChangePriceLogLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(ChangePriceLogLogic::getError());
}
/**
* @notes 编辑价格变更记录
* @return \think\response\Json
* @author admin
* @date 2025/01/10 15:54
*/
public function edit()
{
$params = (new ChangePriceLogValidate())->post()->goCheck('edit');
$result = ChangePriceLogLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(ChangePriceLogLogic::getError());
}
/**
* @notes 删除价格变更记录
* @return \think\response\Json
* @author admin
* @date 2025/01/10 15:54
*/
public function delete()
{
$params = (new ChangePriceLogValidate())->post()->goCheck('delete');
ChangePriceLogLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取价格变更记录详情
* @return \think\response\Json
* @author admin
* @date 2025/01/10 15:54
*/
public function detail()
{
$params = (new ChangePriceLogValidate())->goCheck('detail');
$result = ChangePriceLogLogic::detail($params);
return $this->data($result);
}
}