修改获取地区列表不验证权限
This commit is contained in:
+35
-28
@@ -363,7 +363,7 @@ func (r *OrderService) PdfToImg() (bool, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
if orderPrescriptionFile.IsConvertedPdf != 1 {
|
||||
if orderPrescriptionFile.IsConvertedPdf == 1 {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -371,38 +371,45 @@ func (r *OrderService) PdfToImg() (bool, error) {
|
||||
|
||||
PrescriptionImgOssPath := strings.TrimLeft(orderPrescriptionFile.PrescriptionImgOssPath, "/")
|
||||
|
||||
// 下载处方pdf到本地
|
||||
// 下载处方图片到本地
|
||||
local, err := aliyun.GetObjectToLocal(PrescriptionImgOssPath,
|
||||
"/Users/wucongxing/Desktop/work/go/hospital-admin-api/data/bak/"+OrderPrescriptionId+".jpg")
|
||||
"/Users/wucongxing/Desktop/work/go/hospital-admin-api/data/bak/img/"+OrderPrescriptionId+".jpg")
|
||||
if err != nil || !local {
|
||||
return false, err
|
||||
}
|
||||
|
||||
//pdfPath := "/Users/wucongxing/Desktop/work/go/hospital-admin-api/data/" + OrderPrescriptionId + ".pdf"
|
||||
//outputDir := "/Users/wucongxing/Desktop/work/go/hospital-admin-api/data/img"
|
||||
//
|
||||
//if err := utils.ConvertPDFToImages(pdfPath, outputDir, OrderPrescriptionId+".jpg"); err != nil {
|
||||
// return false, err
|
||||
//}
|
||||
//
|
||||
//// 修改为已转换
|
||||
//// 开始事务
|
||||
//tx := global.Db.Begin()
|
||||
//defer func() {
|
||||
// if r := recover(); r != nil {
|
||||
// tx.Rollback()
|
||||
// }
|
||||
//}()
|
||||
//
|
||||
//data := make(map[string]interface{})
|
||||
//data["is_converted_pdf"] = 1
|
||||
//err = orderPrescriptionFileDao.EditOrderPrescriptionFileById(tx, orderPrescriptionFile.PrescriptionFileId, data)
|
||||
//if err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
//}
|
||||
//
|
||||
//tx.Commit()
|
||||
// 下载处方pdf到本地
|
||||
local, err = aliyun.GetObjectToLocal(orderPrescriptionFile.PrescriptionPdfOssPath,
|
||||
"/Users/wucongxing/Desktop/work/go/hospital-admin-api/data/bak/pdf/"+OrderPrescriptionId+".pdf")
|
||||
if err != nil || !local {
|
||||
return false, err
|
||||
}
|
||||
|
||||
pdfPath := "/Users/wucongxing/Desktop/work/go/hospital-admin-api/data/bak/pdf/" + OrderPrescriptionId + ".pdf"
|
||||
outputDir := "/Users/wucongxing/Desktop/work/go/hospital-admin-api/data/img"
|
||||
|
||||
if err := utils.ConvertPDFToImages(pdfPath, outputDir, OrderPrescriptionId+".jpg"); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// 修改为已转换
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
data := make(map[string]interface{})
|
||||
data["is_converted_pdf"] = 1
|
||||
err = orderPrescriptionFileDao.EditOrderPrescriptionFileById(tx, orderPrescriptionFile.PrescriptionFileId, data)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
}
|
||||
|
||||
return true, nil
|
||||
|
||||
Reference in New Issue
Block a user