| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- declare (strict_types = 1);
- namespace app\admin\controller\shop;
- use app\common\controller\Backend;
- use think\annotation\route\Group;
- use think\annotation\route\Route;
- use app\admin\traits\Actions;
- use app\common\model\Customer;
- use app\common\model\User;
- use app\common\model\ShopList as ShopListModel;
- #[Group("shop/shop_list")]
- class ShopList extends Backend
- {
- use Actions{
- add as protected _add;
- edit as protected _edit;
- }
- protected function _initialize()
- {
- parent::_initialize();
- $this->model = new ShopListModel();
- $this->assign('customerList', Customer::where('status',Customer::STATUS_NORMAL)->column('name','id'));
- $this->assign('platformList', config("app.platform_list"));
- $this->assign('userList', User::where('status',Customer::STATUS_NORMAL)->column('nickname','id'));
-
- $this->relationField=['customer','staff'];
- }
-
-
- #[Route('GET,POST','add')]
- public function add()
- {
- if($this->request->isPost()){
-
- }
- return $this->_add();
- }
- #[Route('GET,POST','edit')]
- public function edit()
- {
- $ids = $this->request->get('ids');
- $row = $this->model->find($ids);
- //...可以对row进行一些前置的操作
- if($this->request->isPost()){
- //通过postParams属性可以增加或者覆盖前端row/a传过来的参数
- //$this->postParams['属性名']='属性的值';
- }
- //注意这里传入已经修改过的$row
- return $this->_edit($row);
- }
-
- //删除
- #[Route("GET","del")]
- public function del()
- {
- return "删除";
- }
-
- //导入
- #[Route("GET","import")]
- public function import()
- {
- return "导入";
- }
- }
|