| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | 
							- <?php
 
- namespace app\home\controller;
 
- use app\common\model\PreviousModel;
 
- use app\common\model\PreviousYearModel;
 
- use app\common\model\ReservedModel;
 
- use app\home\HomeBaseController;
 
- class Previous extends HomeBaseController
 
- {
 
-     public function index()
 
-     {
 
-         $year_id   = input('year_id/d');
 
-         $year_list = PreviousYearModel::order(['priority' => 'desc'])->select();
 
-         if (empty($year_id)) {
 
-             $year_id = $year_list[count($year_list) - 1]['id'];
 
-         }
 
-         return view('', [
 
-             'year_list' => $year_list,
 
-             'year_id'   => $year_id,
 
-         ]);
 
-     }
 
-     public function list()
 
-     {
 
-         $month   = input('month/d');
 
-         $year_id = input('year_id/d');
 
-         if (empty($month) || empty($year_id)) {
 
-             return redirect(url('index'));
 
-         }
 
-         $previous = PreviousModel::where('status', ReservedModel::STATUS_SHOW)
 
-             ->where('year_id', $year_id)
 
-             ->where('month', $month)
 
-             ->order(['priority' => 'desc', 'id' => 'desc'])
 
-             ->select();
 
-         $previous = array_split($previous, 3);
 
-         $year_list = PreviousYearModel::order(['priority' => 'desc'])->select();
 
-         return view('', [
 
-             'previous'    => $previous,
 
-             'year_list'   => $year_list,
 
-             'year_id'     => $year_id,
 
-             'month_index' => $month,
 
-             'month_list'  => PreviousModel::MONTH,
 
-         ]);
 
-     }
 
- }
 
 
  |