Files
sbnews/server/app/common/model/ai/AiAnalysis.php
T
2026-06-11 12:15:29 +08:00

41 lines
949 B
PHP

<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiAnalysis extends BaseModel
{
// 分析类型
const TYPE_MATCH_PREDICT = 1;
const TYPE_ARTICLE_ANALYSIS = 2;
const TYPE_USER_CREDIBILITY = 3;
const TYPE_LOTTERY_ANALYSIS = 4;
const TYPE_POST_ANALYSIS = 5;
const TYPE_KB_RETRIEVAL = 6;
const TYPE_ASSISTANT_CHAT = 7;
// 状态
const STATUS_SUCCESS = 1;
const STATUS_FAILED = 2;
const STATUS_PROCESSING = 3;
/**
* 获取有效缓存
*/
public static function getCache(int $type, int $refId): ?array
{
$row = self::where('type', $type)
->where('ref_id', $refId)
->where('status', self::STATUS_SUCCESS)
->where('expire_time', '>', time())
->order('id', 'desc')
->findOrEmpty();
if ($row->isEmpty()) {
return null;
}
return $row->toArray();
}
}