예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = KefuFaq::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'category_id' => $this->category_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * 通过客服常用问题分类的slug获取该分类下的所有数据
  * @param $categorySlug 客服常用问题分类slug
  * @param $limit	限制返回的数据个数
  * @return array|\yii\db\ActiveRecord[]
  */
 public static function getKefuFaqbyCategorySlug($categorySlug, $limit)
 {
     $qiTaWenTis = KefuFaq::find()->where(['status' => KefuFaq::STATUS_IN_USE, 'category_id' => KefuFaqCat::findOne(['slug' => $categorySlug])['id']])->orderBy("created_at DESC")->limit($limit)->all();
     return $qiTaWenTis;
 }