Merge pull request 'by Robin at 20231228; fix' (#14) from feat-20231228-003-Robin into test

Reviewed-on: #14
This commit is contained in:
chenhao 2023-12-28 18:38:07 +08:00
commit 65602b8275
4 changed files with 46 additions and 2 deletions

View File

@ -31,6 +31,8 @@ const (
TagNumKey = "tag_num" TagNumKey = "tag_num"
PlatformNumKey = "platform_num" PlatformNumKey = "platform_num"
SupportWxIdNumKey = "support_wx_id_num" SupportWxIdNumKey = "support_wx_id_num"
ImageIdForUploadFail = "image_id_for_upload_fail"
VideoIdForUploadFail = "video_id_for_upload_fail"
) )
// del_flag // del_flag
@ -58,9 +60,9 @@ const (
RedisStreamerPrefix = "streamer:" //streamer服务前缀 RedisStreamerPrefix = "streamer:" //streamer服务前缀
) )
//const PackageRootPath = "/Users/PC/Desktop/wishpal-ironfan" const PackageRootPath = "C:/Users/PC/Desktop/wishpal_ironfan_service/service"
const PackageRootPath = "/app/wishpal-ironfan" //const PackageRootPath = "/app/wishpal-ironfan"
const MainConfigPath = PackageRootPath + "/etc/mix/mix-test.yaml" const MainConfigPath = PackageRootPath + "/etc/mix/mix-test.yaml"

View File

@ -59,3 +59,14 @@ func OpIsThereANewVersionAvailable(ctx *gin.Context) {
ReplyOk(ctx, data) ReplyOk(ctx, data)
} }
func OpGetUploadMediaFailConfigList(ctx *gin.Context) {
config, ec := service.DefaultConfigService.OpGetUploadMediaFailConfigList(ctx)
if ec != errcode.ErrCodeOk {
logger.Error("OpGetUploadMediaFailConfigList fail, ec: %v", ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, config)
}

View File

@ -160,6 +160,10 @@ func Init(r *gin.Engine) {
apiVersion := r.Group("/api/version", PrepareToC()) apiVersion := r.Group("/api/version", PrepareToC())
apiVersion.POST("is_there_a_new_version_available", middleware.JSONParamValidator(base.BaseRequest{}), OpIsThereANewVersionAvailable) apiVersion.POST("is_there_a_new_version_available", middleware.JSONParamValidator(base.BaseRequest{}), OpIsThereANewVersionAvailable)
// 上传媒体失败配置
apiUploadMediaFailConfig := r.Group("/api/upload_media_fail_config", PrepareToC())
apiUploadMediaFailConfig.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), OpGetUploadMediaFailConfigList)
// =============================== 以下是服务,只允许内网调用 =============================== // =============================== 以下是服务,只允许内网调用 ===============================
// op相关直接调用服务不调用gateway // op相关直接调用服务不调用gateway
@ -344,6 +348,10 @@ func Init(r *gin.Engine) {
opSupportWxIdGroup := r.Group("/op/support_wx_id", PrepareOp()) opSupportWxIdGroup := r.Group("/op/support_wx_id", PrepareOp())
opSupportWxIdGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetSupportWxIdList) opSupportWxIdGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetSupportWxIdList)
// 上传媒体失败配置
opUploadMediaFailConfig := r.Group("/op/upload_media_fail_config", PrepareToC())
opUploadMediaFailConfig.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), OpGetUploadMediaFailConfigList)
// 账号相关 // 账号相关
//accountGroup := r.Group("/account") //accountGroup := r.Group("/account")

View File

@ -146,3 +146,26 @@ func (s *ConfigService) OpIsThereANewVersionAvailable(ctx *gin.Context, baseRequ
} }
return return
} }
func (s *ConfigService) OpGetUploadMediaFailConfigList(ctx *gin.Context) (uploadMediaFailConfigMap map[string]int64, ec errcode.ErrCode) {
ec = errcode.ErrCodeOk
uploadMediaFailConfigMap = make(map[string]int64)
imageIdForUploadFail, err := apollo.GetIntValue(consts.ImageIdForUploadFail, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
return nil, errcode.ErrCodeApolloReadFail
}
videoIdForUploadFail, err := apollo.GetIntValue(consts.VideoIdForUploadFail, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
return nil, errcode.ErrCodeApolloReadFail
}
uploadMediaFailConfigMap["image_id_for_upload_fail"] = int64(imageIdForUploadFail)
uploadMediaFailConfigMap["video_id_for_upload_fail"] = int64(videoIdForUploadFail)
return
}