34 lines
		
	
	
		
			682 B
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			682 B
		
	
	
	
		
			PHP
		
	
	
	
| <?php
 | |
| declare (strict_types=1);
 | |
| 
 | |
| namespace app\front;
 | |
| 
 | |
| use app\Request;
 | |
| use app\service\ProductService;
 | |
| use think\App;
 | |
| 
 | |
| /**
 | |
|  * @author canny
 | |
|  * @date 2024/3/8 9:32
 | |
|  **/
 | |
| class Product extends Base
 | |
| {
 | |
|     private ProductService $productService;
 | |
| 
 | |
|     public function __construct(App $app, Request $request)
 | |
|     {
 | |
|         parent::__construct($app, $request);
 | |
|         $this->productService = $app->make(ProductService::class);
 | |
|     }
 | |
| 
 | |
|     public function detail($id): \think\Response
 | |
|     {
 | |
|         return responseOk($this->productService->detailById($id));
 | |
|     }
 | |
| 
 | |
|     public function sync(): \think\Response
 | |
|     {
 | |
|         $this->productService->sync();
 | |
|         return responseOk();
 | |
|     }
 | |
| } |