1
This commit is contained in:
@@ -34,4 +34,9 @@ func BindStoreList(req *model.AddPrinterParam, userId string) error {
|
|||||||
return CreateEntity(GetDB(), param)
|
return CreateEntity(GetDB(), param)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除绑定门店
|
// DeleteStoreList 删除绑定门店
|
||||||
|
func DeleteStoreList(printNo string, storeId string) error {
|
||||||
|
sql := ` DELETE FROM print_bind_store WHERE print_no = ? AND store_id = ? `
|
||||||
|
_, err := ExecuteSQL(GetDB(), sql, []interface{}{printNo, storeId}...)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ func checkPrinterInfo(printNo, name, sound, sim string, volume int) (err error)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func DelPrinter(appID int, printNos []string) (err error) {
|
func DelPrinter(appID int, printNos []string, storeId string) (err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
errs []error
|
errs []error
|
||||||
@@ -254,9 +254,7 @@ func DelPrinter(appID int, printNos []string) (err error) {
|
|||||||
errs = append(errs, fmt.Errorf("该应用下未找到该打印机!print_no : %v ", v))
|
errs = append(errs, fmt.Errorf("该应用下未找到该打印机!print_no : %v ", v))
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
printers[0].DeletedAt = time.Now()
|
if err := dao.DeleteStoreList(printers[0].PrintNo, storeId); err != nil {
|
||||||
|
|
||||||
if _, err = dao.UpdateEntity(db, printers[0], "DeletedAt"); err != nil {
|
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ func (c *ApiController) DelPrinter(dataMap map[string]interface{}) (data, errCod
|
|||||||
printNos []string
|
printNos []string
|
||||||
printNosStr string
|
printNosStr string
|
||||||
appID int
|
appID int
|
||||||
|
storeId string
|
||||||
)
|
)
|
||||||
globals.SugarLogger.Debugf("Begin API DelPrinter data: [%v]", utils.Format4Output(dataMap, false))
|
globals.SugarLogger.Debugf("Begin API DelPrinter data: [%v]", utils.Format4Output(dataMap, false))
|
||||||
if _, ok := dataMap["print_nos"].(string); !ok {
|
if _, ok := dataMap["print_nos"].(string); !ok {
|
||||||
@@ -234,6 +235,9 @@ func (c *ApiController) DelPrinter(dataMap map[string]interface{}) (data, errCod
|
|||||||
return buildParamErrCodeAndErr("print_nos")
|
return buildParamErrCodeAndErr("print_nos")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if _, ok := dataMap["storeId"].(string); !ok {
|
||||||
|
return buildParamErrCodeAndErr("storeId")
|
||||||
|
}
|
||||||
if err = utils.UnmarshalUseNumber([]byte(printNosStr), &printNos); err != nil {
|
if err = utils.UnmarshalUseNumber([]byte(printNosStr), &printNos); err != nil {
|
||||||
return buildParamErrCodeAndErr("print_nos")
|
return buildParamErrCodeAndErr("print_nos")
|
||||||
}
|
}
|
||||||
@@ -243,7 +247,7 @@ func (c *ApiController) DelPrinter(dataMap map[string]interface{}) (data, errCod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
appID = utils.Str2Int(dataMap[keyAppID].(string))
|
appID = utils.Str2Int(dataMap[keyAppID].(string))
|
||||||
if err = cms.DelPrinter(appID, printNos); err != nil {
|
if err = cms.DelPrinter(appID, printNos, storeId); err != nil {
|
||||||
return "", model.ErrCodeGeneralFailed, err
|
return "", model.ErrCodeGeneralFailed, err
|
||||||
}
|
}
|
||||||
return "", errCode, err
|
return "", errCode, err
|
||||||
|
|||||||
Reference in New Issue
Block a user