request->get('type/s', ''); $params = $this->request->get(); $result = AiAnalysisRequestService::analyze($type, $params, $this->userId); return $this->respondAnalysis($result); } /** * 赛事AI预测 */ public function matchPredict() { $result = AiAnalysisRequestService::analyzeMatchFull( $this->request->get('match_id/d'), $this->userId ); return $this->respondAnalysis($result); } /** * 赛事AI预测 - 分段请求 */ public function matchPredictSection() { $result = AiAnalysisRequestService::analyzeMatchSection( $this->request->get('match_id/d'), $this->request->get('section/s', ''), $this->userId ); return $this->respondAnalysis($result); } /** * 资讯AI分析 */ public function articleAnalysis() { $result = AiAnalysisRequestService::analyzeArticle( $this->request->get('article_id/d'), $this->userId ); return $this->respondAnalysis($result); } /** * 用户可信度分析 */ public function userCredibility() { $result = AiAnalysisRequestService::analyzeUserCredibility( $this->request->get('user_id/d'), $this->userId ); return $this->respondAnalysis($result); } /** * 彩票概率分析 */ public function lotteryAnalysis() { $params = $this->request->get(); if (empty($params['code']) && !empty($params['type'])) { $params['code'] = $params['type']; } $result = AiAnalysisRequestService::analyze('lottery', $params, $this->userId); return $this->respondAnalysis($result); } /** * 查询比赛解锁状态 */ public function checkUnlock() { $matchId = $this->request->get('match_id/d'); if (empty($matchId)) { return $this->fail('参数缺失'); } $unlocked = $this->userId ? AiUnlock::isUnlocked($this->userId, $matchId) : false; $remain = $this->userId ? AiUnlock::getRemainCount($this->userId) : 0; return $this->data([ 'unlocked' => $unlocked, 'remain_count' => $remain, ]); } private function respondAnalysis(array $result) { if (empty($result['success'])) { return $this->fail($result['error'] ?? 'AI分析失败', [ 'remain_count' => $result['remain_count'] ?? null, ]); } unset($result['success'], $result['error'], $result['code']); return $this->data($result); } }