mirror of
https://github.com/YGGverse/Pulsar.git
synced 2026-03-31 17:55:37 +00:00
fix channelId relation
This commit is contained in:
parent
3000f643f8
commit
21028c2416
2 changed files with 30 additions and 28 deletions
|
|
@ -167,36 +167,36 @@ class Nex implements MessageComponentInterface
|
||||||
{
|
{
|
||||||
$lines[] = $channel->description . PHP_EOL;
|
$lines[] = $channel->description . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Get channel items
|
// Get channel items
|
||||||
foreach ((array) $this->_database->getChannelItems(0, 20) as $channelItem)
|
foreach ((array) $this->_database->getChannelItems($channel->id, 0, 20) as $channelItem)
|
||||||
{
|
|
||||||
$lines[] = sprintf(
|
|
||||||
'=> /%d.gmi %s %s',
|
|
||||||
$channelItem->id,
|
|
||||||
$channelItem->pubTime ?
|
|
||||||
date(
|
|
||||||
'Y-m-d',
|
|
||||||
$channelItem->pubTime
|
|
||||||
) : '',
|
|
||||||
\Yggverse\Pulsar\Model\Filter::string(
|
|
||||||
$channelItem->title
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($channelItem->description)
|
|
||||||
{
|
{
|
||||||
$lines[] = \Yggverse\Pulsar\Model\Filter::text(
|
$lines[] = sprintf(
|
||||||
$channelItem->description
|
'=> /%d.gmi %s %s',
|
||||||
) . PHP_EOL;
|
$channelItem->id,
|
||||||
}
|
$channelItem->pubTime ?
|
||||||
|
date(
|
||||||
|
'Y-m-d',
|
||||||
|
$channelItem->pubTime
|
||||||
|
) : '',
|
||||||
|
\Yggverse\Pulsar\Model\Filter::string(
|
||||||
|
$channelItem->title
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if ($channelItem->content)
|
if ($channelItem->description)
|
||||||
{
|
{
|
||||||
$lines[] = \Yggverse\Pulsar\Model\Filter::text(
|
$lines[] = \Yggverse\Pulsar\Model\Filter::text(
|
||||||
$channelItem->content
|
$channelItem->description
|
||||||
) . PHP_EOL;
|
) . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($channelItem->content)
|
||||||
|
{
|
||||||
|
$lines[] = \Yggverse\Pulsar\Model\Filter::text(
|
||||||
|
$channelItem->content
|
||||||
|
) . PHP_EOL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,13 +198,15 @@ class Database
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChannelItems(
|
public function getChannelItems(
|
||||||
|
int $channelId,
|
||||||
int $start = 0,
|
int $start = 0,
|
||||||
int $limit = 20
|
int $limit = 20
|
||||||
): ?array
|
): ?array
|
||||||
{
|
{
|
||||||
$query = $this->_database->query(
|
$query = $this->_database->query(
|
||||||
sprintf(
|
sprintf(
|
||||||
'SELECT * FROM `channelItem` ORDER BY `pubTime` DESC, `time` DESC, `id` DESC LIMIT %d,%d',
|
'SELECT * FROM `channelItem` WHERE `channelId` = %d ORDER BY `pubTime` DESC, `time` DESC, `id` DESC LIMIT %d,%d',
|
||||||
|
$channelId,
|
||||||
$start,
|
$start,
|
||||||
$limit
|
$limit
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue