<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class CommendsAction extends MemberAction
{
    public function run()
    {
        $member = $this->getMember($this->uid());
        if (empty($member['commends']))
        {
            throw new iSystemException('很抱歉，系统暂时还无法帮找到适合您口味的小说，请耐心等待^_^');
        }
        
        $sql = 'SELECT bookid,bookname,author,`status`,bookinfo,size FROM '.Book::table().' WHERE bookid IN ('.$member['commends'].')';
        $books = $this->db()->setQueryString($sql)->find();
        if (empty($books))
        {
            throw new iSystemException('很抱歉，系统帮您推荐的书不存在，可能已经被删除');
        }
        
        $this->getController()->render('commends', array(
                'books' => $books,
            )
        );
    }
}