获取当前生效的appid
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m46s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m46s
This commit is contained in:
@@ -225,6 +225,7 @@ default:
|
||||
- **分佣验证指引**:对代理分佣的冻结、解冻、提现校验流程进行了结构化说明与流程图,详见 [分佣逻辑正确与否验证](docs/优化说明/分佣逻辑正确与否验证.md)
|
||||
- **对象存储**:S3 兼容的对象存储服务集成(联通云 OSS),支持预签名 URL 上传、文件下载、临时文件处理;用于 ICCID 批量导入、数据导出等场景;详见 [使用指南](docs/object-storage/使用指南.md) 和 [前端接入指南](docs/object-storage/前端接入指南.md)
|
||||
- **微信集成**:完整的微信公众号 OAuth 认证和微信支付功能(JSAPI + H5),使用 PowerWeChat v3 SDK;支持个人客户微信授权登录、账号绑定、微信内支付和浏览器 H5 支付;支付回调自动验证签名和幂等性处理;详见 [使用指南](docs/wechat-integration/使用指南.md) 和 [API 文档](docs/wechat-integration/API文档.md)
|
||||
- **C 端微信 AppID 获取接口**:新增免登录接口 `GET /api/c/v1/wechat/appid`,仅返回当前生效微信配置中的公众号 `app_id`,供前端在拉起微信授权或初始化微信能力前动态获取;详见 [功能总结](docs/client-wechat-appid/功能总结.md)
|
||||
- **订单超时自动取消**:待支付订单(微信/支付宝)30 分钟超时自动取消,支持钱包余额解冻;使用 Asynq Scheduler 每分钟扫描,取代原有 time.Ticker 实现;同时将告警检查和数据清理迁移至 Asynq Scheduler 统一调度;详见 [功能总结](docs/order-expiration/功能总结.md)
|
||||
|
||||
### 导出任务接口示例
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||||
wechatConfigSvc "github.com/break/junhong_cmp_fiber/internal/service/wechat_config"
|
||||
@@ -76,3 +78,19 @@ func (h *ClientWechatHandler) GetJSSDKConfig(c *fiber.Ctx) error {
|
||||
Signature: jssdkConfig.Signature,
|
||||
})
|
||||
}
|
||||
|
||||
// GetAppID 获取当前生效的公众号 AppID
|
||||
// GET /api/c/v1/wechat/appid
|
||||
func (h *ClientWechatHandler) GetAppID(c *fiber.Ctx) error {
|
||||
wechatConfig, err := h.wechatConfigService.GetActiveConfig(c.UserContext())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if wechatConfig == nil || strings.TrimSpace(wechatConfig.OaAppID) == "" {
|
||||
return errors.New(errors.CodeWechatConfigUnavailable)
|
||||
}
|
||||
|
||||
return response.Success(c, &dto.WechatAppIDResponse{
|
||||
AppID: wechatConfig.OaAppID,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -68,3 +68,8 @@ type JSSDKConfigResponse struct {
|
||||
NonceStr string `json:"nonce_str" description:"随机字符串"`
|
||||
Signature string `json:"signature" description:"签名(SHA1)"`
|
||||
}
|
||||
|
||||
// WechatAppIDResponse 微信 AppID 响应
|
||||
type WechatAppIDResponse struct {
|
||||
AppID string `json:"app_id" description:"当前生效的公众号 AppID"`
|
||||
}
|
||||
|
||||
@@ -22,6 +22,15 @@ func RegisterPersonalCustomerRoutes(router fiber.Router, doc *openapi.Generator,
|
||||
authBasePath := "/auth"
|
||||
|
||||
// === 公开路由(无需认证)===
|
||||
Register(router, doc, basePath, "GET", "/wechat/appid", handlers.ClientWechat.GetAppID, RouteSpec{
|
||||
Summary: "获取当前生效的公众号 AppID",
|
||||
Description: "用于 C 端免登录场景获取当前生效微信配置中的公众号 AppID,响应仅返回 app_id 字段",
|
||||
Tags: []string{"个人客户 - 微信"},
|
||||
Auth: false,
|
||||
Input: nil,
|
||||
Output: &dto.WechatAppIDResponse{},
|
||||
})
|
||||
|
||||
Register(router, doc, basePath, "GET", "/wechat/jssdk-config", handlers.ClientWechat.GetJSSDKConfig, RouteSpec{
|
||||
Summary: "获取微信 JSSDK 签名配置",
|
||||
Description: "前端调用 wx.config() 初始化微信 JS-SDK 时所需的签名参数,需传入当前页面完整 URL",
|
||||
|
||||
Reference in New Issue
Block a user