diff --git a/internal/dao/invoiceDao.go b/internal/dao/invoiceDao.go index ed630bc..636dd57 100644 --- a/internal/dao/invoiceDao.go +++ b/internal/dao/invoiceDao.go @@ -19,8 +19,11 @@ func CreateInvoice(req *bundle.CreateInvoiceReq) (res *bundle.CreateInvoiceResp, loc, _ := time.LoadLocation("Asia/Shanghai") applyTime, err := time.ParseInLocation("20060102 15:04:05", req.ApplyTime, loc) if err != nil { - fmt.Println("创建发票信息失败:", err) - return nil, err + applyTime, err = time.ParseInLocation(time.DateTime, req.ApplyTime, loc) + if err != nil { + fmt.Println("创建发票信息失败:", err) + return nil, err + } } inv := &model.Invoice{ UserId: userId, @@ -51,9 +54,13 @@ func CreatePaperInvoiceAddress(req *bundle.CreatePaperInvoiceAddressReq) (res *b return nil, err } loc, _ := time.LoadLocation("Asia/Shanghai") - applyTime, err := time.ParseInLocation(time.DateTime, req.ApplyTime, loc) + applyTime, err := time.ParseInLocation("20060102 15:04:05", req.ApplyTime, loc) if err != nil { - return nil, err + applyTime, err = time.ParseInLocation(time.DateTime, req.ApplyTime, loc) + if err != nil { + fmt.Println("创建发票信息失败:", err) + return nil, err + } } pia := &model.PaperInvoiceAddress{ UserId: userId,