diff --git a/config/go-fly.sql b/config/go-fly.sql index 01e06f9..7b25d38 100644 --- a/config/go-fly.sql +++ b/config/go-fly.sql @@ -109,7 +109,7 @@ CREATE TABLE `config` ( INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '是否开启Server酱微信提醒', 'NoticeServerJiang', 'false')| INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, 'Server酱API', 'ServerJiangAPI', '')| INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '微信小程序Token', 'WeixinToken', '')| -INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '首页跳转语言', 'JumpLang', 'cn')| +INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '当前小程序审核状态', 'MiniAppAudit', 'yes')| DROP TABLE IF EXISTS `about`| CREATE TABLE `about` ( diff --git a/controller/setting.go b/controller/setting.go index 1dcfc6d..1797146 100644 --- a/controller/setting.go +++ b/controller/setting.go @@ -13,6 +13,15 @@ func GetConfigs(c *gin.Context) { "result": configs, }) } +func GetConfig(c *gin.Context) { + key := c.Query("key") + config := models.FindConfig(key) + c.JSON(200, gin.H{ + "code": 200, + "msg": "ok", + "result": config, + }) +} func PostConfig(c *gin.Context) { key := c.PostForm("key") value := c.PostForm("value") diff --git a/router/api.go b/router/api.go index ae0fe57..134876e 100644 --- a/router/api.go +++ b/router/api.go @@ -70,6 +70,7 @@ func InitApiRouter(engine *gin.Engine) { engine.GET("/ipblacks_all", middleware.JwtApiMiddleware, controller.GetIpblacks) engine.GET("/configs", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetConfigs) engine.POST("/config", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostConfig) + engine.GET("/config", controller.GetConfig) //微信接口 engine.GET("/micro_program", controller.GetCheckWeixinSign) }