示例#1
0
 public function actionNews()
 {
     if ($_GET['id']) {
         $id = $_GET['id'];
     }
     $left = About::find()->asArray()->all();
     $category_id = \common\models\cms\Article::findOne(['id' => $id])->category_id;
     $category_name = \backend\models\Category::findOne(['id' => $category_id])->title;
     $infos = \common\models\cms\Article::findOne(['id' => $id]);
     return $this->render('index', compact("infos", "category_name", "left"));
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = About::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'pai' => $this->pai, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'created_at', $this->created_at])->andFilterWhere(['like', 'updated_at', $this->updated_at]);
     return $dataProvider;
 }
示例#3
0
 public function actionHelp()
 {
     $left = About::find()->asArray()->all();
     try {
         $parent_id = Category::findOne(['title' => '帮助中心', 'status' => 1])->id;
         $infos = Article::find()->where(['category_id' => $parent_id, 'status' => 1]);
         $pages = new Pagination(['totalCount' => $infos->count(), 'pageSize' => '6']);
         $models = $infos->offset($pages->offset)->limit($pages->limit)->all();
     } catch (ErrorException $e) {
         $infos = '';
         $pages = '';
         $models = '';
     }
     return $this->render('help', compact("infos", "models", "pages", 'left'));
 }