public function actionGetFavouriteStory()
 {
     $customer_id = $this->getParam("customer_id");
     $ids = HiStoryFavourite::model()->findByAttributes(array('customer_id' => $customer_id));
     $result = array();
     if (!empty($ids)) {
         $c = new CDbCriteria();
         $c->addInCondition('story_id', json_decode($ids['story_ids']));
         $result = Converter::convertModelToArray(HiStory::model()->with('customer')->findAll($c));
     }
     EchoUtility::echoMsgTF(true, '获取收藏的故事', $result);
 }
 public function actionGetHomeData()
 {
     $result = array();
     $story_c = new CDbCriteria();
     $story_c->addCondition('follow_count != 0');
     $story_c->order = 'follow_count DESC';
     $stories = Converter::convertModelToArray(HiStory::model()->with('customer')->findAll($story_c));
     $result['story'] = $stories[0];
     $article = Converter::convertModelToArray(HiPushArticle::model()->findByPk(Yii::app()->time_service->getIndex()));
     $result['article'] = $article;
     $question = Converter::convertModelToArray(HiQuestion::model()->findByPk(2));
     $question['cover_image'] = 'http://77fkpo.com5.z0.glb.clouddn.com/603b2cffffeb7c5c950a4c9517e8ee9e.jpg';
     $result['question'] = $question;
     $book = Converter::convertModelToArray(HiBook::model()->with('customer')->findByPk(1));
     $result['book'] = $book;
     EchoUtility::echoMsgTF(true, '获取首页数据', $result);
 }
 public function actionGetCommentByStoryId()
 {
     $story_id = $this->getParam('story_id');
     $comments = Converter::convertModelToArray(HiStory::model()->with('customer', 'comments.customer')->findByPk($story_id));
     EchoUtility::echoMsgTF(1, '获取段子评论', $comments);
 }
 public function actionGetStoryList()
 {
     $start = $this->getParam('start');
     $num = $this->getParam('num');
     $c = new CDbCriteria();
     $c->offset = $start;
     $c->limit = $num;
     $stories = Converter::convertModelToArray(HiStory::model()->with('customer')->findAll($c));
     $result = array();
     if (count($stories) < $num) {
         $result['has_more'] = false;
     } else {
         $result['has_more'] = true;
     }
     $result['story_list'] = $stories;
     $result['success'] = true;
     EchoUtility::echoMsgTF(1, '获取段子列表', $result);
 }