aa
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tibiotapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-print/dao"
|
||||
@@ -113,3 +114,34 @@ func FlowIncome(db *sqlx.DB, iccID string, flow float64, unit string, incomeType
|
||||
dao.Insert(db, flowIncome)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetCardsInfo(tokenInfo *model.TokenInfo, appID int, printNo string, cardStatus int, iccID, beginDate, endDate string, offset, pagiSize int) (cardInfo *tibiotapi.BatchQueryCardInfoResult, err error) {
|
||||
var (
|
||||
db = globals.GetDB()
|
||||
)
|
||||
if printNo != "" {
|
||||
printers, _ := dao.GetPrinters(db, appID, printNo, 0, 0, 0)
|
||||
if len(printers) == 0 {
|
||||
err = fmt.Errorf("未在该应用下查到此打印机!app_id: %d, print_no: %s", appID, printNo)
|
||||
return nil, err
|
||||
} else {
|
||||
iccID = printers[0].IccID
|
||||
}
|
||||
}
|
||||
if cardInfo, err = api.TibiotAPI.BatchQueryCardInfo(&tibiotapi.BatchQueryCardInfoParam{
|
||||
CardStatus: cardStatus,
|
||||
IccID: iccID,
|
||||
BeginPackageTime: beginDate,
|
||||
EndPackageTime: endDate,
|
||||
PageNum: offset,
|
||||
PageSize: pagiSize,
|
||||
}); err == nil && cardInfo != nil {
|
||||
for _, v := range cardInfo.Records {
|
||||
if printer, err2 := dao.GetPrinter(db, "", v.Iccid); err2 == nil && printer != nil {
|
||||
v.PrintNo = printer.PrintNo
|
||||
v.Name = printer.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
return cardInfo, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user