OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
33
app/Domain/Tickets/Repositories/TicketHistory.php
Normal file
33
app/Domain/Tickets/Repositories/TicketHistory.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Tickets\Repositories;
|
||||
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Leantime\Core\Db\Db as DbCore;
|
||||
|
||||
class TicketHistory
|
||||
{
|
||||
private ConnectionInterface $db;
|
||||
|
||||
/**
|
||||
* __construct - get database connection
|
||||
*/
|
||||
public function __construct(DbCore $db)
|
||||
{
|
||||
$this->db = $db->getConnection();
|
||||
}
|
||||
|
||||
public function getRecentTicketHistory(\DateTime $startingFrom, int $ticketId): array
|
||||
{
|
||||
$query = $this->db->table('zp_tickethistory')
|
||||
->where('dateModified', '>=', $startingFrom->format('Y-m-d'));
|
||||
|
||||
if ($ticketId !== null) {
|
||||
$query->where('ticketId', $ticketId);
|
||||
}
|
||||
|
||||
$results = $query->orderBy('dateModified', 'desc')->get();
|
||||
|
||||
return array_map(fn ($item) => (array) $item, $results->toArray());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user