feat-IRONFANS-235-Robin #804

Merged
chenhao merged 5 commits from feat-IRONFANS-235-Robin into main 2024-11-18 16:44:47 +08:00
5 changed files with 33 additions and 0 deletions

View File

@ -69,6 +69,7 @@ const (
SmsSplitRatioKey = "sms_split_ratio"
RavenIQTestEmailConfigKey = "Raven_IQ_test_email_config"
OfficialEmailKey = "official_email"
InstallInfoKey = "install_info"
IsIosInstallButtonVisibleKey = "is_ios_install_button_visible"
)

7
apollostruct/install.go Normal file
View File

@ -0,0 +1,7 @@
package apollostruct
type InstallCfg struct {
IsIosInstallButtonVisible int64 `json:"is_ios_install_button_visible"`
AndroidUrl string `json:"android_url"`
IosUrl string `json:"ios_url"`
}

View File

@ -92,3 +92,14 @@ func OpGetIsIosInstallButtonVisible(ctx *gin.Context) {
ReplyOk(ctx, isVisible)
}
func OpGetInstallInfo(ctx *gin.Context) {
cfg, ec := service.DefaultConfigService.OpGetInstallInfo(ctx)
if ec != errcode.ErrCodeOk {
logger.Error("OpGetIsIosInstallButtonVisible fail, ec: %v", ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, cfg)
}

View File

@ -308,6 +308,7 @@ func Init(r *gin.Engine) {
// ios安装按钮
apiAppGroup := r.Group("/api/app", PrepareToC())
apiAppGroup.POST("install_info", middleware.JSONParamValidator(base.BaseRequest{}), OpGetInstallInfo)
apiAppGroup.POST("is_ios_install_button_visible", middleware.JSONParamValidator(base.BaseRequest{}), OpGetIsIosInstallButtonVisible)
// =============================== 以下是服务,只允许内网调用 ===============================

View File

@ -230,3 +230,16 @@ func (s *ConfigService) OpGetIsIosInstallButtonVisible(ctx *gin.Context) (isVisi
return
}
func (s *ConfigService) OpGetInstallInfo(ctx *gin.Context) (cfg *apollostruct.InstallCfg, ec errcode.ErrCode) {
ec = errcode.ErrCodeOk
cfg = &apollostruct.InstallCfg{}
err := apollo.GetJson(consts.InstallInfoKey, cfg, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
return nil, errcode.ErrCodeApolloReadFail
}
return
}