From 9769698f224a846ea28bc4cc566ad2eeacafa6e8 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 16 Jun 2023 10:10:50 +0800 Subject: [PATCH] fix --- constants/domain.go | 19 +++++++++++++++++++ .../handler/getorderinvoicehandler.go | 6 +++--- .../internal/logic/getorderinvoicelogic.go | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 constants/domain.go 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/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..cfccc953 100644 --- a/server/orders/internal/logic/getorderinvoicelogic.go +++ b/server/orders/internal/logic/getorderinvoicelogic.go @@ -171,7 +171,7 @@ 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_expire_time}}", time.Unix(*orderInfo.Ctime, req.TimeZone*60).Format("02 Jan,2006")) //html内容页面转pdf的base64 prfBase64, err := pdf.HtmlToPdfBase64(mainHtml, 2)