public function actionIndex()
 {
     $searchModel = new CourseSearch();
     $params = Yii::$app->request->queryParams;
     //分类
     empty($params['slug']) ?: ($params['CourseSearch']['slug'] = $params['slug']);
     if (isset($params['slug'])) {
         $courseTerm = CourseTerms::findOne(['slug' => $params['slug']]);
         $courseTerm ? $params['CourseSearch']['course_terms'] = $courseTerm->id : '';
     }
     //排序
     empty($params['sort']) ? '' : '';
     //
     $dataProvider = $searchModel->search($params);
     $sort = $dataProvider->getSort();
     $sort->attributes = array_merge($sort->attributes, ['new' => ['asc' => ['created_at' => SORT_DESC]], 'hot' => ['asc' => ['created_at' => SORT_DESC]], 'rec' => ['asc' => ['create_at' => SORT_DESC]]]);
     return $this->render('index', ['searchModel' => $searchModel, 'sorts' => $this->sorts, 'dataProvider' => $dataProvider]);
 }
 /**
  * Lists all Course models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new CourseSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }