/** * 构造函数 * @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."); } }
/** * @param $pid * @param $uid */ function __construct($pid, $uid) { lib()->load('Picture'); $pic = new Picture(); $info = $pic->get_simple_pic($pid); if (!isset($info['pic_status'])) { $this->throwMsg(-2); } if ($info['pic_status'] < 0) { $this->throwMsg(-1); } $this->pid = +$pid; User::getUser($uid); $this->s_uid = +$uid; $this->info[] = ['id' => $info['pic_id'], 'name' => $info['pic_name'], 'desc' => $info['pic_description'], 'thumbnail' => $info['pic_thumbnails_path'], 'display' => $info['pic_display_path'], 'pic_path' => $info['pic_path']]; $this->server = $info['server_name']; $this->o_uid = +$info['user_id']; $this->status = true; }