Example #1
0
 /**
  * 定义与Post的关联关系
  */
 public function getPost()
 {
     return $this->hasMany(Post::className(), ['news_id' => 'news_id']);
 }
Example #2
0
 protected function _parseMainPageNews($data)
 {
     $result = [];
     $data = json_decode($data, true);
     if ($data) {
         $result = Post::getNewsByNewsId($data);
     }
     return $result;
 }