GetConfig godoc @Tags SysConfig @Summary 获取系统设置(部分不敏感的) @Description 敏感信息不返回,包括各种key密钥 @Accept json @Produce json @Success 200 {object} vo.SysConfigVO @Router /sysConfig/get [post]
(c echo.Context)
| 29 | // @Success 200 {object} vo.SysConfigVO |
| 30 | // @Router /sysConfig/get [post] |
| 31 | func (s SysConfigHandler) GetConfig(c echo.Context) error { |
| 32 | var ( |
| 33 | config db.SysConfig |
| 34 | result vo.SysConfigVO |
| 35 | ) |
| 36 | |
| 37 | if err := s.base.db.First(&config).Error; errors.Is(err, gorm.ErrRecordNotFound) { |
| 38 | return SuccessResp(c, h{}) |
| 39 | } |
| 40 | err := json.Unmarshal([]byte(config.Content), &result) |
| 41 | if err != nil { |
| 42 | return FailRespWithMsg(c, Fail, "读取系统配置异常") |
| 43 | } |
| 44 | result.Version = s.base.cfg.Version |
| 45 | result.CommitId = s.base.cfg.CommitId |
| 46 | |
| 47 | suffix := result.S3.ThumbnailSuffix |
| 48 | result.S3 = vo.S3VO{ |
| 49 | ThumbnailSuffix: suffix, |
| 50 | } |
| 51 | return SuccessResp(c, result) |
| 52 | } |
| 53 | |
| 54 | // GetFullConfig godoc |
| 55 | // |
nothing calls this directly
no test coverage detected