feat: 短信调试日志、Tawk 客服、手机号校验放宽与 Docker 文档

API
- 短信发码/验码/创蓝全链路结构化日志(手机号脱敏)
- 新增 SMS_DEBUG_LOG_CODE,联调时可输出验证码与 sessionId(对应创蓝批次号)
- 注册成功、短信找回密码成功写入审计相关日志
- 放宽手机号归一化:移除区号白名单与 10~15 位长度限制

Player
- 公告走马灯滚动周期调整为 35 秒
- 在线客服接入 Tawk.to(tawk.html),登录用户透传昵称/头像/ID
- 三语补充 support.connecting 文案

部署与文档
- docker-compose 与 .env.docker.example 增加 SMS_DEBUG_LOG_CODE
- 新增 docs/短信调试与日志说明.md、docs/docker 镜像构建导出脚本与说明
- Docker 部署指南补充镜像构建文档链接
- .gitignore 忽略 thebet365-images.tar 与 docker-build.log

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-12 14:08:00 +08:00
parent ff89c31b51
commit cb9a1e8708
21 changed files with 870 additions and 34 deletions

View File

@@ -0,0 +1,95 @@
#!/usr/bin/env bash
# 构建 api / player / admin 生产镜像并导出为 tar
# 用法:
# ./docs/docker/build-and-export-images.sh
# ./build-and-export-images.sh --use-cache
# ./build-and-export-images.sh --export-only
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$ROOT"
COMPOSE_FILE="docker-compose.prod.yml"
ENV_FILE=".env.docker"
OUTPUT="thebet365-images.tar"
SERVICES=(api player admin)
NO_CACHE=1
EXPORT_ONLY=0
usage() {
cat <<'EOF'
用法: docs/docker/build-and-export-images.sh [选项]
选项:
--use-cache 构建时使用 Docker 缓存(默认 --no-cache
--export-only 跳过构建,仅导出已有 latest 镜像
--output PATH 导出文件路径(默认项目根目录 thebet365-images.tar
-h, --help 显示帮助
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--use-cache) NO_CACHE=0; shift ;;
--export-only) EXPORT_ONLY=1; shift ;;
--output)
OUTPUT="${2:?缺少 --output 参数值}"
shift 2
;;
-h|--help) usage; exit 0 ;;
*) echo "未知参数: $1" >&2; usage; exit 1 ;;
esac
done
if [[ ! -f "$COMPOSE_FILE" ]]; then
echo "错误: 未找到 $COMPOSE_FILE(目录: $ROOT" >&2
exit 1
fi
if [[ ! -f "$ENV_FILE" ]]; then
if [[ -f ".env.docker.example" ]]; then
echo "警告: 未找到 $ENV_FILE,将使用 .env.docker.example生产部署请复制为 .env.docker 并修改密钥)"
ENV_FILE=".env.docker.example"
else
echo "错误: 未找到 $ENV_FILE 或 .env.docker.example" >&2
exit 1
fi
fi
if [[ "$EXPORT_ONLY" -eq 0 ]]; then
echo "==> 构建镜像: ${SERVICES[*]}"
BUILD_ARGS=(compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" build)
if [[ "$NO_CACHE" -eq 1 ]]; then
BUILD_ARGS+=(--no-cache)
fi
BUILD_ARGS+=("${SERVICES[@]}")
docker "${BUILD_ARGS[@]}"
fi
OUTPUT_PATH="$OUTPUT"
if [[ "$OUTPUT" != /* ]] && [[ "$OUTPUT" != [A-Za-z]:* ]]; then
OUTPUT_PATH="$ROOT/$OUTPUT"
fi
echo "==> 导出镜像 -> $OUTPUT_PATH"
docker save \
thebet365-api:latest \
thebet365-player:latest \
thebet365-admin:latest \
-o "$OUTPUT_PATH"
if command -v du >/dev/null 2>&1; then
SIZE="$(du -h "$OUTPUT_PATH" | awk '{print $1}')"
echo "完成: $OUTPUT_PATH ($SIZE)"
else
echo "完成: $OUTPUT_PATH"
fi
cat <<'EOF'
服务器加载:
docker load -i thebet365-images.tar
docker compose -f docker-compose.prod.yml --env-file .env.docker up -d
EOF