diff --git a/constants/domain.go b/constants/domain.go new file mode 100644 index 00000000..cc472d88 --- /dev/null +++ b/constants/domain.go @@ -0,0 +1,19 @@ +package constants + +// api域名 +const API_URL = "https://fusenapi.kayue.cn:8010" + +// 后台域名 +const BACK_URL = "http://fusenadmin.kayue.cn:8009" + +// h5域名 +const H5_URL = "https://fusenh5.kayue.cn:8011" + +// vue域名 +const VUE_URL = "https://fusenh5.kayue.cn:8011" + +// 后台v2域名 +const BACKEND_URL = "https://fusenv2admin.kayue.cn:8014/#/" + +// 二维码域名 +const QRCODE_URL = "http://qrcode.fusenpack.com/site/go/" diff --git a/constants/invoice_html.go b/constants/invoice_html.go index ae85bea5..b2eca035 100644 --- a/constants/invoice_html.go +++ b/constants/invoice_html.go @@ -34,7 +34,7 @@ const MAIN_INVOICE_HTML = ` - ' . $sn . ' + {{order_sn}} diff --git a/server/orders/internal/handler/getorderinvoicehandler.go b/server/orders/internal/handler/getorderinvoicehandler.go index 4e2985c9..03992ff7 100644 --- a/server/orders/internal/handler/getorderinvoicehandler.go +++ b/server/orders/internal/handler/getorderinvoicehandler.go @@ -18,7 +18,7 @@ import ( func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - /*var ( + var ( // 定义错误变量 err error // 定义用户信息变量 @@ -51,7 +51,7 @@ func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { } else { // 如果claims为nil,则认为用户身份为白板用户 userinfo = &auth.UserInfo{UserId: 0, GuestId: 0} - }*/ + } var req types.GetOrderInvoiceReq // 如果端点有请求结构体,则使用httpx.Parse方法从HTTP请求体中解析请求数据 @@ -65,7 +65,7 @@ func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { } // 创建一个业务逻辑层实例 l := logic.NewGetOrderInvoiceLogic(r.Context(), svcCtx) - resp := l.GetOrderInvoice(&req, &auth.UserInfo{39, 0}) + resp := l.GetOrderInvoice(&req, userinfo) // 如果响应不为nil,则使用httpx.OkJsonCtx方法返回JSON响应; if resp != nil { httpx.OkJsonCtx(r.Context(), w, resp) diff --git a/server/orders/internal/logic/getorderinvoicelogic.go b/server/orders/internal/logic/getorderinvoicelogic.go index eff54d45..aa4336a5 100644 --- a/server/orders/internal/logic/getorderinvoicelogic.go +++ b/server/orders/internal/logic/getorderinvoicelogic.go @@ -171,7 +171,8 @@ func (l *GetOrderInvoiceLogic) GetOrderInvoice(req *types.GetOrderInvoiceReq, us mainHtml = strings.ReplaceAll(mainHtml, "{{name}}", userName) mainHtml = strings.ReplaceAll(mainHtml, "{{first_style1}}", firstStyle1) mainHtml = strings.ReplaceAll(mainHtml, "{{first_style2}}", firstStyle2) - mainHtml = strings.ReplaceAll(mainHtml, "{{h5Url}}", "http://www.baidu.com") // TODO ???????????? + mainHtml = strings.ReplaceAll(mainHtml, "{{h5Url}}", constants.H5_URL) + mainHtml = strings.ReplaceAll(mainHtml, "{{order_sn}}", *orderInfo.Sn) mainHtml = strings.ReplaceAll(mainHtml, "{{order_expire_time}}", time.Unix(*orderInfo.Ctime, req.TimeZone*60).Format("02 Jan,2006")) //html内容页面转pdf的base64 prfBase64, err := pdf.HtmlToPdfBase64(mainHtml, 2) diff --git a/utils/qrcode/creator.go b/utils/qrcode/creator.go index 657b2ff2..b89c44d5 100644 --- a/utils/qrcode/creator.go +++ b/utils/qrcode/creator.go @@ -12,7 +12,7 @@ import ( "os" ) -// 带logo的二维码图片生成 content-二维码内容 size-像素单位 outPath 保存路径(传空则不保存) logoPath-logo文件路径(传空就不带) x:x轴整体偏移 y:y轴整体偏移 +// 带logo的二维码图片生成 content-二维码内容 size-像素单位 outPath 保存路径(传空则不保存) disableBorder是否不启用边框 logoPath-logo文件路径(传空就不带) x:x轴整体偏移 y:y轴整体偏移 func CreateQrCodeBs64WithLogo(content, outPath string, logoPath string, size, x, y int, disableBorder bool) (data string, err error) { code, err := qrcode.New(content, qrcode.High) if err != nil {