StockLog.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\controller\user;
  4. use app\common\controller\Backend;
  5. use app\admin\traits\Actions;
  6. use think\annotation\route\Group;
  7. use think\annotation\route\Route;
  8. use app\common\model\StockLog as StockLogModel;
  9. #[Group("user/stock_log")]
  10. class StockLog extends Backend
  11. {
  12. use Actions{
  13. index as private _index;
  14. add as private _add;
  15. edit as private _edit;
  16. }
  17. protected function _initialize()
  18. {
  19. parent::_initialize();
  20. $this->model = new StockLogModel();
  21. }
  22. //查看
  23. #[Route("GET,JSON","index")]
  24. public function index()
  25. {
  26. return $this->_index();
  27. }
  28. //添加
  29. #[Route("GET,POST","add")]
  30. public function add()
  31. {
  32. //通过定义postParams来增加或覆盖post提交的表单
  33. $this->postParams=[];
  34. //通过定义callback回调函数来执行添加后的操作
  35. $this->callback=function ($model){};
  36. return $this->_add();
  37. }
  38. //修改
  39. #[Route("GET,POST","edit")]
  40. public function edit()
  41. {
  42. //通过定义postParams来增加或覆盖post提交的表单
  43. $this->postParams=[];
  44. //通过定义callback回调函数来执行修改后的操作
  45. $this->callback=function ($model){};
  46. return $this->_edit();
  47. }
  48. }