增加单项配置获取

pull/23/head
陶士涵 4 years ago
parent 71297ddc6c
commit 701a5488d7

@ -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` (

@ -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")

@ -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)
}

Loading…
Cancel
Save