소스 검색

feat(config): add WECHAT_MP credentials for mini wechat login.

Co-authored-by: Cursor <cursoragent@cursor.com>
wuzilong 1 개월 전
부모
커밋
7e7f9226cf
2개의 변경된 파일과 9개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      backend/.env.example
  2. 5 0
      backend/app/core/config.py

+ 4 - 0
backend/.env.example

@@ -76,3 +76,7 @@ DEFAULT_TENANT_NO=shanxia2.0
 # WXPAY_NOTIFY_URL=https://www.chengyantek.cn/api/payment/notify
 # WXPAY_NOTIFY_URL=https://www.chengyantek.cn/api/payment/notify
 # WXPAY_REFUND_NOTIFY_URL=https://www.chengyantek.cn/api/payment/refund-notify
 # WXPAY_REFUND_NOTIFY_URL=https://www.chengyantek.cn/api/payment/refund-notify
 # WXPAY_SANDBOX=false
 # WXPAY_SANDBOX=false
+
+# 门户小程序登录(AppID 与 miniprogram/manifest.json mp-weixin.appid 一致)
+# WECHAT_MP_APPID=wx7db1ddb2a90c9425
+# WECHAT_MP_SECRET=

+ 5 - 0
backend/app/core/config.py

@@ -115,6 +115,10 @@ class Settings(BaseSettings):
     # 微信小程序配置
     # 微信小程序配置
     WXPAY_SECRET: str = ""  # 小程序Secret
     WXPAY_SECRET: str = ""  # 小程序Secret
 
 
+    # 门户微信小程序登录(与 WXPAY_* 支付凭证分离)
+    WECHAT_MP_APPID: str = ""  # 门户小程序 AppID,须与 miniprogram manifest 一致
+    WECHAT_MP_SECRET: str = ""  # 门户小程序 AppSecret(仅后端)
+
     # 微信模板消息ID配置
     # 微信模板消息ID配置
     WX_TEMPLATE_ORDER_STATUS: str = ""  # 订单状态通知模板ID
     WX_TEMPLATE_ORDER_STATUS: str = ""  # 订单状态通知模板ID
     WX_TEMPLATE_DELIVERY_NOTICE: str = ""  # 配送通知模板ID
     WX_TEMPLATE_DELIVERY_NOTICE: str = ""  # 配送通知模板ID
@@ -159,6 +163,7 @@ class Settings(BaseSettings):
         "/openapi.json,"
         "/openapi.json,"
         "/api/web/auth/login-rsa-public-key,"
         "/api/web/auth/login-rsa-public-key,"
         "/api/web/auth/login,"
         "/api/web/auth/login,"
+        "/api/mini/auth/wechat-login,"
         "/api/web/auth/refresh-token,"
         "/api/web/auth/refresh-token,"
         "/api/web/auth/mp-webview-exchange,"
         "/api/web/auth/mp-webview-exchange,"
         "/api/web/admin/attachment/upload,"
         "/api/web/admin/attachment/upload,"