This commit is contained in:
邹宗楠
2022-12-07 18:35:07 +08:00
parent f3b6ab6d82
commit 49e926e9cf
3 changed files with 24 additions and 25 deletions

View File

@@ -1,7 +1,6 @@
package print_server
import (
"encoding/json"
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-print/dao"
@@ -70,29 +69,7 @@ func AddPrinters(c *gin.Context, tokenInfo *model.TokenInfo, appID int, printInf
}
func GetPrinters(userId string, appID int, printNo, name string, status, isOnline, offset, pageSize int) (page *model.PagedInfo, err error) {
globals.SugarLogger.Debugf("==================printList==%s", utils.Format4Output(1111111111111, false))
page, err = dao.GetPrintersPage(globals.GetDB(), appID, printNo, name, status, isOnline, offset, pageSize, "")
if err != nil {
return nil, err
}
print2 := make([]model.Printer, 0, 0)
if err := json.Unmarshal([]byte(utils.Interface2String(page.Data)), &print2); err != nil {
return nil, err
}
printList := make([]string, 0, len(print2))
for _, v := range print2 {
printList = append(printList, v.PrintNo)
}
globals.SugarLogger.Debugf("==================printList==%s", utils.Format4Output(printList, false))
printBillList, err := dao.QueryPrintBillList(userId, printList)
if err != nil {
return nil, err
}
globals.SugarLogger.Debugf("====================%s", utils.Format4Output(printBillList, false))
for _, v := range printBillList {
page.PrintBill[v.PrintNo] = v.PrintBalance
}
return
}