获取当前生效的appid
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m46s

This commit is contained in:
2026-04-30 10:52:33 +08:00
parent 66e12e9629
commit 248ed55f4e
4 changed files with 33 additions and 0 deletions

View File

@@ -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,
})
}