<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class LookListAction extends MemberAction
{
    public function run()
    {
        $bookid = intval(S::gp('bid','G'));
        $sql = "SELECT `bid`, `cid`, `sp` FROM `".Favorites::table()."`
        	 	WHERE `memberid` = '{$this->uid()}'
        	 	AND `bid` = '$bookid'
        	 	AND (`cid` IS NOT NULL OR `sp` IS NOT NULL)";
        $progress = $this->db()->setQueryString($sql)->find(true);
        if (empty($progress))
        {
            $message[] = '您还没有保存过本书的阅读记录';
            $this->showMessage($message);
        }
        
        foreach ($progress as $key => $value)
        {
            if (!is_null($value))
            {
                $array[$key] = $value;
            }
        }
        $url = str_replace('&amp;', '&', url('read', $array));
        iforward($url);
    }
}