service/app/mix/controller/config_op.go

95 lines
2.3 KiB
Go

package controller
import (
"service/api/base"
"service/api/errcode"
configproto "service/api/proto/config/proto"
"service/app/mix/service"
"service/library/logger"
"github.com/gin-gonic/gin"
)
func OpGetStreamerTagList(ctx *gin.Context) {
config, ec := service.DefaultConfigService.OpGetStreamerTagList(ctx)
if ec != errcode.ErrCodeOk {
logger.Error("OpGetStreamerTagList fail, ec: %v", ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, config)
}
func OpGetPlatformList(ctx *gin.Context) {
config, ec := service.DefaultConfigService.OpGetPlatformList(ctx)
if ec != errcode.ErrCodeOk {
logger.Error("OpGetPlatformList fail, ec: %v", ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, config)
}
func OpGetSupportWxIdList(ctx *gin.Context) {
config, ec := service.DefaultConfigService.OpGetSupportWxIdList(ctx)
if ec != errcode.ErrCodeOk {
logger.Error("OpGetSupportWxIdList fail, ec: %v", ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, config)
}
func OpIsThereANewVersionAvailable(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*base.BaseRequest)
result, version, ec := service.DefaultConfigService.OpIsThereANewVersionAvailableV2(ctx, req)
if ec != errcode.ErrCodeOk {
logger.Error("OpIsThereANewVersionAvailable fail, ec: %v", ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &configproto.VersionData{
Result: result,
Version: version,
}
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)
}
func OpGetIsMomentImageEncryptEnabled(ctx *gin.Context) {
isEnabled, ec := service.DefaultConfigService.OpGetIsMomentImageEncryptEnabled(ctx)
if ec != errcode.ErrCodeOk {
logger.Error("OpGetIsMomentImageEncryptEnabled fail, ec: %v", ec)
ReplyErrCodeMsg(ctx, ec)
return
}
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)
}