<?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(); } }