| 
						
						
						
					 | 
				
				 | 
				
					@ -0,0 +1,45 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					<?php | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					namespace App\Http\Controllers\Api; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Http\Controllers\Controller; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\Channel; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\Notice; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\Product; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\Slide; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\UserChannel; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * 小程序首页 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * Class IndexController | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * @package App\Http\Controllers\Api | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					class IndexController extends Controller | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // 首页数据大杂烩
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public function index() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        # 轮播图
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $slide = Slide::where('status', 1)->orderBy('sort')->orderBy('id', 'DESC')->limit(2)->get(['title','url']); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        # 公告
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $notice = Notice::limit(10)->get(['title', 'updated_at']); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        # 我的频道
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $channel_ids = UserChannel::where('uid', $this->user_id)->value('channels'); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $my_channels = Channel::whereIn('id', $channel_ids)->get(['id', 'pid', 'name', 'icon']); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        # 人气爆款
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $hots = Product::get(['title', 'price', 'original_price', 'pictures', 'sales']); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        # 猜你喜欢
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $guess = Product::get(['title', 'price', 'original_price', 'pictures', 'sales']); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return $this->success([ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'slide' => $slide, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'notice' => $notice, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'my_channels' => $my_channels, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'hots' => $hots, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'guess' => $guess, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ]); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} |