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