1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace app\admin\controller;
- use app\admin\attr\Permission;
- use app\common\util\Result;
- use think\annotation\route\Get;
- use think\annotation\route\Group;
- use app\common\model\Good as GoodModel;
- use app\admin\controller\BaseAuthorized;
- #[Permission('good')]
- #[Group('good')]
- class Good extends BaseAuthorized
- {
- public function page()
- {
- return $this->GoodService()->page();
- }
- #[Get(rule: 'get/name')]
- public function getByName($name)
- {
- return GoodModel::getByName($name) ?? Result::failed('不存在的商品');
- }
- #[Get(rule: 'get/no')]
- public function getByNo($no)
- {
- return GoodModel::getByNo($no) ?? Result::failed('不存在的商品');
- }
- public function create()
- {
- return $this->GoodService()->create();
- }
- public function delete()
- {
- return $this->GoodService()->delete();
- }
- public function update()
- {
- return $this->GoodService()->update();
- }
- public function template()
- {
- return download(public_path('static/execl') . 'GOOD_TEMPLATE.xlsx', '物品导入模板.xlsx');
- }
- public function import()
- {
- return $this->GoodService()->import();
- }
- public function export()
- {
- return $this->GoodService()->export();
- }
- }
|