获取当前生效的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:
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user