You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							35 lines
						
					
					
						
							751 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							35 lines
						
					
					
						
							751 B
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								namespace App\Http\Controllers\Api;
							 | 
						|
								use App\Http\Controllers\Controller;
							 | 
						|
								use App\Models\Notice;
							 | 
						|
								
							 | 
						|
								/**
							 | 
						|
								 * 公告
							 | 
						|
								 * Class NoticeController
							 | 
						|
								 * @package App\Http\Controllers\Api
							 | 
						|
								 */
							 | 
						|
								class NoticeController extends Controller
							 | 
						|
								{
							 | 
						|
									// 公告列表
							 | 
						|
								    public function index()
							 | 
						|
								    {
							 | 
						|
								        $list = Notice::query()->where('agent_id', $this->agent_id)
							 | 
						|
											->status()
							 | 
						|
											->select(['title', 'updated_at'])
							 | 
						|
											->orderBy('id', 'DESC')
							 | 
						|
											->simplePaginate(15);
							 | 
						|
								        return $this->success($list);
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    public function show()
							 | 
						|
									{
							 | 
						|
										$id = (int)request()->input('id');
							 | 
						|
								
							 | 
						|
										$data = Notice::where('agent_id', $this->agent_id)->status()->find($id);
							 | 
						|
										if (!$data) {
							 | 
						|
											return $this->error('公告不存在或已删除');
							 | 
						|
										}
							 | 
						|
										return $this->success($data);
							 | 
						|
									}
							 | 
						|
								}
							 |