cms
This commit is contained in:
73
controllers/cms.go
Normal file
73
controllers/cms.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
type CmsController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// @Title 新增配置
|
||||
// @Description 新增配置
|
||||
// @Param token header string true "认证token"
|
||||
// @Param type formData string true "配置类型(当前只支持PricePack)"
|
||||
// @Param key formData string true "配置名"
|
||||
// @Param value formData string true "配置值"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /NewConfig [post]
|
||||
func (c *CmsController) NewConfig() {
|
||||
c.callNewConfig(func(params *tCmsNewConfigParams) (retVal interface{}, errCode string, err error) {
|
||||
err = cms.AddConfig(params.Ctx, params.Key, params.Type, params.Value)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 删除配置
|
||||
// @Description 删除配置
|
||||
// @Param token header string true "认证token"
|
||||
// @Param type query string true "配置类型(当前只支持PricePack)"
|
||||
// @Param key query string true "配置名"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /DeleteConfig [delete]
|
||||
func (c *CmsController) DeleteConfig() {
|
||||
c.callDeleteConfig(func(params *tCmsDeleteConfigParams) (retVal interface{}, errCode string, err error) {
|
||||
err = cms.DeleteConfig(params.Ctx, params.Key, params.Type)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 修改配置
|
||||
// @Description 修改配置
|
||||
// @Param token header string true "认证token"
|
||||
// @Param type formData string true "配置类型(当前只支持PricePack)"
|
||||
// @Param key formData string true "配置名"
|
||||
// @Param value formData string true "配置值"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdateConfig [put]
|
||||
func (c *CmsController) UpdateConfig() {
|
||||
c.callUpdateConfig(func(params *tCmsUpdateConfigParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.UpdateConfig(params.Ctx, params.Key, params.Type, params.Value)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 查询配置
|
||||
// @Description 查询配置
|
||||
// @Param token header string fasle "认证token"
|
||||
// @Param type query string false "配置类型(当前只支持PricePack)"
|
||||
// @Param key query string false "配置名"
|
||||
// @Param keyword query string false "关键字"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /QueryConfigs [get]
|
||||
func (c *CmsController) QueryConfigs() {
|
||||
c.callQueryConfigs(func(params *tCmsQueryConfigsParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.QueryConfigs(params.Key, params.Type, params.Keyword)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user