service/app/mix/controller/app_config_op.go

39 lines
1015 B
Go
Raw Normal View History

2024-02-01 09:52:45 +08:00
package controller
import (
"service/api/errcode"
appconfigproto "service/api/proto/app_config/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"github.com/gin-gonic/gin"
)
func OpUpdateAppConfig(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*appconfigproto.OpUpdateReq)
ec := service.DefaultService.OpUpdateAppConfig(ctx, req)
if ec != errcode.ErrCodeAppConfigSrvOk {
logger.Error("OpUpdateAppConfig fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}
func OpGetAppConfigListByKey(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*appconfigproto.OpListByKeyReq)
appconfig, ec := service.DefaultService.OpGetAppConfigListByKey(ctx, req)
if ec != errcode.ErrCodeAppConfigSrvOk {
logger.Error("OpGetAppConfigListByKey fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &appconfigproto.OpListByKeyData{
AppConfig: appconfig,
}
ReplyOk(ctx, data)
}