1234567891011121314151617181920212223242526272829303132 |
- package api
- import (
- "crazy-fox-backend-api/model"
- "crazy-fox-backend-api/service"
- "crazy-fox-backend-api/utils"
- "crazy-fox-backend-api/utils/answer"
- "github.com/gin-gonic/gin"
- )
- // pushApi 推送配置
- type pushApi struct{}
- func (Api *pushApi) Config(c *gin.Context) {
- pushShowConfig := model.PushShowConfig{
- List: service.Push.PushConfig(),
- LangList: service.Push.PushLangConfig(),
- }
- answer.OkWithDetailed(pushShowConfig, "获取成功", c)
- }
- func (Api *pushApi) SaveContent(c *gin.Context) {
- var pushConf model.PushRepoConfig
- if err := c.ShouldBindWith(&pushConf, utils.HandleBinding(c.Request.Method, c.ContentType())); err != nil {
- answer.FailWithMessage("请求参数结构体接收失败", err, c)
- }
- if err := service.Push.SaveConfig(pushConf); err != nil {
- answer.FailWithMessage("保存失败", err, c)
- }
- answer.OkWithDetailed(pushConf, "保存成功", c)
- }
|