常量统一
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PrinterStatusNormal = 0 //正常
|
PrinterStatusOnlineWithoutPaper = 2 //在线正常缺纸
|
||||||
|
PrinterStatusOnline = 1 //在线正常
|
||||||
|
PrinterStatusOffline = -1 //离线
|
||||||
)
|
)
|
||||||
|
|
||||||
type Printer struct {
|
type Printer struct {
|
||||||
@@ -23,11 +25,12 @@ func (v *Printer) TableIndex() [][]string {
|
|||||||
type PrintMsg struct {
|
type PrintMsg struct {
|
||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
|
|
||||||
PrintNo string `json:"print_no"` //打印机编号
|
MsgID string `orm:"column(msg_id)" json:"msg_id"` //消息ID
|
||||||
OrderNo int `json:"order_no"` //订单序号
|
PrintNo string `json:"print_no"` //打印机编号
|
||||||
Content string `orm:"type(text)" json:"content"` //订单内容
|
OrderNo int `json:"order_no"` //订单序号
|
||||||
Status int `json:"status"` //打印状态
|
Content string `orm:"type(text)" json:"content"` //订单内容
|
||||||
Comment string `json:"comment"` //失败原因
|
Status int `json:"status"` //打印状态
|
||||||
|
Comment string `json:"comment"` //失败原因
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *PrintMsg) TableIndex() [][]string {
|
func (v *PrintMsg) TableIndex() [][]string {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
@@ -179,6 +180,7 @@ func (c *ApiController) AddPrinter(dataMap map[string]interface{}) (data, errCod
|
|||||||
printNo, printKey, name string
|
printNo, printKey, name string
|
||||||
appID int
|
appID int
|
||||||
)
|
)
|
||||||
|
globals.SugarLogger.Debugf("Begin API AddPrinter data: [%v]", utils.Format4Output(dataMap, false))
|
||||||
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
||||||
return buildParamErrCodeAndErr(keyPrintNo)
|
return buildParamErrCodeAndErr(keyPrintNo)
|
||||||
} else {
|
} else {
|
||||||
@@ -207,6 +209,7 @@ func (c *ApiController) DelPrinter(dataMap map[string]interface{}) (data, errCod
|
|||||||
printNo string
|
printNo string
|
||||||
appID int
|
appID int
|
||||||
)
|
)
|
||||||
|
globals.SugarLogger.Debugf("Begin API DelPrinter data: [%v]", utils.Format4Output(dataMap, false))
|
||||||
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
||||||
return buildParamErrCodeAndErr(keyPrintNo)
|
return buildParamErrCodeAndErr(keyPrintNo)
|
||||||
} else {
|
} else {
|
||||||
@@ -227,6 +230,7 @@ func (c *ApiController) UpdatePrinter(dataMap map[string]interface{}) (data, err
|
|||||||
printNo, name string
|
printNo, name string
|
||||||
appID int
|
appID int
|
||||||
)
|
)
|
||||||
|
globals.SugarLogger.Debugf("Begin API UpdatePrinter data: [%v]", utils.Format4Output(dataMap, false))
|
||||||
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
||||||
return buildParamErrCodeAndErr(keyPrintNo)
|
return buildParamErrCodeAndErr(keyPrintNo)
|
||||||
} else {
|
} else {
|
||||||
@@ -254,6 +258,7 @@ func (c *ApiController) DelPrinterSeq(dataMap map[string]interface{}) (data, err
|
|||||||
printNo string
|
printNo string
|
||||||
appID int
|
appID int
|
||||||
)
|
)
|
||||||
|
globals.SugarLogger.Debugf("Begin API DelPrinterSeq data: [%v]", utils.Format4Output(dataMap, false))
|
||||||
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
||||||
return buildParamErrCodeAndErr(keyPrintNo)
|
return buildParamErrCodeAndErr(keyPrintNo)
|
||||||
} else {
|
} else {
|
||||||
@@ -275,18 +280,20 @@ func (c *ApiController) DoPrint(dataMap map[string]interface{}) (data, errCode s
|
|||||||
orderNo = utils.Interface2Int64WithDefault(dataMap["order_no"], 0)
|
orderNo = utils.Interface2Int64WithDefault(dataMap["order_no"], 0)
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
)
|
)
|
||||||
globals.SugarLogger.Debugf("Begin API DoPrint data: [%v]", utils.Format4Output(dataMap, true))
|
globals.SugarLogger.Debugf("Begin API DoPrint data: [%v]", utils.Format4Output(dataMap, false))
|
||||||
if orderNo == 0 {
|
if orderNo == 0 {
|
||||||
return data, model.ErrCodeOpenAPIParamErrNormal, fmt.Errorf("参数错误:order_no 不能为空")
|
return data, model.ErrCodeOpenAPIParamErrNormal, fmt.Errorf("参数错误:order_no 不能为空")
|
||||||
}
|
}
|
||||||
|
msgID := time.Now().Format("20060102150405") + "_" + jxutils.RandStringBytes(8)
|
||||||
printMsg := &model.PrintMsg{
|
printMsg := &model.PrintMsg{
|
||||||
PrintNo: printNo,
|
PrintNo: printNo,
|
||||||
Content: content,
|
Content: content,
|
||||||
OrderNo: int(orderNo),
|
OrderNo: int(orderNo),
|
||||||
|
MsgID: msgID,
|
||||||
}
|
}
|
||||||
dao.WrapAddIDCULDEntity(printMsg, "")
|
dao.WrapAddIDCULDEntity(printMsg, "")
|
||||||
if err = dao.CreateEntity(db, printMsg); err != nil {
|
if err = dao.CreateEntity(db, printMsg); err != nil {
|
||||||
return data, model.ErrCodeGeneralFailed, err
|
return data, model.ErrCodeGeneralFailed, err
|
||||||
}
|
}
|
||||||
return data, errCode, err
|
return msgID, errCode, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user