Files
ai-web/README.md
jiangdong.cheng aa16c9f8c2
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
init
2026-02-11 17:28:36 +08:00

128 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AIWebLaravel + MySQL
AI 聚合网站 MVP包含以下模块
- AI 工具/产品导航(`/tools`
- AI 模型推荐(`/models`
- AI 资讯文章(`/news`
- AI 教程(`/guides`
并内置:
- SEO 基础能力(`/sitemap.xml``/robots.txt`、结构化数据、canonical
- 后台录入与发布流程(`/admin`
- 后台登录安全(验证码 + 登录限流防爆破)
- 模型推荐规则打分(效果 50% + 价格 30% + 速度 20%
- MySQL 全文检索与可切换缓存驱动
## 技术栈
- PHP 8.2+
- Laravel 12
- MySQL 8+
- Redis可选当前默认 `database` 缓存)
## 当前已验证环境
- PHP`D:/phpstudy_pro/Extensions/php/php8.2.9nts/php.exe`
- DB Host`zhongjy001.synology.me`
- DB Port`3315`
- DB Name`fatemaster`
- DB User`root`
## 安装步骤
1. 安装依赖
```powershell
cd "D:/project/aiweb"
"D:/phpstudy_pro/Extensions/php/php8.2.9nts/php.exe" "composer.phar" install
```
2. 初始化环境文件与应用密钥
```powershell
copy .env.example .env
"D:/phpstudy_pro/Extensions/php/php8.2.9nts/php.exe" artisan key:generate
```
3. 迁移并初始化数据
```powershell
"D:/phpstudy_pro/Extensions/php/php8.2.9nts/php.exe" artisan migrate --seed --force
```
4. 启动服务
```powershell
"D:/phpstudy_pro/Extensions/php/php8.2.9nts/php.exe" artisan serve
```
访问:`http://127.0.0.1:8000`
## 后台访问(已更新)
- 登录页:`/admin/login`
- 登录后入口:`/admin`
- 使用 `.env` 中账号密码:
- `APP_ADMIN_USER`
- `APP_ADMIN_PASSWORD`
- 安全机制:
- 图形验证码(单次验证后失效)
- 登录失败限流(账号 + IP 维度)
## 缓存与 Redis 说明
当前 `.env` 默认:
- `CACHE_STORE=database`
- `SESSION_DRIVER=file`
这样做是为了在本机未启动 Redis 时也能稳定运行。
若你后续启用 Redis可切回
- `CACHE_STORE=redis`
- `REDIS_CLIENT=predis`(或安装 phpredis 扩展后改回 `phpredis`
## SEO 与内容策略
- 内容状态:`draft/review/published/stale/archived`
- 失效内容保留页面并提示“信息可能过期”
- 高风险关键词(医疗/法律/投资)自动显示免责声明
- 资讯页支持来源标记和原文跳转
## 主要目录
- `app/Http/Controllers/Site`:前台控制器
- `app/Http/Controllers/Admin`:后台控制器
- `app/Http/Middleware`:后台鉴权中间件
- `app/Http/Requests/Admin`:后台校验
- `app/Models`:领域模型
- `app/Services`:推荐打分/变更日志
- `database/migrations`:表结构
- `resources/views/public`:前台页面
- `resources/views/admin`:后台页面
## 已实现数据表
- `categories`
- `tags`
- `sources`
- `tools`
- `ai_models`
- `articles`
- `guides`
- `entity_tag_maps`
- `change_logs`
## 测试
执行:
```powershell
"D:/phpstudy_pro/Extensions/php/php8.2.9nts/php.exe" artisan test
```
当前结果:`4 passed`