| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- declare (strict_types = 1);
- namespace app\admin\controller\user;
- use app\common\controller\Backend;
- use app\admin\traits\Actions;
- use think\annotation\route\Group;
- use think\annotation\route\Route;
- use app\common\model\StockConfig;
- use app\common\model\StockLog as StockLogModel;
- #[Group("user/stock_log")]
- class StockLog extends Backend
- {
- use Actions{
- index as private _index;
- add as private _add;
- edit as private _edit;
- }
- protected function _initialize()
- {
- parent::_initialize();
- $this->model = new StockLogModel();
- $this->assign('typeList', StockConfig::getTypeList());
- $this->relationField=['stockconfig'];
- }
- //查看
- #[Route("GET,JSON","index")]
- public function index()
- {
- return $this->_index();
- }
- //添加
- #[Route("GET,POST","add")]
- public function add()
- {
- //通过定义postParams来增加或覆盖post提交的表单
- $this->postParams=[];
- //通过定义callback回调函数来执行添加后的操作
- $this->callback=function ($model){};
- return $this->_add();
- }
- //修改
- #[Route("GET,POST","edit")]
- public function edit()
- {
- //通过定义postParams来增加或覆盖post提交的表单
- $this->postParams=[];
- //通过定义callback回调函数来执行修改后的操作
- $this->callback=function ($model){};
- return $this->_edit();
- }
- }
|