From 1abe2c1cfb515ca205d87b2fac46ddcea5ef0ec5 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 1 Nov 2024 16:09:59 +0800 Subject: [PATCH] by Robin at 20241101 --- api/consts/consts.go | 1 + app/mix/controller/config_op.go | 11 +++++++++++ app/mix/controller/init.go | 4 ++++ app/mix/service/configservice.go | 15 +++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/api/consts/consts.go b/api/consts/consts.go index a2edbf59..54166827 100644 --- a/api/consts/consts.go +++ b/api/consts/consts.go @@ -69,6 +69,7 @@ const ( SmsSplitRatioKey = "sms_split_ratio" RavenIQTestEmailConfigKey = "Raven_IQ_test_email_config" OfficialEmailKey = "official_email" + 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 6ca3a051..07179d43 100644 --- a/app/mix/controller/config_op.go +++ b/app/mix/controller/config_op.go @@ -81,3 +81,14 @@ func OpGetIsMomentImageEncryptEnabled(ctx *gin.Context) { ReplyOk(ctx, isEnabled) } + +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 d065c994..a473a6d3 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -306,6 +306,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 415a5a62..2e0910cb 100644 --- a/app/mix/service/configservice.go +++ b/app/mix/service/configservice.go @@ -215,3 +215,18 @@ func (s *ConfigService) OpGetIsMomentImageEncryptEnabled(ctx *gin.Context) (isEn 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 +}