39 lines
977 B
PHP
39 lines
977 B
PHP
<?php
|
|
|
|
namespace app\adminapi\lists\ai;
|
|
|
|
use app\adminapi\lists\BaseAdminDataLists;
|
|
use app\common\lists\ListsSearchInterface;
|
|
use app\common\model\ai\AiKbQueryLog;
|
|
|
|
class KbQueryLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
{
|
|
public function setSearch(): array
|
|
{
|
|
return [
|
|
'=' => ['scene', 'status', 'user_id'],
|
|
'%like%' => ['query_text'],
|
|
];
|
|
}
|
|
|
|
public function lists(): array
|
|
{
|
|
$lists = AiKbQueryLog::where($this->searchWhere)
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
->order('id', 'desc')
|
|
->select()
|
|
->toArray();
|
|
|
|
foreach ($lists as &$item) {
|
|
$item['create_time_text'] = !empty($item['create_time']) ? date('Y-m-d H:i:s', (int) $item['create_time']) : '-';
|
|
}
|
|
|
|
return $lists;
|
|
}
|
|
|
|
public function count(): int
|
|
{
|
|
return AiKbQueryLog::where($this->searchWhere)->count();
|
|
}
|
|
}
|