From 42be0f828f091c7185ae059558315a4768e8be14 Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 19 Jun 2026 05:53:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(cps):=20=E5=8A=A0=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E7=BD=91=E9=A1=B5=E6=8E=88=E6=9D=83=E5=9F=9F=E5=90=8D=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E6=96=87=E4=BB=B6=E7=AB=AF=E7=82=B9(MP=5Fverify)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit coupon.shaguabijia.com 全反代 app-server,微信请求该域名根目录 MP_verify_xxx.txt 验证域名归属(放根目录)。为微信网页授权(落地页拿 openid)接入做准备。 Co-Authored-By: Claude Opus 4.8 --- app/api/v1/cps_redirect.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/api/v1/cps_redirect.py b/app/api/v1/cps_redirect.py index 9be15e6..49a061d 100644 --- a/app/api/v1/cps_redirect.py +++ b/app/api/v1/cps_redirect.py @@ -10,7 +10,7 @@ import html import json from fastapi import APIRouter, Depends, Request -from fastapi.responses import HTMLResponse, RedirectResponse +from fastapi.responses import HTMLResponse, PlainTextResponse, RedirectResponse from sqlalchemy.orm import Session from app.core import media @@ -45,6 +45,14 @@ def _record(db: Session, link: CpsLink, request: Request, event_type: str) -> No pass # 记点击失败不阻断 +@router.get("/MP_verify_F7wnRQ7xPbhVOWC8.txt", include_in_schema=False) +def wx_mp_domain_verify() -> PlainTextResponse: + """微信「网页授权域名」归属校验文件。coupon.shaguabijia.com 全反代 app-server, + 微信请求 coupon.shaguabijia.com/MP_verify_xxx.txt 验证域名归属;内容=文件名核心串。 + 放域名根目录(本端点即根路径),为微信网页授权(拿 openid)接入做准备。""" + return PlainTextResponse("F7wnRQ7xPbhVOWC8") + + @router.get("/c/{code}", summary="群发短链落地(记点击 + 跳转/淘宝落地页)") def cps_landing(code: str, request: Request, db: Session = Depends(get_db)): link = cps_link_repo.get_by_code(db, code)