51 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
| <?php
 | |
| declare (strict_types=1);
 | |
| 
 | |
| namespace app\admin;
 | |
| 
 | |
| use app\Request;
 | |
| use app\service\ProductService;
 | |
| use think\App;
 | |
| 
 | |
| /**
 | |
|  * @author canny
 | |
|  * @date 2023/12/7 18:01
 | |
|  **/
 | |
| class templateController extends Base
 | |
| {
 | |
|     private ProductService $service;
 | |
| 
 | |
|     public function __construct(App $app, Request $request)
 | |
|     {
 | |
|         parent::__construct($app, $request);
 | |
|         $this->service = $app->make(ProductService::class);
 | |
|     }
 | |
| 
 | |
|     public function list(): \think\Response
 | |
|     {
 | |
|         return responseOk($this->service->list(self::$input));
 | |
|     }
 | |
| 
 | |
|     public function detail($id): \think\Response
 | |
|     {
 | |
|         return responseOk($this->service->detailById($id));
 | |
|     }
 | |
| 
 | |
|     public function create(): \think\Response
 | |
|     {
 | |
|         $this->service->create(self::$input);
 | |
|         return responseOk();
 | |
|     }
 | |
| 
 | |
|     public function update(): \think\Response
 | |
|     {
 | |
|         $this->service->update(self::$input);
 | |
|         return responseOk();
 | |
|     }
 | |
| 
 | |
|     public function delete($id): \think\Response
 | |
|     {
 | |
|         $this->service->deleteById($id);
 | |
|         return responseOk();
 | |
|     }
 | |
| } |