From 701a5488d709c8787fc9c6084d0e2f8e22e8cca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E5=A3=AB=E6=B6=B5?= <630892807@qq.com> Date: Sat, 24 Oct 2020 23:03:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=95=E9=A1=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/go-fly.sql | 2 +- controller/setting.go | 9 +++++++++ router/api.go | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) 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) }