Files
platforms/backend/api/README.md

20 lines
965 B
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.
# Platform API
平台总后台 API 采用 BSM-SDK Core 分层和运行方式。
启动前请设置运行配置JWT 密钥必须为 16、24 或 32 个字符。
```powershell
$env:BSM_RuntimeMode="dev"
$env:BSM_Prefix="$(Get-Location)/etc"
$env:BSM_JwtSecretKey="local-dev-key-16"
$env:HEQI_PLATFORM_ROOT_PASSWORD="请设置不少于12位的root初始密码"
go run ./cmd/main/main.go
```
应用启动时会在事务内幂等创建平台 `root` 账号。账号名固定为 `root`;优先使用 `HEQI_PLATFORM_ROOT_PASSWORD`,未设置时仅使用开发环境默认值。已登录账户可通过 `PUT /heqi/v1/auth/password` 修改密码。
匿名接口为 `POST /heqi/v1/auth/login`;其余平台接口经 `middleware.JwtAuth(true)` 保护。请求头 `Authorization` 直接传递 JWT 原始值,不使用 `Bearer` 前缀。
UUID V7 主键、模型中文注释与表结构以 `internal/models` 为准;应用启动时由 GORM 自动同步模型结构。