1
This commit is contained in:
@@ -25,7 +25,7 @@ func (p *PrintBill) InitPPrintBill(tx *sqlx.Tx, bill *app_model.PrintBill) error
|
||||
if err := dao.InitPrintBill(tx, bill); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if len(result) == 1 {
|
||||
} else if len(result) == 1 && result[0].UserId == "system" {
|
||||
if err := dao.UpdateBillToUser(tx, bill); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-print/dao"
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
storeModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -55,10 +56,22 @@ func (p *PrintBindStore) QueryStoreAndUser(param *storeModel.RelieveStore) (bool
|
||||
}
|
||||
|
||||
// RelievePrintBindStore 解除门店和打印机的绑定关系
|
||||
func (p *PrintBindStore) RelievePrintBindStore(param *storeModel.RelieveStore) error {
|
||||
if err := dao.RelieveToken(param.UserId, param.PrintNo, param.StoreID); err != nil {
|
||||
func (p *PrintBindStore) RelievePrintBindStore(userId, printNo string) error {
|
||||
// 1.修改打印机表
|
||||
db := globals.GetTxDb()
|
||||
defer db.Commit()
|
||||
|
||||
if err := dao.UpdatePrintUser(db, userId, printNo); err != nil {
|
||||
db.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
// 修改账号说用户
|
||||
if err := dao.UpdatePrintToSystem(db, printNo); err != nil {
|
||||
db.Rollback()
|
||||
return err
|
||||
}
|
||||
// 绑定的门店将用户信息修改掉(暂时没做)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ func (p *PrintSettingServer) SystemInitPrintSetting(txDB *sqlx.Tx, printNo strin
|
||||
return err
|
||||
}
|
||||
if !isHave {
|
||||
// 修改打印机所属用户
|
||||
return nil
|
||||
}
|
||||
day := time.Now()
|
||||
|
||||
@@ -217,6 +217,23 @@ func (t *TempServer) QueryTempList(userId, printSn string) ([]*tempModel.SystemT
|
||||
return userList, nil
|
||||
}
|
||||
|
||||
// QueryPrintTempByPrintNo 根据打印机id查询打印机
|
||||
func (t *TempServer) QueryPrintTempByPrintNo(userId, printSn string) error {
|
||||
printList, err := dao.SelectPrintTemp(printSn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, v := range printList {
|
||||
if v.UserId == userId {
|
||||
continue
|
||||
} else {
|
||||
dao.UpdateTempOnUser(v.ID, userId)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// QuerySystemTemp 查询系统模板
|
||||
func (t *TempServer) QuerySystemTemp() ([]*tempModel.SystemTemp, error) {
|
||||
return dao.QuerySystemTemp()
|
||||
|
||||
@@ -230,3 +230,8 @@ func (u *UserLogin) GetJxc4Token() (string, error) {
|
||||
Jxc4UserToken["expirationTime"] = utils.Int64ToStr(time.Now().Unix() + 5*24*60*60)
|
||||
return user.Token, nil
|
||||
}
|
||||
|
||||
// GetAppJupLink 获取小程序跳转短连接
|
||||
func (u *UserLogin) GetAppJupLink() (string, error) {
|
||||
return api.WeixinMiniAPI.MiniProgramSortLink()
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ func GetPrinters(appID int, printNo, name string, status, isOnline, offset, page
|
||||
return dao.GetPrintersPage(globals.GetDB(), appID, printNo, name, status, isOnline, offset, pageSize, userId)
|
||||
}
|
||||
|
||||
func GetPrintIsUse(printNo string) (bool, error) {
|
||||
func GetPrintIsUse(printNo string) (bool, string, error) {
|
||||
return dao.GetPrintIsUse(printNo)
|
||||
}
|
||||
|
||||
@@ -272,6 +272,7 @@ func GetPrinterReport(tokenInfo *model.TokenInfo) (getPrinterReportResult *app_m
|
||||
papers, _ := dao.GetPrinters(db, app.ID, "", model.PrinterStatusWithouPaper, 0, 0)
|
||||
paperC += len(papers)
|
||||
}
|
||||
|
||||
getPrinterReportResult.WeekPrintCount = weekCount
|
||||
getPrinterReportResult.DayPrintCount = DayCount
|
||||
getPrinterReportResult.DayUnPrintCount = DayUnCount
|
||||
@@ -279,5 +280,10 @@ func GetPrinterReport(tokenInfo *model.TokenInfo) (getPrinterReportResult *app_m
|
||||
getPrinterReportResult.OfflinePrinterCount = offlineC
|
||||
getPrinterReportResult.FlowPrinterCount = flowC
|
||||
getPrinterReportResult.PaperPrinterCount = paperC
|
||||
getPrinterReportResult.UserAllPrintCount, err = dao.GetUserBindAppNo(db, tokenInfo.User.UserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return getPrinterReportResult, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user