diff --git a/api/consts/consts.go b/api/consts/consts.go index d3e850fb..3aedcb47 100644 --- a/api/consts/consts.go +++ b/api/consts/consts.go @@ -70,6 +70,7 @@ const ( OfficialEmailKey = "official_email" SmsSplitRatioKey = "sms_split_ratio" NotifBannerInfoKey = "notif_banner_info" + IsIosInstallButtonVisibleKey = "is_ios_install_button_visible" ) // del_flag diff --git a/app/mix/controller/config_op.go b/app/mix/controller/config_op.go index 92d7a7ab..b265a318 100644 --- a/app/mix/controller/config_op.go +++ b/app/mix/controller/config_op.go @@ -92,3 +92,14 @@ func OpGetBannerInfo(ctx *gin.Context) { ReplyOk(ctx, list) } + +func OpGetIsIosInstallButtonVisible(ctx *gin.Context) { + isVisible, ec := service.DefaultConfigService.OpGetIsIosInstallButtonVisible(ctx) + if ec != errcode.ErrCodeOk { + logger.Error("OpGetIsIosInstallButtonVisible fail, ec: %v", ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + ReplyOk(ctx, isVisible) +} diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index c69db15b..6f876a2a 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -316,6 +316,10 @@ func Init(r *gin.Engine) { apiRavenIQTestVisitGroup.POST("create", middleware.JSONParamValidator(Raven_IQ_test_visitproto.ApiCreateReq{}), ApiCreateRavenIQTestVisit) apiRavenIQTestVisitGroup.POST("count", middleware.JSONParamValidator(Raven_IQ_test_visitproto.ApiCountReq{}), ApiGetRavenIQTestVisitCount) + // ios安装按钮 + apiAppGroup := r.Group("/api/app", PrepareToC()) + apiAppGroup.POST("is_ios_install_button_visible", middleware.JSONParamValidator(base.BaseRequest{}), OpGetIsIosInstallButtonVisible) + // =============================== 以下是服务,只允许内网调用 =============================== // op相关,直接调用服务,不调用gateway diff --git a/app/mix/service/configservice.go b/app/mix/service/configservice.go index 7629a136..a88f84c2 100644 --- a/app/mix/service/configservice.go +++ b/app/mix/service/configservice.go @@ -231,3 +231,18 @@ func (s *ConfigService) OpGetBannerInfo(ctx *gin.Context) (list []string, ec err return } + +func (s *ConfigService) OpGetIsIosInstallButtonVisible(ctx *gin.Context) (isVisible int64, ec errcode.ErrCode) { + ec = errcode.ErrCodeOk + + isIosInstallButtonVisible, err := apollo.GetIntValue(consts.IsIosInstallButtonVisibleKey, apollo.ApolloOpts().SetNamespace("application")) + if err != nil { + logger.Error("Apollo read failed : %v", err) + ec = errcode.ErrCodeApolloReadFail + return + } + + isVisible = int64(isIosInstallButtonVisible) + + return +}