function __construct($g_id, $page = false, $info = NULL) { parent::__construct("gallery_has_comments", "gallery_id", intval($g_id), "gallery"); $this->page = intval($page); $this->action_method = "post_gallery"; $this->router = lib()->using('router'); if (!is_array($info)) { $this->gallery_info = $this->db->get("gallery", ["gallery_comment_status", 'users_id' => 'user_id', 'gallery_title', 'gallery_status'], ['id' => $g_id]); } else { $this->gallery_info = $info; } }
function __construct($post_id, $page = false, $info = NULL) { parent::__construct("posts_has_comments", "posts_id", intval($post_id), "posts"); $this->page = intval($page); $this->action_method = "post_post"; $this->router = lib()->using('router'); if ($info === NULL) { $this->post_info = $this->db->get("posts", ['users_id' => 'user_id', 'post_status', 'post_allow_comment'], ['id' => $post_id]); } else { $this->post_info = $info; } }
/** * 构造函数 * @param int $pic_id 图片ID * @param int|bool $page 当前页面数 * @param array $info 图片的相关信息 * @throws \Exception */ function __construct($pic_id, $page = false, $info = NULL) { parent::__construct("pictures_has_comments", "pictures_id", intval($pic_id), "pictures"); $this->page = intval($page); $this->action_method = "post_picture"; $this->router = lib()->using('router'); if ($info === NULL) { lib()->load('Picture'); $pic = new Picture(); $this->picture_info = $pic->get_simple_pic($pic_id); } else { $this->picture_info = $info; } if (!isset($this->picture_info['pic_id'])) { throw new \Exception("Picture comment load error."); } }