Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson 2023-06-16 10:59:03 +08:00
commit 169c167d4a
5 changed files with 26 additions and 6 deletions

19
constants/domain.go Normal file
View File

@ -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/"

View File

@ -34,7 +34,7 @@ const MAIN_INVOICE_HTML = `<!DOCTYPE html>
<tr height="15px"></tr> <tr height="15px"></tr>
<tr> <tr>
<td align="left" style="width: 50%;"> <td align="left" style="width: 50%;">
<span style="color: #666666;font-weight: 400;font-size: 22px; display: block;">' . $sn . '</span> <span style="color: #666666;font-weight: 400;font-size: 22px; display: block;">{{order_sn}}</span>
</td> </td>
</tr> </tr>
<tr height="30px"></tr> <tr height="30px"></tr>

View File

@ -18,7 +18,7 @@ import (
func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
/*var ( var (
// 定义错误变量 // 定义错误变量
err error err error
// 定义用户信息变量 // 定义用户信息变量
@ -51,7 +51,7 @@ func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
} else { } else {
// 如果claims为nil,则认为用户身份为白板用户 // 如果claims为nil,则认为用户身份为白板用户
userinfo = &auth.UserInfo{UserId: 0, GuestId: 0} userinfo = &auth.UserInfo{UserId: 0, GuestId: 0}
}*/ }
var req types.GetOrderInvoiceReq var req types.GetOrderInvoiceReq
// 如果端点有请求结构体则使用httpx.Parse方法从HTTP请求体中解析请求数据 // 如果端点有请求结构体则使用httpx.Parse方法从HTTP请求体中解析请求数据
@ -65,7 +65,7 @@ func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
} }
// 创建一个业务逻辑层实例 // 创建一个业务逻辑层实例
l := logic.NewGetOrderInvoiceLogic(r.Context(), svcCtx) l := logic.NewGetOrderInvoiceLogic(r.Context(), svcCtx)
resp := l.GetOrderInvoice(&req, &auth.UserInfo{39, 0}) resp := l.GetOrderInvoice(&req, userinfo)
// 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应; // 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应;
if resp != nil { if resp != nil {
httpx.OkJsonCtx(r.Context(), w, resp) httpx.OkJsonCtx(r.Context(), w, resp)

View File

@ -171,7 +171,8 @@ func (l *GetOrderInvoiceLogic) GetOrderInvoice(req *types.GetOrderInvoiceReq, us
mainHtml = strings.ReplaceAll(mainHtml, "{{name}}", userName) mainHtml = strings.ReplaceAll(mainHtml, "{{name}}", userName)
mainHtml = strings.ReplaceAll(mainHtml, "{{first_style1}}", firstStyle1) mainHtml = strings.ReplaceAll(mainHtml, "{{first_style1}}", firstStyle1)
mainHtml = strings.ReplaceAll(mainHtml, "{{first_style2}}", firstStyle2) 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")) mainHtml = strings.ReplaceAll(mainHtml, "{{order_expire_time}}", time.Unix(*orderInfo.Ctime, req.TimeZone*60).Format("02 Jan,2006"))
//html内容页面转pdf的base64 //html内容页面转pdf的base64
prfBase64, err := pdf.HtmlToPdfBase64(mainHtml, 2) prfBase64, err := pdf.HtmlToPdfBase64(mainHtml, 2)

View File

@ -12,7 +12,7 @@ import (
"os" "os"
) )
// 带logo的二维码图片生成 content-二维码内容 size-像素单位 outPath 保存路径(传空则不保存) logoPath-logo文件路径(传空就不带) xx轴整体偏移 y:y轴整体偏移 // 带logo的二维码图片生成 content-二维码内容 size-像素单位 outPath 保存路径(传空则不保存) disableBorder是否不启用边框 logoPath-logo文件路径(传空就不带) xx轴整体偏移 y:y轴整体偏移
func CreateQrCodeBs64WithLogo(content, outPath string, logoPath string, size, x, y int, disableBorder bool) (data string, err error) { func CreateQrCodeBs64WithLogo(content, outPath string, logoPath string, size, x, y int, disableBorder bool) (data string, err error) {
code, err := qrcode.New(content, qrcode.High) code, err := qrcode.New(content, qrcode.High)
if err != nil { if err != nil {