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
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ func AddMoney(db *sqlx.Tx, printNo string, money int64) error {
|
|||||||
|
|
||||||
// UpdateBillToUser 当打印机账户从菜市绑定时,未分配用户,用户再使用小程序绑定时,将打印机分配给用户!
|
// UpdateBillToUser 当打印机账户从菜市绑定时,未分配用户,用户再使用小程序绑定时,将打印机分配给用户!
|
||||||
func UpdateBillToUser(db *sqlx.Tx, param *app_model.PrintBill) error {
|
func UpdateBillToUser(db *sqlx.Tx, param *app_model.PrintBill) error {
|
||||||
return UpdateTx(db, param, []string{"user_id"}...)
|
sql := `UPDATE print_bill SET user_id = ? WHERE print_no = ?`
|
||||||
|
_, err := globals.GetTxDb().Exec(sql, []string{param.UserId, param.PrintNo})
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePrintToSystem 修改打印机账户所属用户
|
// UpdatePrintToSystem 修改打印机账户所属用户
|
||||||
|
|||||||
@@ -285,3 +285,13 @@ func UpdatePrintUser(db *sqlx.Tx, userId, printNo string) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClearPrintMsg 清空打印机消息
|
||||||
|
func ClearPrintMsg(printNo string) error {
|
||||||
|
sql := `UPDATE print_msg SET status = ? WHERE print_no = ? AND status = ?`
|
||||||
|
_, err := globals.GetDB().Exec(sql, []interface{}{model.PrintMsgErr, printNo, model.PrintMsgWait}) // 1-待打印
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
63
dao/print_edition.go
Normal file
63
dao/print_edition.go
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/jx-print/globals"
|
||||||
|
editionModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PrintEdition struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
var PrintEditionDao = new(PrintEdition)
|
||||||
|
|
||||||
|
// AddEdition 添加版本控制
|
||||||
|
func (p PrintEdition) AddEdition(param *editionModel.AddOrUpdatePrintEdition) error {
|
||||||
|
if err := Insert(globals.GetDB(), editionModel.PrintEdition{
|
||||||
|
CreatedAt: time.Now(),
|
||||||
|
UpdatedAt: time.Now(),
|
||||||
|
EditionNo: param.EditionNo,
|
||||||
|
EditionMsg: param.EditionMsg,
|
||||||
|
IsHotBuild: param.IsHotBuild,
|
||||||
|
IsForce: param.IsForce,
|
||||||
|
APKUrl: param.APKUrl,
|
||||||
|
HotUrl: param.HotUrl,
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateEdition 修改版本控制
|
||||||
|
func (p PrintEdition) UpdateEdition(param *editionModel.AddOrUpdatePrintEdition) error {
|
||||||
|
if err := Update(globals.GetDB(), editionModel.PrintEdition{
|
||||||
|
ID: param.Id,
|
||||||
|
CreatedAt: param.CreatedAt,
|
||||||
|
UpdatedAt: time.Now(),
|
||||||
|
EditionNo: param.EditionNo,
|
||||||
|
EditionMsg: param.EditionMsg,
|
||||||
|
IsHotBuild: param.IsHotBuild,
|
||||||
|
IsForce: param.IsForce,
|
||||||
|
APKUrl: param.APKUrl,
|
||||||
|
HotUrl: param.HotUrl,
|
||||||
|
}, []string{"updated_at", "edition_no", "edition_msg", "is_hot_build", "is_force", "apk_url", "hot_url"}...); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePrintEdition 删除
|
||||||
|
func (p PrintEdition) DeletePrintEdition(id int) error {
|
||||||
|
sql := `DELETE FROM print_edition WHERE id = ?`
|
||||||
|
_, err := globals.GetDB().Exec(sql, []interface{}{id}...)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrintEdition) SelectEdition() ([]*editionModel.PrintEdition, error) {
|
||||||
|
var result []*editionModel.PrintEdition
|
||||||
|
sql := `SELECT * FROM print_edition ORDER BY created_at DESC LIMIT 20 OFFSET 0 `
|
||||||
|
if err := globals.GetDB().Select(&result, sql); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
56
dao/print_notice.go
Normal file
56
dao/print_notice.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/jx-print/globals"
|
||||||
|
editionModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PrintNotice struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
var PrintNoticeDao = new(PrintNotice)
|
||||||
|
|
||||||
|
// AddNotice 添加版本控制
|
||||||
|
func (p PrintNotice) AddNotice(param *editionModel.AddOrUpdatePrintNotice) error {
|
||||||
|
if err := Insert(globals.GetDB(), editionModel.PrintNotice{
|
||||||
|
CreatedAt: time.Now(),
|
||||||
|
UpdatedAt: time.Now(),
|
||||||
|
NoticeType: param.NoticeType,
|
||||||
|
Msg: param.Msg,
|
||||||
|
Link: param.Link,
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateNotice 修改版本控制
|
||||||
|
func (p PrintNotice) UpdateNotice(param *editionModel.AddOrUpdatePrintNotice) error {
|
||||||
|
if err := Update(globals.GetDB(), editionModel.PrintNotice{
|
||||||
|
ID: param.Id,
|
||||||
|
UpdatedAt: time.Now(),
|
||||||
|
NoticeType: param.NoticeType,
|
||||||
|
Msg: param.Msg,
|
||||||
|
Link: param.Link,
|
||||||
|
}, []string{"updated_at", "notice_type", "msg", "link"}...); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePrintNotice 删除
|
||||||
|
func (p PrintNotice) DeletePrintNotice(id int) error {
|
||||||
|
sql := `DELETE FROM print_notice WHERE id = ?`
|
||||||
|
_, err := globals.GetDB().Exec(sql, []interface{}{id}...)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrintNotice) SelectPrintNotice(param *editionModel.QueryPrintNotice) ([]*editionModel.PrintNotice, error) {
|
||||||
|
var result []*editionModel.PrintNotice
|
||||||
|
sql := `SELECT * FROM print_edition WHERE notice_type = ? ORDER BY created_at DESC LIMIT ? OFFSET ? `
|
||||||
|
if err := globals.GetDB().Select(&result, sql, []interface{}{param.NoticeType, param.PageSize, (param.PageNumber - 1) * param.PageSize}); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -43,29 +43,33 @@ func (p *PrintSettingDao) UpdatePrinterSetting(param *settingModel.UpdatePrintSe
|
|||||||
sql += ` call_name_setting = ? `
|
sql += ` call_name_setting = ? `
|
||||||
param2 = append(param2, param.CallNameSetting)
|
param2 = append(param2, param.CallNameSetting)
|
||||||
}
|
}
|
||||||
if param.SystemVoice != 0 {
|
if param.BusinessOffLineVoice != 0 {
|
||||||
sql += ` ,system_voice = ? `
|
sql += ` ,business_off_line_voice = ? `
|
||||||
param2 = append(param2, param.SystemVoice)
|
param2 = append(param2, param.BusinessOffLineVoice)
|
||||||
}
|
}
|
||||||
if param.PrintVoiceSetting != "" {
|
if param.BalanceNotEnoughVoice != 0 {
|
||||||
sql += ` ,print_voice_setting = ? `
|
sql += ` ,balance_not_enough_voice = ? `
|
||||||
param2 = append(param2, param.PrintVoiceSetting)
|
param2 = append(param2, param.BalanceNotEnoughVoice)
|
||||||
}
|
}
|
||||||
if param.OrderVoiceSetting != "" {
|
if param.EveryDayGreetVoice != 0 {
|
||||||
sql += ` ,order_voice_setting = ? `
|
sql += ` ,every_day_greet_voice = ? `
|
||||||
param2 = append(param2, param.OrderVoiceSetting)
|
param2 = append(param2, param.EveryDayGreetVoice)
|
||||||
}
|
}
|
||||||
if param.RiderVoiceSetting != "" {
|
if param.BusinessPrintNum != 0 {
|
||||||
sql += ` ,rider_voice_setting = ? `
|
sql += ` ,business_print_num = ? `
|
||||||
param2 = append(param2, param.RiderVoiceSetting)
|
param2 = append(param2, param.BusinessPrintNum)
|
||||||
}
|
}
|
||||||
if param.CustomerVoiceSetting != "" {
|
if param.CustomerPrintNum != 0 {
|
||||||
sql += ` ,customer_voice_setting = ? `
|
sql += ` ,customer_print_num = ? `
|
||||||
param2 = append(param2, param.CustomerVoiceSetting)
|
param2 = append(param2, param.CustomerPrintNum)
|
||||||
}
|
}
|
||||||
if param.PickingSetting != "" {
|
if param.VoiceSetting != "" {
|
||||||
sql += ` ,picking_setting = ? `
|
sql += ` ,voice_setting = ? `
|
||||||
param2 = append(param2, param.PickingSetting)
|
param2 = append(param2, param.CustomerPrintNum)
|
||||||
|
}
|
||||||
|
if param.PrintSetting != "" {
|
||||||
|
sql += ` ,print_setting = ? `
|
||||||
|
param2 = append(param2, param.CustomerPrintNum)
|
||||||
}
|
}
|
||||||
sql += ` WHERE print_no = ? `
|
sql += ` WHERE print_no = ? `
|
||||||
param2 = append(param2, param.PrintNo)
|
param2 = append(param2, param.PrintNo)
|
||||||
|
|||||||
@@ -1,3 +1,31 @@
|
|||||||
package app_model
|
package app_model
|
||||||
|
|
||||||
//版本控制
|
import "time"
|
||||||
|
|
||||||
|
// PrintEdition 版本控制
|
||||||
|
type PrintEdition struct {
|
||||||
|
ID int `orm:"column(id)" json:"id" db:"id"`
|
||||||
|
CreatedAt time.Time `orm:"type(datetime)" json:"created_at" db:"created_at"` // 创建时间
|
||||||
|
UpdatedAt time.Time `orm:"type(datetime)" json:"updated_at" db:"updated_at"` // 更新时间
|
||||||
|
EditionNo string `orm:"type(varchar);size(64)" json:"edition_no" db:"edition_no"` // 版本号
|
||||||
|
EditionMsg string `orm:"type(text)" json:"edition_msg" db:"edition_msg"` // 更新说明
|
||||||
|
IsHotBuild int `orm:"type(tinyint)" json:"is_hot_build" db:"is_hot_build"` // 是否热更新
|
||||||
|
IsForce int `orm:"type(tinyint)" json:"is_force" db:"is_force"` // 是否强制更新
|
||||||
|
APKUrl string `orm:"type(varchar);size(255)" json:"apk_url" db:"apk_url"` // apk下载地址
|
||||||
|
HotUrl string `orm:"type(varchar);size(255)" json:"hot_url" db:"hot_url"` // 热更下载地址
|
||||||
|
}
|
||||||
|
|
||||||
|
type AddOrUpdatePrintEdition struct {
|
||||||
|
Id int `json:"id" form:"id"` // 修改填写
|
||||||
|
CreatedAt time.Time `json:"created_at" form:"created_at"` // 修改填写
|
||||||
|
EditionNo string `json:"edition_no" form:"edition_no" binding:"required"` // 版本号
|
||||||
|
EditionMsg string `json:"edition_msg" form:"edition_msg" binding:"required"` // 更新说明
|
||||||
|
IsHotBuild int `json:"is_hot_build" form:"is_hot_build" binding:"required"` // 是否热更新
|
||||||
|
IsForce int `json:"is_force" form:"is_force" binding:"required" ` // 是否强制更新
|
||||||
|
APKUrl string `json:"apk_url" form:"apk_url" binding:"required"` // apk下载地址
|
||||||
|
HotUrl string `json:"hot_url" form:"hot_url" binding:"required"` // 热更下载地址
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeletePrintEdition struct {
|
||||||
|
Id int `json:"id" form:"id" binding:"required"`
|
||||||
|
}
|
||||||
|
|||||||
30
model/app_model/print_notice.go
Normal file
30
model/app_model/print_notice.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package app_model
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// PrintNotice 包含广告和通知消息
|
||||||
|
type PrintNotice struct {
|
||||||
|
ID int `orm:"column(id)" json:"id" db:"id"`
|
||||||
|
CreatedAt time.Time `orm:"type(datetime)" json:"created_at" db:"created_at"` // 创建时间
|
||||||
|
UpdatedAt time.Time `orm:"type(datetime)" json:"updated_at" db:"updated_at"` // 更新时间
|
||||||
|
NoticeType int `orm:"type(int)" json:"notice_type" db:"notice_type"` // 类型(1-广告/2-通知)
|
||||||
|
Msg string `orm:"type(varchar);size(255)" json:"msg" db:"msg"` // 内容(广告就是图片,通知消息就是文字)
|
||||||
|
Link string `orm:"type(varchar);size(255)" json:"link" db:"link"` // 跳转地址
|
||||||
|
}
|
||||||
|
|
||||||
|
type AddOrUpdatePrintNotice struct {
|
||||||
|
Id int `json:"id" form:"id"`
|
||||||
|
NoticeType int `json:"notice_type" form:"notice_type" binding:"required"`
|
||||||
|
Msg string `json:"msg" form:"msg" binding:"required"`
|
||||||
|
Link string `json:"link" form:"link" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeletePrintNotice struct {
|
||||||
|
Id int `json:"id" form:"id" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryPrintNotice struct {
|
||||||
|
NoticeType int `json:"notice_type" form:"notice_type" binding:"required"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" binding:"required"`
|
||||||
|
PageNumber int `json:"page_number" form:"page_number" binding:"required"`
|
||||||
|
}
|
||||||
@@ -10,91 +10,77 @@ type PrintSetting struct {
|
|||||||
DeletedAt time.Time `json:"deleted_at" db:"deleted_at"`
|
DeletedAt time.Time `json:"deleted_at" db:"deleted_at"`
|
||||||
PrintNo string `orm:"type(varchar);size(32)" json:"print_no" db:"print_no"` // 打印机编号
|
PrintNo string `orm:"type(varchar);size(32)" json:"print_no" db:"print_no"` // 打印机编号
|
||||||
CallNameSetting int `orm:"type(int);size(4);default(64)" json:"call_name_setting" db:"call_name_setting"` // 称谓设置 [64-默认老板]
|
CallNameSetting int `orm:"type(int);size(4);default(64)" json:"call_name_setting" db:"call_name_setting"` // 称谓设置 [64-默认老板]
|
||||||
SystemVoice int `orm:"type(tinyint);size(2);default(1)" json:"system_voice" db:"system_voice"` // 平台语音开关[1打开]
|
BusinessOffLineVoice int `orm:"type(tinyint);size(2);default(1)" json:"business_off_line_voice" db:"business_off_line_voice"` // 店铺离线语音[1打开]
|
||||||
|
BalanceNotEnoughVoice int `orm:"type(tinyint);size(2);default(1)" json:"balance_not_enough_voice" db:"balance_not_enough_voice"` // 余额不足语音提示[1打开]
|
||||||
PrintVoiceSetting string `orm:"type(varchar);size(512)" json:"print_voice_setting" db:"print_voice_setting"` // 打印机提示语音设置
|
EveryDayGreetVoice int `orm:"type(tinyint);size(2);default(1)" json:"every_day_greet_voice" db:"every_day_greet_voice"` // 每日招呼语音[1打开]
|
||||||
OrderVoiceSetting string `orm:"type(varchar);size(512)" json:"order_voice_setting" db:"order_voice_setting"` // 订单提示设置
|
BusinessPrintNum int `orm:"type(int);size(4);default(1)" json:"business_print_num" db:"business_print_num"` // 商家侧订单打印次数
|
||||||
RiderVoiceSetting string `orm:"type(varchar);size(512)" json:"rider_voice_setting" db:"rider_voice_setting"` // 骑手动态提示设置
|
CustomerPrintNum int `orm:"type(int);size(4);default(1)" json:"customer_print_num" json:"customer_print_num"` // 用户侧订单打印次数
|
||||||
CustomerVoiceSetting string `orm:"type(varchar);size(512)" json:"customer_voice_setting" db:"customer_voice_setting"` // 客户收货提示设置
|
VoiceSetting string `orm:"type(varchar);size(1024)" json:"voice_setting" db:"voice_setting"` // 语音设置
|
||||||
PickingSetting string `orm:"type(varchar);size(512)" json:"picking_setting" db:"picking_setting"` // 拣货语音设置
|
PrintSetting string `orm:"type(varchar);size(1024)" json:"print_setting" db:"print_setting"` // 打印设置
|
||||||
}
|
}
|
||||||
|
|
||||||
type PrintSettingObj struct {
|
// VoiceSettingDetail 语音设置
|
||||||
ID int `json:"id"`
|
type VoiceSettingDetail struct {
|
||||||
CreatedAt time.Time `json:"created_at"`
|
WaitOrderVoice int `json:"wait_order_voice"` // 待接单语音[1打开]
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
RiderTakeOrderVoice int `json:"rider_take_order_voice"` // 骑手接单语音[1打开]
|
||||||
DeletedAt time.Time `json:"deleted_at"`
|
ApplyUserOrderCancelVoice int `json:"apply_user_order_cancel_voice"` // 用户申请取消订单语音提示[1打开]
|
||||||
PrintNo string `json:"print_no"` // 打印机编号
|
ApplyRefundOrderVoice int `json:"apply_refund_order_voice"` // 用户申请退款提示语音[1打开]
|
||||||
CallNameSetting int `json:"call_name_setting"` // 称谓设置 [64-默认老板]
|
ApplyRefundGoodsVoice int `json:"apply_refund_goods_voice"` // 用户申请退货提示语音[1打开]
|
||||||
SystemVoice int `json:"system_voice"` // 平台语音开关[1打开]
|
RefundGoodsVoice int `json:"refund_goods_voice"` // 订单已经取消语音[1打开]
|
||||||
PrintVoiceSetting *PrintVoice `json:"print_voice_setting"` // 打印机提示语音设置
|
ConfirmGoodsVoice int `json:"confirm_goods_voice"` // 确认接单语音[1打开]
|
||||||
OrderVoiceSetting *OrderVoice `json:"order_voice_setting"` // 订单提示设置
|
SuccessGoodsVoice int `json:"success_goods_voice"` // 订单完成语音[1打开]
|
||||||
RiderVoiceSetting *RiderVoice `json:"rider_voice_setting"` // 骑手动态提示设置
|
ConsultingPrint int `json:"consulting_print"` // 客户进店咨询打印[1打开]
|
||||||
CustomerVoiceSetting *CustomerReceivingGoods `json:"customer_voice_setting"` // 客户收货提示设置
|
ReminderVoice int `json:"reminder_voice"` // 客户催单语音[1打开]
|
||||||
PickingSetting *ShopPickingVoice `json:"picking_setting"` // 拣货语音设置
|
CustomerRejectionVoice int `json:"customer_rejection_voice"` // 客户拒收语音[1打开]
|
||||||
}
|
CusterRefundVoice int `json:"custer_refund_voice"` // 客服(平台)退款语音[1打开]
|
||||||
|
|
||||||
// PrintVoice 打印机提示语音设置
|
|
||||||
type PrintVoice struct {
|
|
||||||
TimeVoice int `json:"time_voice"` // 平台语音开关[1打开]
|
|
||||||
PaperShortageVoice int `json:"paper_shortage_voice"` // 缺纸语音开关[1打开]
|
|
||||||
DisconnectVoice int `json:"disconnect_voice"` // 打印机断开连接提示[1打开]
|
|
||||||
LoseAuthorization int `json:"lose_authorization"` // 失去授权语音提示[1打开]
|
LoseAuthorization int `json:"lose_authorization"` // 失去授权语音提示[1打开]
|
||||||
}
|
}
|
||||||
|
|
||||||
// OrderVoice 订单提示设置
|
// PrintSettingDetail 打印设置
|
||||||
type OrderVoice struct {
|
type PrintSettingDetail struct {
|
||||||
PrintOrder int `json:"print_order"` // 打印订单[1打开]必须
|
|
||||||
OrderNotice int `json:"order_notice"` // 订单通知[1打开]必须
|
|
||||||
UserOrderCancel int `json:"user_order_cancel"` // 用户取消订单打印[1打开]
|
UserOrderCancel int `json:"user_order_cancel"` // 用户取消订单打印[1打开]
|
||||||
UserOrderCancelVoice int `json:"user_order_cancel_voice"` // 用户取消订单订单语音提示[1打开]
|
RefundOrder int `json:"refund_order"` // 订单退款打印[1打开]
|
||||||
RefundOrder int `json:"refund_order"` // 退款打印[1打开]
|
|
||||||
RefundOrderVoice int `json:"refund_order_voice"` // 退款提示语音[1打开]
|
|
||||||
BusinessOrderCancel int `json:"business_order_cancel"` // 商家取消打印[1打开]
|
BusinessOrderCancel int `json:"business_order_cancel"` // 商家取消打印[1打开]
|
||||||
BusinessOrderCancelVoice int `json:"business_order_cancel_voice"` // 商家取消订单语音提示[1打开]
|
|
||||||
}
|
|
||||||
|
|
||||||
// RiderVoice 骑手动态语音提示
|
|
||||||
type RiderVoice struct {
|
|
||||||
RiderTakeOrder int `json:"rider_take_order"` // 骑手接单打印[1打开]
|
RiderTakeOrder int `json:"rider_take_order"` // 骑手接单打印[1打开]
|
||||||
RiderTakeOrderVoice int `json:"rider_take_order_voice"` // 骑手接单语音[1打开]
|
CusterRefundPrint int `json:"custer_refund_print"` // 客服退款打印[1打开]
|
||||||
RiderServiceVoice int `json:"rider_service_voice"` // 骑手送达语音[1打开]
|
|
||||||
RiderReminderVoice int `json:"rider_reminder_voice"` // 骑手催单语音[1打开]
|
|
||||||
}
|
|
||||||
|
|
||||||
// CustomerReceivingGoods 客户收货语音提示
|
|
||||||
type CustomerReceivingGoods struct {
|
|
||||||
CustomerRejectionPrint int `json:"customer_rejection_print"` // 客户拒收打印[1打开]
|
|
||||||
CustomerRejectionVoice int `json:"customer_rejection_voice"` // 客户拒收语音[1打开]
|
|
||||||
CustcareRefundPrint int `json:"custcare_refund_print"` // 客服退款打印[1打开]
|
|
||||||
CustcareRefundVoice int `json:"custcare_refund_voice"` // 客服退款语音[1打开]
|
|
||||||
ConsultingPrint int `json:"consulting_print"` // 进店咨询打印[1打开]
|
|
||||||
ConsultingVoice int `json:"consulting_voice"` // 进店咨询语音[1打开]
|
|
||||||
}
|
|
||||||
|
|
||||||
// ShopPickingVoice 店铺拣货语音提示
|
|
||||||
type ShopPickingVoice struct {
|
|
||||||
BusinessOffLine int `json:"business_off_line"` // 店铺离线打印[1打开]
|
|
||||||
BusinessOffLineVoice int `json:"business_off_line_voice"` // 店铺离线语音[1打开]
|
|
||||||
WaitOrderPrint int `json:"wait_order_print"` // 待接单打印[1打开]
|
WaitOrderPrint int `json:"wait_order_print"` // 待接单打印[1打开]
|
||||||
WaitOrderVoice int `json:"wait_order_voice"` // 待接单语音[1打开]
|
ApplyUserCancelOrder int `json:"apply_user_cancel_order"` // 用户申请取消订单打印[1打开]
|
||||||
WaitPickingPrint int `json:"wait_picking_print"` // 待接单打印[1打开]
|
ApplyUserRefund int `json:"apply_user_refund"` // 申请部分退款打印[1打开]
|
||||||
WaitPickingVoice int `json:"wait_picking_voice"` // 待接单语音[1打开]
|
OrderCancelSuccess int `json:"order_cancel_success"` // 取消成功打印[1打开]
|
||||||
|
CustomerRejectionPrint int `json:"customer_rejection_print"` // 客户拒收打印[1打开]
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePrintSetting 打印机设置添加
|
// UpdatePrintSetting 打印机设置添加
|
||||||
type UpdatePrintSetting struct {
|
type UpdatePrintSetting struct {
|
||||||
PrintNo string `json:"print_no" form:"print_no" binding:"required"`
|
PrintNo string `json:"print_no"form:"print_no"` // 打印机编号
|
||||||
CallNameSetting int `json:"call_name_setting" form:"call_name_setting"`
|
CallNameSetting int `json:"call_name_setting"form:"call_name_setting"` // 称谓设置 [64-默认老板]
|
||||||
SystemVoice int `json:"system_voice" form:"system_voice"`
|
BusinessOffLineVoice int `json:"business_off_line_voice"form:"business_off_line_voice"` // 店铺离线语音[1打开]
|
||||||
PrintVoiceSetting string `json:"print_voice_setting" form:"print_voice_setting"`
|
BalanceNotEnoughVoice int `json:"balance_not_enough_voice"form:"balance_not_enough_voice"` // 余额不足语音提示[1打开]
|
||||||
OrderVoiceSetting string `json:"order_voice_setting" form:"order_voice_setting"`
|
EveryDayGreetVoice int `json:"every_day_greet_voice"form:"every_day_greet_voice"` // 每日招呼语音[1打开]
|
||||||
RiderVoiceSetting string `json:"rider_voice_setting" form:"rider_voice_setting"`
|
BusinessPrintNum int `json:"business_print_num"form:"business_print_num"` // 商家侧订单打印次数
|
||||||
CustomerVoiceSetting string `json:"customer_voice_setting" form:"customer_voice_setting"`
|
CustomerPrintNum int `json:"customer_print_num"form:"customer_print_num"` // 用户侧订单打印次数
|
||||||
PickingSetting string `json:"picking_setting" form:"picking_setting"`
|
VoiceSetting string `json:"voice_setting"form:"voice_setting"` // 语音设置
|
||||||
|
PrintSetting string `json:"print_setting"form:"print_setting"` // 打印设置
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPrintSetting 获取当前打印机设置
|
// GetPrintSetting 获取当前打印机设置
|
||||||
type GetPrintSetting struct {
|
type GetPrintSetting struct {
|
||||||
PrintNo string `json:"print_no" form:"print_no"` // 打印机编号
|
PrintNo string `json:"print_no" form:"print_no"` // 打印机编号
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PrintSettingObj struct {
|
||||||
|
ID int `json:"id" db:"id"`
|
||||||
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||||
|
DeletedAt time.Time `json:"deleted_at" db:"deleted_at"`
|
||||||
|
PrintNo string `json:"print_no" db:"print_no"` // 打印机编号
|
||||||
|
CallNameSetting int `json:"call_name_setting" db:"call_name_setting"` // 称谓设置 [64-默认老板]
|
||||||
|
BusinessOffLineVoice int `json:"business_off_line_voice" db:"business_off_line_voice"` // 店铺离线语音[1打开]
|
||||||
|
BalanceNotEnoughVoice int `json:"balance_not_enough_voice" db:"balance_not_enough_voice"` // 余额不足语音提示[1打开]
|
||||||
|
EveryDayGreetVoice int `json:"every_day_greet_voice" db:"every_day_greet_voice"` // 每日招呼语音[1打开]
|
||||||
|
BusinessPrintNum int `json:"business_print_num" db:"business_print_num"` // 商家侧订单打印次数
|
||||||
|
CustomerPrintNum int `json:"customer_print_num" json:"customer_print_num"` // 用户侧订单打印次数
|
||||||
|
|
||||||
|
VoiceSetting *VoiceSettingDetail `json:"voice_setting" db:"voice_setting"` // 语音设置
|
||||||
|
PrintSetting *PrintSettingDetail `json:"print_setting" db:"print_setting"` // 打印设置
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,6 +50,13 @@ const (
|
|||||||
OrderStatusPayCancel = 3
|
OrderStatusPayCancel = 3
|
||||||
OrderStatusRefund = 4
|
OrderStatusRefund = 4
|
||||||
|
|
||||||
|
printMsgAlreadySend = 2 //已经发出打印消息
|
||||||
|
printMsgSuccess = 1 //打印成功
|
||||||
|
PrintMsgWait = 0 //待打印
|
||||||
|
printMsgFail = -1 //打印失败(打印机报出)
|
||||||
|
PrintMsgErr = -2 //京西报出
|
||||||
|
printMsgAlreadyLoad = 3 //已放入队列
|
||||||
|
|
||||||
PayTypeTL = "tl" //通联支付
|
PayTypeTL = "tl" //通联支付
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package routers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.rosy.net.cn/jx-print/controllers"
|
"git.rosy.net.cn/jx-print/controllers"
|
||||||
|
appCont "git.rosy.net.cn/jx-print/controllers/app"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -36,4 +37,17 @@ func InitV2System(v2 *gin.RouterGroup) {
|
|||||||
sim := v2.Group("/sim")
|
sim := v2.Group("/sim")
|
||||||
sim.GET("/getCardsInfo", controllers.GetCardsInfo)
|
sim.GET("/getCardsInfo", controllers.GetCardsInfo)
|
||||||
sim.GET("/getChargeInfo", controllers.GetChargeInfo)
|
sim.GET("/getChargeInfo", controllers.GetChargeInfo)
|
||||||
|
|
||||||
|
// 版本控制
|
||||||
|
edition := v2.Group("/edition")
|
||||||
|
edition.POST("/addEditionAddress", appCont.PrintEditionController.AddEditionAddress)
|
||||||
|
edition.POST("/updateEditionAddress", appCont.PrintEditionController.UpdateEditionAddress)
|
||||||
|
edition.POST("/deleteEditionAddress", appCont.PrintEditionController.DeleteEditionAddress)
|
||||||
|
edition.POST("/selectEditionAddress", appCont.PrintEditionController.SelectEditionAddress)
|
||||||
|
// notice 广告和通知消息
|
||||||
|
notice := v2.Group("/notice")
|
||||||
|
notice.POST("/addEditionAddress", appCont.PrintNoticeController.AddNoticeAddress)
|
||||||
|
notice.POST("/updateEditionAddress", appCont.PrintNoticeController.UpdateNoticeAddress)
|
||||||
|
notice.POST("/deleteEditionAddress", appCont.PrintNoticeController.DeleteNoticeAddress)
|
||||||
|
notice.POST("/selectEditionAddress", appCont.PrintNoticeController.SelectNoticeAddress)
|
||||||
}
|
}
|
||||||
|
|||||||
27
services/print_server/app_server/print_edition.go
Normal file
27
services/print_server/app_server/print_edition.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package app_server
|
||||||
|
|
||||||
|
import (
|
||||||
|
editionDao "git.rosy.net.cn/jx-print/dao"
|
||||||
|
editionModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PrintEdition struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
var PrintEditionServer = new(PrintEdition)
|
||||||
|
|
||||||
|
func (p PrintEdition) AddEdition(param *editionModel.AddOrUpdatePrintEdition) error {
|
||||||
|
return editionDao.PrintEditionDao.AddEdition(param)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrintEdition) UpdateEdition(param *editionModel.AddOrUpdatePrintEdition) error {
|
||||||
|
return editionDao.PrintEditionDao.UpdateEdition(param)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrintEdition) DeleteEdition(param *editionModel.DeletePrintEdition) error {
|
||||||
|
return editionDao.PrintEditionDao.DeletePrintEdition(param.Id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrintEdition) QueryEdition() ([]*editionModel.PrintEdition, error) {
|
||||||
|
return editionDao.PrintEditionDao.SelectEdition()
|
||||||
|
}
|
||||||
27
services/print_server/app_server/print_notice.go
Normal file
27
services/print_server/app_server/print_notice.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package app_server
|
||||||
|
|
||||||
|
import (
|
||||||
|
editionDao "git.rosy.net.cn/jx-print/dao"
|
||||||
|
editionModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PrintNotice struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
var PrintNoticeServer = new(PrintNotice)
|
||||||
|
|
||||||
|
func (p PrintNotice) AddPrintNotice(param *editionModel.AddOrUpdatePrintNotice) error {
|
||||||
|
return editionDao.PrintNoticeDao.AddNotice(param)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrintNotice) UpdatePrintNotice(param *editionModel.AddOrUpdatePrintNotice) error {
|
||||||
|
return editionDao.PrintNoticeDao.UpdateNotice(param)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrintNotice) DeletePrintNotice(param *editionModel.DeletePrintNotice) error {
|
||||||
|
return editionDao.PrintNoticeDao.DeletePrintNotice(param.Id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p PrintNotice) QueryPrintNotice(param *editionModel.QueryPrintNotice) ([]*editionModel.PrintNotice, error) {
|
||||||
|
return editionDao.PrintNoticeDao.SelectPrintNotice(param)
|
||||||
|
}
|
||||||
@@ -46,8 +46,9 @@ func (p *PrintSettingServer) SystemInitPrintSetting(txDB *sqlx.Tx, printNo strin
|
|||||||
UpdatedAt: day,
|
UpdatedAt: day,
|
||||||
DeletedAt: utils.DefaultTimeValue,
|
DeletedAt: utils.DefaultTimeValue,
|
||||||
PrintNo: printNo,
|
PrintNo: printNo,
|
||||||
CallNameSetting: 64,
|
CallNameSetting: 64, // 老板
|
||||||
SystemVoice: 1,
|
BusinessPrintNum: 1, // 打印一份
|
||||||
|
CustomerPrintNum: 1, // 打印一份
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -75,89 +76,53 @@ func (p *PrintSettingServer) QueryPrintSetting(printNo string) (*settingModel.Pr
|
|||||||
|
|
||||||
// MarshalJson2String 工具类
|
// MarshalJson2String 工具类
|
||||||
func MarshalJson2String(param *settingModel.PrintSetting) (*settingModel.PrintSetting, error) {
|
func MarshalJson2String(param *settingModel.PrintSetting) (*settingModel.PrintSetting, error) {
|
||||||
// 打印机提示语音设置
|
// 语音设置
|
||||||
printVoiceSetting := &settingModel.PrintVoice{
|
voiceSetting := &settingModel.VoiceSettingDetail{
|
||||||
TimeVoice: settingModel.SettingClose,
|
WaitOrderVoice: settingModel.SettingOpen,
|
||||||
PaperShortageVoice: settingModel.SettingOpen,
|
RiderTakeOrderVoice: settingModel.SettingOpen,
|
||||||
DisconnectVoice: settingModel.SettingOpen,
|
ApplyUserOrderCancelVoice: settingModel.SettingOpen,
|
||||||
|
ApplyRefundOrderVoice: settingModel.SettingOpen,
|
||||||
|
ApplyRefundGoodsVoice: settingModel.SettingOpen,
|
||||||
|
RefundGoodsVoice: settingModel.SettingOpen,
|
||||||
|
ConfirmGoodsVoice: settingModel.SettingOpen,
|
||||||
|
SuccessGoodsVoice: settingModel.SettingOpen,
|
||||||
|
ConsultingPrint: settingModel.SettingOpen,
|
||||||
|
ReminderVoice: settingModel.SettingOpen,
|
||||||
|
CustomerRejectionVoice: settingModel.SettingOpen,
|
||||||
|
CusterRefundVoice: settingModel.SettingOpen,
|
||||||
LoseAuthorization: settingModel.SettingOpen,
|
LoseAuthorization: settingModel.SettingOpen,
|
||||||
}
|
}
|
||||||
printVoiceSettingByte, err := json.Marshal(printVoiceSetting)
|
customerVoiceSettingByte, err := json.Marshal(voiceSetting)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
param.PrintVoiceSetting = string(printVoiceSettingByte)
|
param.VoiceSetting = string(customerVoiceSettingByte)
|
||||||
|
|
||||||
// 订单提示设置
|
// 打印设置
|
||||||
orderVoiceSetting := &settingModel.OrderVoice{
|
printSetting := &settingModel.PrintSettingDetail{
|
||||||
PrintOrder: settingModel.SettingOpen,
|
UserOrderCancel: settingModel.SettingOpen,
|
||||||
OrderNotice: settingModel.SettingOpen,
|
|
||||||
UserOrderCancel: settingModel.SettingClose,
|
|
||||||
UserOrderCancelVoice: settingModel.SettingOpen,
|
|
||||||
RefundOrder: settingModel.SettingOpen,
|
RefundOrder: settingModel.SettingOpen,
|
||||||
RefundOrderVoice: settingModel.SettingOpen,
|
BusinessOrderCancel: settingModel.SettingOpen,
|
||||||
BusinessOrderCancel: settingModel.SettingClose,
|
|
||||||
BusinessOrderCancelVoice: settingModel.SettingOpen,
|
|
||||||
}
|
|
||||||
orderVoiceSettingByte, err := json.Marshal(orderVoiceSetting)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
param.OrderVoiceSetting = string(orderVoiceSettingByte)
|
|
||||||
|
|
||||||
// 送达设置
|
|
||||||
riderVoiceSetting := &settingModel.RiderVoice{
|
|
||||||
RiderTakeOrder: settingModel.SettingOpen,
|
RiderTakeOrder: settingModel.SettingOpen,
|
||||||
RiderTakeOrderVoice: settingModel.SettingOpen,
|
CusterRefundPrint: settingModel.SettingOpen,
|
||||||
RiderServiceVoice: settingModel.SettingOpen,
|
WaitOrderPrint: settingModel.SettingOpen,
|
||||||
RiderReminderVoice: settingModel.SettingOpen,
|
ApplyUserCancelOrder: settingModel.SettingOpen,
|
||||||
|
ApplyUserRefund: settingModel.SettingOpen,
|
||||||
|
OrderCancelSuccess: settingModel.SettingOpen,
|
||||||
}
|
}
|
||||||
riderVoiceSettingByte, err := json.Marshal(riderVoiceSetting)
|
pickingSettingByte, err := json.Marshal(printSetting)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
param.RiderVoiceSetting = string(riderVoiceSettingByte)
|
param.PrintSetting = string(pickingSettingByte)
|
||||||
|
|
||||||
// 客户收货语音设置
|
|
||||||
customerVoiceSetting := &settingModel.CustomerReceivingGoods{
|
|
||||||
CustomerRejectionPrint: settingModel.SettingClose,
|
|
||||||
CustomerRejectionVoice: settingModel.SettingOpen,
|
|
||||||
CustcareRefundPrint: settingModel.SettingClose,
|
|
||||||
CustcareRefundVoice: settingModel.SettingOpen,
|
|
||||||
ConsultingPrint: settingModel.SettingClose,
|
|
||||||
ConsultingVoice: settingModel.SettingClose,
|
|
||||||
}
|
|
||||||
customerVoiceSettingByte, err := json.Marshal(customerVoiceSetting)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
param.CustomerVoiceSetting = string(customerVoiceSettingByte)
|
|
||||||
|
|
||||||
// 拣货设置
|
|
||||||
pickingSetting := &settingModel.ShopPickingVoice{
|
|
||||||
BusinessOffLine: settingModel.SettingClose,
|
|
||||||
BusinessOffLineVoice: settingModel.SettingOpen,
|
|
||||||
WaitOrderPrint: settingModel.SettingClose,
|
|
||||||
WaitOrderVoice: settingModel.SettingOpen,
|
|
||||||
WaitPickingPrint: settingModel.SettingClose,
|
|
||||||
WaitPickingVoice: settingModel.SettingOpen,
|
|
||||||
}
|
|
||||||
pickingSettingByte, err := json.Marshal(pickingSetting)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
param.PickingSetting = string(pickingSettingByte)
|
|
||||||
return param, nil
|
return param, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnMarshalString2Json 将字符串设置转换为对象设置
|
// UnMarshalString2Json 将字符串设置转换为对象设置
|
||||||
func UnMarshalString2Json(param *settingModel.PrintSetting) (*settingModel.PrintSettingObj, error) {
|
func UnMarshalString2Json(param *settingModel.PrintSetting) (*settingModel.PrintSettingObj, error) {
|
||||||
var (
|
var (
|
||||||
printVoiceSetting = &settingModel.PrintVoice{}
|
printSetting = &settingModel.PrintSettingDetail{}
|
||||||
orderVoiceSetting = &settingModel.OrderVoice{}
|
voiceSetting = &settingModel.VoiceSettingDetail{}
|
||||||
riderVoiceSetting = &settingModel.RiderVoice{}
|
|
||||||
customerVoiceSetting = &settingModel.CustomerReceivingGoods{}
|
|
||||||
pickingSetting = &settingModel.ShopPickingVoice{}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
result := &settingModel.PrintSettingObj{
|
result := &settingModel.PrintSettingObj{
|
||||||
@@ -167,38 +132,22 @@ func UnMarshalString2Json(param *settingModel.PrintSetting) (*settingModel.Print
|
|||||||
DeletedAt: param.DeletedAt,
|
DeletedAt: param.DeletedAt,
|
||||||
PrintNo: param.PrintNo,
|
PrintNo: param.PrintNo,
|
||||||
CallNameSetting: param.CallNameSetting,
|
CallNameSetting: param.CallNameSetting,
|
||||||
SystemVoice: param.SystemVoice,
|
BusinessOffLineVoice: param.BusinessOffLineVoice,
|
||||||
PrintVoiceSetting: nil,
|
BalanceNotEnoughVoice: param.BalanceNotEnoughVoice,
|
||||||
OrderVoiceSetting: nil,
|
EveryDayGreetVoice: param.EveryDayGreetVoice,
|
||||||
RiderVoiceSetting: nil,
|
BusinessPrintNum: param.BusinessPrintNum,
|
||||||
CustomerVoiceSetting: nil,
|
CustomerPrintNum: param.CustomerPrintNum,
|
||||||
PickingSetting: nil,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal([]byte(param.PrintVoiceSetting), printVoiceSetting); err != nil {
|
if err := json.Unmarshal([]byte(param.VoiceSetting), voiceSetting); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result.PrintVoiceSetting = printVoiceSetting
|
result.VoiceSetting = voiceSetting
|
||||||
|
|
||||||
if err := json.Unmarshal([]byte(param.OrderVoiceSetting), orderVoiceSetting); err != nil {
|
if err := json.Unmarshal([]byte(param.PrintSetting), printSetting); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result.OrderVoiceSetting = orderVoiceSetting
|
result.PrintSetting = printSetting
|
||||||
|
|
||||||
if err := json.Unmarshal([]byte(param.RiderVoiceSetting), riderVoiceSetting); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
result.RiderVoiceSetting = riderVoiceSetting
|
|
||||||
|
|
||||||
if err := json.Unmarshal([]byte(param.CustomerVoiceSetting), customerVoiceSetting); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
result.CustomerVoiceSetting = customerVoiceSetting
|
|
||||||
|
|
||||||
if err := json.Unmarshal([]byte(param.PickingSetting), pickingSetting); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
result.PickingSetting = pickingSetting
|
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,3 +247,8 @@ func GetPrinterReport(c *gin.Context, tokenInfo *model.TokenInfo) (getPrinterRep
|
|||||||
func DeletePrintMsg(printNos string) error {
|
func DeletePrintMsg(printNos string) error {
|
||||||
return dao.DeletePrinterMsg(printNos)
|
return dao.DeletePrinterMsg(printNos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClearMsg 清除缓存消息
|
||||||
|
func ClearMsg(printNo string) error {
|
||||||
|
return dao.ClearPrintMsg(printNo)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user