1
This commit is contained in:
125
controllers/app/print_edition.go
Normal file
125
controllers/app/print_edition.go
Normal file
@@ -0,0 +1,125 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-print/controllers"
|
||||
"git.rosy.net.cn/jx-print/model"
|
||||
tempModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||
"git.rosy.net.cn/jx-print/services/print_server/app_server"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PrintEdition struct{}
|
||||
|
||||
var PrintEditionController = new(PrintEdition)
|
||||
|
||||
// AddEditionAddress 添加热更地址
|
||||
// @Title 添加热更地址
|
||||
// @Description 添加热更地址
|
||||
// @Param token cookie string true "用户登录token"
|
||||
// @Param data body app_model.AddOrUpdatePrintEdition true "请求参数"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /AddEditionAddress [post]
|
||||
func (p *PrintEdition) AddEditionAddress(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
tokenInfo *model.TokenInfo
|
||||
param = &tempModel.AddOrUpdatePrintEdition{}
|
||||
server = app_server.PrintEditionServer
|
||||
)
|
||||
if tokenInfo = controllers.CheckToken(c); tokenInfo == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = c.ShouldBind(param); err != nil {
|
||||
controllers.BuildErrJson(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
err = server.AddEdition(param)
|
||||
return "", "", err
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateEditionAddress 修改热更地址
|
||||
// @Title 修改热更地址
|
||||
// @Description 修改热更地址
|
||||
// @Param token cookie string true "用户登录token"
|
||||
// @Param data body app_model.AddOrUpdatePrintEdition true "请求参数"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /updateEditionAddress [post]
|
||||
func (p *PrintEdition) UpdateEditionAddress(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
tokenInfo *model.TokenInfo
|
||||
param = &tempModel.AddOrUpdatePrintEdition{}
|
||||
server = app_server.PrintEditionServer
|
||||
)
|
||||
if tokenInfo = controllers.CheckToken(c); tokenInfo == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = c.ShouldBind(param); err != nil {
|
||||
controllers.BuildErrJson(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
err = server.UpdateEdition(param)
|
||||
return "", "", err
|
||||
})
|
||||
}
|
||||
|
||||
// DeleteEditionAddress 删除热更地址
|
||||
// @Title 删除热更地址
|
||||
// @Description 删除热更地址
|
||||
// @Param token cookie string true "用户登录token"
|
||||
// @Param data body app_model.DeletePrintEdition true "请求参数"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /deleteEditionAddress [post]
|
||||
func (p *PrintEdition) DeleteEditionAddress(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
tokenInfo *model.TokenInfo
|
||||
param = &tempModel.DeletePrintEdition{}
|
||||
server = app_server.PrintEditionServer
|
||||
)
|
||||
if tokenInfo = controllers.CheckToken(c); tokenInfo == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = c.ShouldBind(param); err != nil {
|
||||
controllers.BuildErrJson(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
err = server.DeleteEdition(param)
|
||||
return "", "", err
|
||||
})
|
||||
}
|
||||
|
||||
// SelectEditionAddress 查询热更地址
|
||||
// @Title 查询热更地址
|
||||
// @Description 查询热更地址
|
||||
// @Param token cookie string true "用户登录token"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /selectEditionAddress [post]
|
||||
func (p *PrintEdition) SelectEditionAddress(c *gin.Context) {
|
||||
var (
|
||||
//tokenInfo *model.TokenInfo
|
||||
server = app_server.PrintEditionServer
|
||||
)
|
||||
//if tokenInfo = controllers.CheckToken(c); tokenInfo == nil {
|
||||
// return
|
||||
//}
|
||||
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
result, err := server.QueryEdition()
|
||||
return result, "", err
|
||||
})
|
||||
}
|
||||
131
controllers/app/print_notice.go
Normal file
131
controllers/app/print_notice.go
Normal file
@@ -0,0 +1,131 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-print/controllers"
|
||||
"git.rosy.net.cn/jx-print/model"
|
||||
tempModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||
"git.rosy.net.cn/jx-print/services/print_server/app_server"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PrintNotice struct{}
|
||||
|
||||
var PrintNoticeController = new(PrintNotice)
|
||||
|
||||
// AddNoticeAddress 添加广告和通知消息
|
||||
// @Title 添加广告和通知消息
|
||||
// @Description 添加广告和通知消息
|
||||
// @Param token cookie string true "用户登录token"
|
||||
// @Param data body app_model.AddOrUpdatePrintNotice true "请求参数"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /addNoticeAddress [post]
|
||||
func (p *PrintNotice) AddNoticeAddress(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
tokenInfo *model.TokenInfo
|
||||
param = &tempModel.AddOrUpdatePrintNotice{}
|
||||
server = app_server.PrintNoticeServer
|
||||
)
|
||||
if tokenInfo = controllers.CheckToken(c); tokenInfo == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = c.ShouldBind(param); err != nil {
|
||||
controllers.BuildErrJson(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
err = server.AddPrintNotice(param)
|
||||
return "", "", err
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateNoticeAddress 修改广告和通知消息
|
||||
// @Title 修改广告和通知消息
|
||||
// @Description 修改广告和通知消息
|
||||
// @Param token cookie string true "用户登录token"
|
||||
// @Param data body app_model.AddOrUpdatePrintNotice true "请求参数"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /updateNoticeAddress [post]
|
||||
func (p *PrintNotice) UpdateNoticeAddress(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
tokenInfo *model.TokenInfo
|
||||
param = &tempModel.AddOrUpdatePrintNotice{}
|
||||
server = app_server.PrintNoticeServer
|
||||
)
|
||||
if tokenInfo = controllers.CheckToken(c); tokenInfo == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = c.ShouldBind(param); err != nil {
|
||||
controllers.BuildErrJson(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
err = server.UpdatePrintNotice(param)
|
||||
return "", "", err
|
||||
})
|
||||
}
|
||||
|
||||
// DeleteNoticeAddress 删除广告和通知消息
|
||||
// @Title 删除广告和通知消息
|
||||
// @Description 删除广告和通知消息
|
||||
// @Param token cookie string true "用户登录token"
|
||||
// @Param data body app_model.DeletePrintNotice true "请求参数"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /deleteNoticeAddress [post]
|
||||
func (p *PrintNotice) DeleteNoticeAddress(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
tokenInfo *model.TokenInfo
|
||||
param = &tempModel.DeletePrintNotice{}
|
||||
server = app_server.PrintNoticeServer
|
||||
)
|
||||
if tokenInfo = controllers.CheckToken(c); tokenInfo == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = c.ShouldBind(param); err != nil {
|
||||
controllers.BuildErrJson(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
err = server.DeletePrintNotice(param)
|
||||
return "", "", err
|
||||
})
|
||||
}
|
||||
|
||||
// SelectNoticeAddress 查询广告和通知消息
|
||||
// @Title 查询广告和通知消息
|
||||
// @Description 查询广告和通知消息
|
||||
// @Param token cookie string true "用户登录token"
|
||||
// @Param data body app_model.DeletePrintNotice true "请求参数"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /selectNoticeAddress [post]
|
||||
func (p *PrintNotice) SelectNoticeAddress(c *gin.Context) {
|
||||
var (
|
||||
// tokenInfo *model.TokenInfo
|
||||
param = &tempModel.QueryPrintNotice{}
|
||||
server = app_server.PrintNoticeServer
|
||||
err error
|
||||
)
|
||||
//if tokenInfo = controllers.CheckToken(c); tokenInfo == nil {
|
||||
// return
|
||||
//}
|
||||
if err = c.ShouldBind(param); err != nil {
|
||||
controllers.BuildErrJson(c, err)
|
||||
return
|
||||
}
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
result, err := server.QueryPrintNotice(param)
|
||||
return result, "", err
|
||||
})
|
||||
}
|
||||
@@ -204,3 +204,28 @@ func GetPrinterReport(c *gin.Context) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 清空打印机缓存数据
|
||||
func ClearMsg(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
tokenInfo *model.TokenInfo
|
||||
param = &struct {
|
||||
PrintNo string `json:"print_no" form:"print_no" binding:"required"` //打印机编号
|
||||
}{}
|
||||
)
|
||||
if tokenInfo = CheckToken(c); tokenInfo == nil {
|
||||
return
|
||||
}
|
||||
if err = c.ShouldBind(¶m); err != nil {
|
||||
BuildErrJson(c, err)
|
||||
return
|
||||
}
|
||||
if !CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
err = print_server.ClearMsg(param.PrintNo)
|
||||
return "", "", err
|
||||
}) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user