コード例 #1
0
 public function actionAddComment()
 {
     $section_id = $this->getParam('section_id');
     $story_id = $this->getParam('story_id');
     $customer_id = $this->getParam('customer_id');
     $content = $this->getParam('content');
     $orig_customer_id = $this->getParam('orig_customer_id');
     $newComment = new HiStoryComment();
     $newComment['customer_id'] = $customer_id;
     if (isset($section_id)) {
         $newComment['section_id'] = $section_id;
     }
     if (isset($story_id)) {
         $newComment['story_id'] = $story_id;
     }
     $newComment['orig_customer_id'] = $orig_customer_id;
     $newComment['content'] = $content;
     $newComment['insert_time'] = date('Y-m-d H:i:s', time());
     $newComment->insert();
     $comment = Converter::convertModelToArray(HiStoryComment::model()->with('customer')->findByPk($newComment->getPrimaryKey()));
     EchoUtility::echoMsgTF(1, '插入评论', $comment);
 }
コード例 #2
0
 public function actionGetMyComment()
 {
     $orig_customer_id = $this->getParam("customer_id");
     $c = new CDbCriteria();
     $c->addCondition('sc.orig_customer_id = ' . $orig_customer_id);
     $c->group = 'sc.story_id';
     $comments = Converter::convertModelToArray(HiStoryComment::model()->with('story', 'customer')->findAll($c));
     EchoUtility::echoMsgTF(true, '获取评论', $comments);
 }