Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
commit
bf0f8b9a5d
@ -196,7 +196,7 @@ const INVOICE_TEMPLATE_01 = `
|
|||||||
|
|
||||||
const INVOICE_TEMPLATE_02 = `
|
const INVOICE_TEMPLATE_02 = `
|
||||||
<!-- information -->
|
<!-- information -->
|
||||||
<table class="information_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
<table class="information_warp width100" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="information_td bill" align="left">Bill To:</td>
|
<td class="information_td bill" align="left">Bill To:</td>
|
||||||
<td class="information_td right" align="right">Invoice No. #%v</td>
|
<td class="information_td right" align="right">Invoice No. #%v</td>
|
||||||
@ -221,7 +221,7 @@ const INVOICE_TEMPLATE_02 = `
|
|||||||
`
|
`
|
||||||
const INVOICE_TEMPLATE_03 = `
|
const INVOICE_TEMPLATE_03 = `
|
||||||
<!-- bill -->
|
<!-- bill -->
|
||||||
<table class="bill_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
<table class="bill_warp width100" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="bill_td title" align="left">Product Name</td>
|
<td class="bill_td title" align="left">Product Name</td>
|
||||||
<td class="bill_td title" align="right">Price</td>
|
<td class="bill_td title" align="right">Price</td>
|
||||||
@ -242,7 +242,7 @@ const INVOICE_TEMPLATE_0301 = `
|
|||||||
`
|
`
|
||||||
const INVOICE_TEMPLATE_04 = `
|
const INVOICE_TEMPLATE_04 = `
|
||||||
<!-- total -->
|
<!-- total -->
|
||||||
<table class="total_warp" border="0" align="right" cellpadding="0" cellspacing="0" width="50%">
|
<table class="total_warp width50" border="0" align="right" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="total_td" align="right">Subtotal</td>
|
<td class="total_td" align="right">Subtotal</td>
|
||||||
<td class="total_td info" align="right">%v</td>
|
<td class="total_td info" align="right">%v</td>
|
||||||
@ -271,7 +271,7 @@ const INVOICE_TEMPLATE_04 = `
|
|||||||
`
|
`
|
||||||
const INVOICE_TEMPLATE_05 = `
|
const INVOICE_TEMPLATE_05 = `
|
||||||
<!-- notes -->
|
<!-- notes -->
|
||||||
<table class="notes_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
<table class="notes_warp width100" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="notes_td title" align="left">Payment Method:</td>
|
<td class="notes_td title" align="left">Payment Method:</td>
|
||||||
<td class="notes_td title" align="left">Notes:</td>
|
<td class="notes_td title" align="left">Notes:</td>
|
||||||
@ -287,7 +287,14 @@ const INVOICE_TEMPLATE_05 = `
|
|||||||
`
|
`
|
||||||
const INVOICE_TEMPLATE_06 = `
|
const INVOICE_TEMPLATE_06 = `
|
||||||
</body>
|
</body>
|
||||||
|
<style>
|
||||||
|
.width50 {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
.width100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,6 +116,7 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth
|
|||||||
},
|
},
|
||||||
ProductTemplateTagGroups: req.TemplateTagGroups,
|
ProductTemplateTagGroups: req.TemplateTagGroups,
|
||||||
ProductTemplateV2Info: productTemplateV2Info,
|
ProductTemplateV2Info: productTemplateV2Info,
|
||||||
|
Debug: userinfo.Debug,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -124,10 +125,8 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth
|
|||||||
|
|
||||||
// 返回成功的响应和上传URL
|
// 返回成功的响应和上传URL
|
||||||
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
|
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
|
||||||
"resource_id": res.ResourceId,
|
"resource_id": res.ResourceId,
|
||||||
"resource_url": res.ResourceUrl,
|
"resource_url": res.ResourceUrl,
|
||||||
"resource_metadata": "",
|
"resource_metadata": "",
|
||||||
"diff_time_logo_combine": res.DiffTimeLogoCombine,
|
}).WithDebug(res.DebugData)
|
||||||
"diff_time_upload_file": res.DiffTimeUploadFile,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
@ -174,6 +174,7 @@ func (l *UploadLogoLogic) UploadLogo(req *types.UploadLogoReq, userinfo *auth.Us
|
|||||||
resLogoStandard, err := l.svcCtx.Repositories.ImageHandle.LogoInfoSet(l.ctx, &repositories.LogoInfoSetReq{
|
resLogoStandard, err := l.svcCtx.Repositories.ImageHandle.LogoInfoSet(l.ctx, &repositories.LogoInfoSetReq{
|
||||||
LogoUrl: logoUrl,
|
LogoUrl: logoUrl,
|
||||||
Version: l.svcCtx.Config.BLMService.Version,
|
Version: l.svcCtx.Config.BLMService.Version,
|
||||||
|
Debug: userinfo.Debug,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -104,14 +104,28 @@ type wsConnectItem struct {
|
|||||||
// 请求建立连接,升级websocket协议
|
// 请求建立连接,升级websocket协议
|
||||||
func (l *DataTransferLogic) DataTransfer(req *types.DataTransferReq, w http.ResponseWriter, r *http.Request) {
|
func (l *DataTransferLogic) DataTransfer(req *types.DataTransferReq, w http.ResponseWriter, r *http.Request) {
|
||||||
//把子协议携带的token设置到标准token头信息中
|
//把子协议携带的token设置到标准token头信息中
|
||||||
token := r.Header.Get("Sec-Websocket-Protocol")
|
tokens := r.Header.Get("Sec-Websocket-Protocol")
|
||||||
oldWid := req.Wid
|
oldWid := req.Wid
|
||||||
oldWid = strings.Trim(oldWid, " ")
|
oldWid = strings.Trim(oldWid, " ")
|
||||||
//有token是正常用户,无则是白板用户,也可以连接
|
//有token是正常用户,无则是白板用户,也可以连接
|
||||||
if token != "" {
|
if tokens != "" {
|
||||||
|
token := ""
|
||||||
|
debugToken := ""
|
||||||
|
tokenSlice := strings.Split(tokens, ",")
|
||||||
|
switch len(tokenSlice) {
|
||||||
|
case 1:
|
||||||
|
token = strings.Trim(tokenSlice[0], " ")
|
||||||
|
case 2:
|
||||||
|
token = strings.Trim(tokenSlice[0], " ")
|
||||||
|
debugToken = strings.Trim(tokenSlice[1], " ")
|
||||||
|
r.Header.Set("Debug-Token", debugToken)
|
||||||
|
default:
|
||||||
|
logx.Error("invalid ws token:", tokens)
|
||||||
|
return
|
||||||
|
}
|
||||||
r.Header.Set("Authorization", "Bearer "+token)
|
r.Header.Set("Authorization", "Bearer "+token)
|
||||||
//设置Sec-Websocket-Protocol
|
//设置Sec-Websocket-Protocol
|
||||||
upgrader.Subprotocols = []string{token}
|
upgrader.Subprotocols = []string{tokens}
|
||||||
}
|
}
|
||||||
//判断下是否火狐浏览器(获取浏览器第一条消息返回有收不到的bug需要延迟1秒)
|
//判断下是否火狐浏览器(获取浏览器第一条消息返回有收不到的bug需要延迟1秒)
|
||||||
userAgent := r.Header.Get("User-Agent")
|
userAgent := r.Header.Get("User-Agent")
|
||||||
@ -167,6 +181,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
|||||||
l.sendGetUniqueIdErrResponse(conn)
|
l.sendGetUniqueIdErrResponse(conn)
|
||||||
return wsConnectItem{}, err
|
return wsConnectItem{}, err
|
||||||
}
|
}
|
||||||
|
//传入绑定的wid判断是否可重用
|
||||||
if oldWid != "" {
|
if oldWid != "" {
|
||||||
for i := 0; i < 1; i++ {
|
for i := 0; i < 1; i++ {
|
||||||
//解析传入的wid是不是属于自己的用户的
|
//解析传入的wid是不是属于自己的用户的
|
||||||
@ -224,12 +239,6 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
|||||||
},
|
},
|
||||||
debug: userInfo.Debug,
|
debug: userInfo.Debug,
|
||||||
}
|
}
|
||||||
//先设置下debug(后面要删掉)
|
|
||||||
ws.debug = &auth.Debug{
|
|
||||||
Exp: &userInfo.Exp,
|
|
||||||
IsCache: 1,
|
|
||||||
IsAllTemplateTag: 0,
|
|
||||||
}
|
|
||||||
//保存连接
|
//保存连接
|
||||||
mapConnPool.Store(uniqueId, ws)
|
mapConnPool.Store(uniqueId, ws)
|
||||||
//非白板用户,需要为这个用户建立map索引便于通过用户查询
|
//非白板用户,需要为这个用户建立map索引便于通过用户查询
|
||||||
@ -237,8 +246,8 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
|||||||
if isFirefoxBrowser {
|
if isFirefoxBrowser {
|
||||||
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
||||||
}
|
}
|
||||||
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, websocket_data.ConnectSuccessMsg{Wid: uniqueId}))
|
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, websocket_data.ConnectSuccessMsg{Wid: uniqueId, Debug: ws.debug != nil}))
|
||||||
//发送累加统计连接书
|
//发送累加统计连接数
|
||||||
increaseWebsocketConnectCount()
|
increaseWebsocketConnectCount()
|
||||||
return ws, nil
|
return ws, nil
|
||||||
}
|
}
|
||||||
@ -275,6 +284,7 @@ func (l *DataTransferLogic) checkAuth(r *http.Request) (isAuth bool, userInfo *a
|
|||||||
// 解析JWT token,并对空用户进行判断
|
// 解析JWT token,并对空用户进行判断
|
||||||
userInfo, err := basic.ParseJwtToken(r, l.svcCtx)
|
userInfo, err := basic.ParseJwtToken(r, l.svcCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logx.Error("未授权:", err.Error())
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if userInfo.UserId > 0 {
|
if userInfo.UserId > 0 {
|
||||||
@ -328,6 +338,10 @@ func (w *wsConnectItem) heartbeat() {
|
|||||||
w.close()
|
w.close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//查看debug的时间是否过期
|
||||||
|
if w.debug != nil && w.debug.Exp != nil && *w.debug.Exp < time.Now().UTC().Unix() {
|
||||||
|
w.debug = nil
|
||||||
|
}
|
||||||
//发送心跳信息
|
//发送心跳信息
|
||||||
if err := w.conn.WriteMessage(websocket.PongMessage, nil); err != nil {
|
if err := w.conn.WriteMessage(websocket.PongMessage, nil); err != nil {
|
||||||
logx.Error("发送心跳信息异常,关闭连接:", w.uniqueId, err)
|
logx.Error("发送心跳信息异常,关闭连接:", w.uniqueId, err)
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"fusenapi/constants"
|
"fusenapi/constants"
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
"fusenapi/service/repositories"
|
"fusenapi/service/repositories"
|
||||||
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/curl"
|
"fusenapi/utils/curl"
|
||||||
"fusenapi/utils/hash"
|
"fusenapi/utils/hash"
|
||||||
"fusenapi/utils/websocket_data"
|
"fusenapi/utils/websocket_data"
|
||||||
@ -132,7 +133,7 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
|||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-w.extendRenderProperty.renderCtx.Done():
|
case <-w.extendRenderProperty.renderCtx.Done():
|
||||||
panic("=========检测到模板标签/颜色变化,渲染取消旧的任务=======")
|
panic("检测到模板标签/颜色/logo变化,渲染取消旧的任务")
|
||||||
case <-tmpChan:
|
case <-tmpChan:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -245,7 +246,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
//发送合图完毕阶段消息
|
//发送合图完毕阶段消息
|
||||||
w.sendCombineImageStepResponseMessage(renderImageData.RenderId, renderImageData.RequestId, combineImage, productSize.Id, model3dInfo.Id, productTemplate.Id, res.DiffTimeLogoCombine, res.DiffTimeUploadFile)
|
w.sendCombineImageStepResponseMessage(renderImageData.RenderId, renderImageData.RequestId, combineImage, productSize.Id, model3dInfo.Id, productTemplate.Id, res.DebugData)
|
||||||
//获取唯一id
|
//获取唯一id
|
||||||
taskId := w.genRenderTaskId(combineImage, renderImageData, model3dInfo, productTemplate, element)
|
taskId := w.genRenderTaskId(combineImage, renderImageData, model3dInfo, productTemplate, element)
|
||||||
//查询有没有缓存的资源,有就返回
|
//查询有没有缓存的资源,有就返回
|
||||||
@ -467,17 +468,17 @@ func (w *wsConnectItem) genRenderTaskId(combineImage string, renderImageData web
|
|||||||
|
|
||||||
// ****************************下面的发送消息的*********************************
|
// ****************************下面的发送消息的*********************************
|
||||||
// 发送合图完毕阶段通知消息
|
// 发送合图完毕阶段通知消息
|
||||||
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId, combineTime, uploadTime int64) {
|
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId int64, debugData *auth.DebugData) {
|
||||||
if w.debug == nil {
|
if w.debug == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
combineTakesTime := "cache"
|
combineTakesTime := "cache"
|
||||||
uploadCombineImageTakesTime := "cache"
|
uploadCombineImageTakesTime := "cache"
|
||||||
if combineTime > 0 {
|
if debugData.DiffTimeLogoCombine > 0 {
|
||||||
combineTakesTime = fmt.Sprintf("%dms", combineTime)
|
combineTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeLogoCombine)
|
||||||
}
|
}
|
||||||
if uploadTime > 0 {
|
if debugData.DiffTimeUploadFile > 0 {
|
||||||
uploadCombineImageTakesTime = fmt.Sprintf("%dms", uploadTime)
|
uploadCombineImageTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeUploadFile)
|
||||||
}
|
}
|
||||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{
|
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{
|
||||||
RenderId: renderId,
|
RenderId: renderId,
|
||||||
|
@ -68,8 +68,9 @@ type (
|
|||||||
/* logo信息 */
|
/* logo信息 */
|
||||||
type (
|
type (
|
||||||
LogoInfoSetReq struct {
|
LogoInfoSetReq struct {
|
||||||
LogoUrl string `json:"logo_url"`
|
LogoUrl string `json:"logo_url"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
|
Debug *auth.Debug `json:"debug"`
|
||||||
}
|
}
|
||||||
LogoInfoSetRes struct {
|
LogoInfoSetRes struct {
|
||||||
Res string `json:"res"`
|
Res string `json:"res"`
|
||||||
@ -90,6 +91,10 @@ func (l *defaultImageHandle) LogoInfoSet(ctx context.Context, in *LogoInfoSetReq
|
|||||||
postMap["logo_url"] = in.LogoUrl
|
postMap["logo_url"] = in.LogoUrl
|
||||||
postMap["version"] = in.Version
|
postMap["version"] = in.Version
|
||||||
|
|
||||||
|
if in.Debug != nil && in.Debug.IsAllTemplateTag == 1 {
|
||||||
|
postMap["is_all_template"] = "1"
|
||||||
|
}
|
||||||
|
|
||||||
logc.Infof(ctx, "算法请求--LOGO基础信息--开始时间:%v", time.Now().UTC())
|
logc.Infof(ctx, "算法请求--LOGO基础信息--开始时间:%v", time.Now().UTC())
|
||||||
err := curl.NewClient(ctx, &curl.Config{
|
err := curl.NewClient(ctx, &curl.Config{
|
||||||
BaseUrl: bLMServicePort,
|
BaseUrl: bLMServicePort,
|
||||||
@ -131,11 +136,10 @@ type (
|
|||||||
Debug *auth.Debug `json:"debug"`
|
Debug *auth.Debug `json:"debug"`
|
||||||
}
|
}
|
||||||
LogoCombineRes struct {
|
LogoCombineRes struct {
|
||||||
ResourceId string
|
ResourceId string
|
||||||
ResourceUrl *string
|
ResourceUrl *string
|
||||||
Metadata *string
|
Metadata *string
|
||||||
DiffTimeLogoCombine int64
|
DebugData *auth.DebugData `json:"debug_data"`
|
||||||
DiffTimeUploadFile int64
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
type TemplateTagColor struct {
|
type TemplateTagColor struct {
|
||||||
@ -144,6 +148,7 @@ type TemplateTagColor struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) {
|
func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) {
|
||||||
|
var resp = &LogoCombineRes{}
|
||||||
logoResourceId := s3url_to_s3id.GetS3ResourceIdFormUrl(in.LogoUrl)
|
logoResourceId := s3url_to_s3id.GetS3ResourceIdFormUrl(in.LogoUrl)
|
||||||
if logoResourceId == "" {
|
if logoResourceId == "" {
|
||||||
return nil, errors.New("invalid logo url")
|
return nil, errors.New("invalid logo url")
|
||||||
@ -167,10 +172,12 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
|
|||||||
resourceModel := gmodel.NewFsResourceModel(l.MysqlConn)
|
resourceModel := gmodel.NewFsResourceModel(l.MysqlConn)
|
||||||
resourceInfo, err := resourceModel.FindOneById(ctx, resourceId)
|
resourceInfo, err := resourceModel.FindOneById(ctx, resourceId)
|
||||||
if err == nil && resourceInfo.ResourceId != "" {
|
if err == nil && resourceInfo.ResourceId != "" {
|
||||||
return &LogoCombineRes{
|
if in.Debug == nil || (in.Debug != nil && in.Debug.IsCache == 1) {
|
||||||
ResourceId: resourceId,
|
return &LogoCombineRes{
|
||||||
ResourceUrl: resourceInfo.ResourceUrl,
|
ResourceId: resourceId,
|
||||||
}, nil
|
ResourceUrl: resourceInfo.ResourceUrl,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
@ -308,12 +315,16 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &LogoCombineRes{
|
resp.ResourceId = uploadRes.ResourceId
|
||||||
ResourceId: uploadRes.ResourceId,
|
resp.ResourceUrl = &uploadRes.ResourceUrl
|
||||||
ResourceUrl: &uploadRes.ResourceUrl,
|
if in.Debug != nil {
|
||||||
DiffTimeLogoCombine: diffTimeLogoCombine,
|
resp.DebugData = &auth.DebugData{
|
||||||
DiffTimeUploadFile: diffTimeUploadFile,
|
DiffTimeLogoCombine: diffTimeLogoCombine,
|
||||||
}, nil
|
DiffTimeUploadFile: diffTimeUploadFile,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/* logo合图 */
|
/* logo合图 */
|
||||||
|
@ -365,11 +365,15 @@ func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *Invoic
|
|||||||
var city string
|
var city string
|
||||||
var street string
|
var street string
|
||||||
var state string
|
var state string
|
||||||
|
var suite string
|
||||||
|
var zipCode string
|
||||||
if ress.OrderDetail.DeliveryAddress != nil {
|
if ress.OrderDetail.DeliveryAddress != nil {
|
||||||
name = fmt.Sprintf("%s %s", ress.OrderDetail.DeliveryAddress.FirstName, ress.OrderDetail.DeliveryAddress.LastName)
|
name = fmt.Sprintf("%s %s", ress.OrderDetail.DeliveryAddress.FirstName, ress.OrderDetail.DeliveryAddress.LastName)
|
||||||
street = ress.OrderDetail.DeliveryAddress.Street
|
street = ress.OrderDetail.DeliveryAddress.Street
|
||||||
city = ress.OrderDetail.DeliveryAddress.City
|
city = ress.OrderDetail.DeliveryAddress.City
|
||||||
state = ress.OrderDetail.DeliveryAddress.State
|
state = ress.OrderDetail.DeliveryAddress.State
|
||||||
|
suite = ress.OrderDetail.DeliveryAddress.Suite
|
||||||
|
zipCode = ress.OrderDetail.DeliveryAddress.ZipCode
|
||||||
}
|
}
|
||||||
|
|
||||||
var products string
|
var products string
|
||||||
@ -380,7 +384,7 @@ func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *Invoic
|
|||||||
var productsInfo = fmt.Sprintf(model00301, orderProduct.ProductName, price, orderProduct.PurchaseQuantity.Current, priceTotal)
|
var productsInfo = fmt.Sprintf(model00301, orderProduct.ProductName, price, orderProduct.PurchaseQuantity.Current, priceTotal)
|
||||||
products = products + productsInfo
|
products = products + productsInfo
|
||||||
}
|
}
|
||||||
model003 = fmt.Sprintf(constants.INVOICE_TEMPLATE_03, "", products)
|
model003 = fmt.Sprintf(constants.INVOICE_TEMPLATE_03, products)
|
||||||
|
|
||||||
var subtotal = fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Subtotal.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Subtotal.Current.CurrentAmount.(string))
|
var subtotal = fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Subtotal.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Subtotal.Current.CurrentAmount.(string))
|
||||||
var taxStr = "0.00"
|
var taxStr = "0.00"
|
||||||
@ -396,22 +400,16 @@ func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *Invoic
|
|||||||
|
|
||||||
// 生成收据发票--首款
|
// 生成收据发票--首款
|
||||||
if receiptSnsDeposit != "" {
|
if receiptSnsDeposit != "" {
|
||||||
v1 := receiptSnsDeposit
|
model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, receiptSnsDeposit, name, ctimeDate, street+" "+suite, city, state+zipCode)
|
||||||
v2 := name
|
|
||||||
v3 := ctimeDate
|
|
||||||
v4 := street
|
|
||||||
v5 := city
|
|
||||||
v6 := state
|
|
||||||
model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, "", v1, v2, v3, v4, v5, v6)
|
|
||||||
|
|
||||||
v7 := "Deposit Requested"
|
v7 := "Deposit Requested"
|
||||||
v8 := fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Deposit.PayAmount.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Deposit.PayAmount.Current.CurrentAmount.(string))
|
v8 := fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Deposit.PayAmount.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Deposit.PayAmount.Current.CurrentAmount.(string))
|
||||||
v9 := "Deposit Due"
|
v9 := "Deposit Due"
|
||||||
v10 := v8
|
v10 := v8
|
||||||
model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, "", subtotal, tax, total, v7, v8, v9, v10)
|
model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, subtotal, tax, total, v7, v8, v9, v10)
|
||||||
|
|
||||||
cardSn := "****" + *orderTradeDeposit.CardSn
|
cardSn := "****" + *orderTradeDeposit.CardSn
|
||||||
model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, "", *orderTradeDeposit.CardBrand, cardSn)
|
model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, *orderTradeDeposit.CardBrand, cardSn)
|
||||||
|
|
||||||
var content = model001 + model002 + model003 + model004 + model005 + model006
|
var content = model001 + model002 + model003 + model004 + model005 + model006
|
||||||
|
|
||||||
@ -456,22 +454,16 @@ func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *Invoic
|
|||||||
|
|
||||||
// 生成收据发票--尾款
|
// 生成收据发票--尾款
|
||||||
if receiptSnsFinal != "" {
|
if receiptSnsFinal != "" {
|
||||||
v1 := receiptSnsFinal
|
model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, receiptSnsDeposit, name, ctimeDate, street+" "+suite, city, state+zipCode)
|
||||||
v2 := name
|
|
||||||
v3 := ctimeDate
|
|
||||||
v4 := street
|
|
||||||
v5 := city
|
|
||||||
v6 := state
|
|
||||||
model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, "", v1, v2, v3, v4, v5, v6)
|
|
||||||
|
|
||||||
v7 := "Balance Requested"
|
v7 := "Balance Requested"
|
||||||
v8 := fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.RemainingBalance.PayAmount.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.RemainingBalance.PayAmount.Current.CurrentAmount.(string))
|
v8 := fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.RemainingBalance.PayAmount.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.RemainingBalance.PayAmount.Current.CurrentAmount.(string))
|
||||||
v9 := "Balance Due"
|
v9 := "Balance Due"
|
||||||
v10 := v8
|
v10 := v8
|
||||||
model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, "", subtotal, tax, total, v7, v8, v9, v10)
|
model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, subtotal, tax, total, v7, v8, v9, v10)
|
||||||
|
|
||||||
cardSn := "****" + *orderTradeFinal.CardSn
|
cardSn := "****" + *orderTradeFinal.CardSn
|
||||||
model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, "", *orderTradeDeposit.CardBrand, cardSn)
|
model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, *orderTradeDeposit.CardBrand, cardSn)
|
||||||
var content = model001 + model002 + model003 + model004 + model005 + model006
|
var content = model001 + model002 + model003 + model004 + model005 + model006
|
||||||
base64, err := pdf.HtmlToPdfBase64(content, "html")
|
base64, err := pdf.HtmlToPdfBase64(content, "html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -24,6 +24,12 @@ const (
|
|||||||
IDTYPE_Guest IDTYPE = 2
|
IDTYPE_Guest IDTYPE = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DebugData
|
||||||
|
type DebugData struct {
|
||||||
|
DiffTimeLogoCombine int64 `json:"diff_time_logo_combine"` // 合图算法时间
|
||||||
|
DiffTimeUploadFile int64 `json:"diff_time_upload_file"` // 合图上传时间
|
||||||
|
}
|
||||||
|
|
||||||
// Debug 相关的结构
|
// Debug 相关的结构
|
||||||
type Debug struct {
|
type Debug struct {
|
||||||
Exp *int64 `json:"exp"`
|
Exp *int64 `json:"exp"`
|
||||||
|
@ -2,7 +2,8 @@ package websocket_data
|
|||||||
|
|
||||||
// 基础连接成功返回
|
// 基础连接成功返回
|
||||||
type ConnectSuccessMsg struct {
|
type ConnectSuccessMsg struct {
|
||||||
Wid string `json:"wid"`
|
Wid string `json:"wid"` //websocket连接唯一标识
|
||||||
|
Debug bool `json:"debug"` //是否开启debug
|
||||||
}
|
}
|
||||||
|
|
||||||
// 连接失败
|
// 连接失败
|
||||||
|
Loading…
x
Reference in New Issue
Block a user