Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
commit
a1e0c7c5f5
|
@ -1,7 +1,6 @@
|
|||
package constants
|
||||
|
||||
// 发票主体页面
|
||||
const MAIN_INVOICE_HTML = `
|
||||
const INVOICE_TEMPLATE = `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
@ -11,6 +10,26 @@ const MAIN_INVOICE_HTML = `
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Invoice</title>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: "Montserrat-SemiBold";
|
||||
src: url("https://s3.us-west-1.amazonaws.com/storage.fusenpack.com/b808164b4f7ecc19f560d235db5b1f5b99fe8ab218b606f15debab2b9c4230e2");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Montserrat-Medium";
|
||||
src: url("https://s3.us-west-1.amazonaws.com/storage.fusenpack.com/3d91bbd91ba6fac26b8460a078742b61bfd1e2976311c065f8ac9c5270be6901");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Montserrat-Light";
|
||||
src: url("https://s3.us-west-1.amazonaws.com/storage.fusenpack.com/24e580a4a5afebf94596ec7b6c8d9c8d57f75a5429ee757217da552d5f03e5d1");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Montserrat-Regular";
|
||||
src: url("https://s3.us-west-1.amazonaws.com/storage.fusenpack.com/78072d2cbce0a3f88c01ab2830ba3a453f0968b516388e45e9a6fb5e970450b8");
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
@ -22,6 +41,7 @@ const MAIN_INVOICE_HTML = `
|
|||
|
||||
.header_td {
|
||||
width: 50%;
|
||||
font-family: Montserrat-SemiBold;
|
||||
}
|
||||
|
||||
.header_td.logo {
|
||||
|
@ -49,11 +69,13 @@ const MAIN_INVOICE_HTML = `
|
|||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
font-weight: 300;
|
||||
font-family: Montserrat-Light;
|
||||
}
|
||||
|
||||
.information_td.bill {
|
||||
color: #212121;
|
||||
font-weight: 500;
|
||||
font-family: Montserrat-Medium;
|
||||
}
|
||||
|
||||
.information_td.right {
|
||||
|
@ -82,6 +104,7 @@ const MAIN_INVOICE_HTML = `
|
|||
padding: 13px 0 7px;
|
||||
font-weight: 500;
|
||||
color: #212121;
|
||||
font-family: Montserrat-Medium;
|
||||
}
|
||||
|
||||
.bill_td.info {
|
||||
|
@ -89,6 +112,11 @@ const MAIN_INVOICE_HTML = `
|
|||
border-bottom: 1px solid #ccc;
|
||||
padding: 8px 0;
|
||||
font-weight: 400;
|
||||
font-family: Montserrat-Light;
|
||||
}
|
||||
|
||||
.bill_td.info:first-child {
|
||||
font-family: Montserrat-Regular;
|
||||
}
|
||||
|
||||
.bill_warp tr:last-child .bill_td.info {
|
||||
|
@ -104,11 +132,13 @@ const MAIN_INVOICE_HTML = `
|
|||
padding: 8px 0 7px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
font-family: Montserrat-Medium;
|
||||
}
|
||||
|
||||
.total_td.info {
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
font-family: Montserrat-Regular;
|
||||
}
|
||||
|
||||
.total_td.border-dashed {
|
||||
|
@ -124,6 +154,7 @@ const MAIN_INVOICE_HTML = `
|
|||
padding-top: 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
font-family: Montserrat-SemiBold;
|
||||
}
|
||||
|
||||
.notes_warp {
|
||||
|
@ -136,11 +167,13 @@ const MAIN_INVOICE_HTML = `
|
|||
font-weight: 300;
|
||||
width: 50%;
|
||||
line-height: 21px;
|
||||
font-family: Montserrat-Light;
|
||||
}
|
||||
|
||||
.notes_td.title {
|
||||
color: #212121;
|
||||
font-weight: 500;
|
||||
font-family: Montserrat-Medium;
|
||||
}
|
||||
|
||||
.notes_td.notes {
|
||||
|
@ -150,95 +183,102 @@ const MAIN_INVOICE_HTML = `
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<!-- header -->
|
||||
<table class="header_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="header_td logo" align="left">
|
||||
<img class="header_logo" src="https://fusenapi.kayue.cn:8010/storage/email/logo.png" alt="logo">
|
||||
</td>
|
||||
<td class="header_td title" align="right">Invoice</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- information -->
|
||||
<table class="information_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="information_td bill" align="left">Bill To:</td>
|
||||
<td class="information_td right" align="right">Invoice No. {{invoice_number}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="information_td info" align="left">{{buyer_name}}</td>
|
||||
<td class="information_td right" align="right">Date: {{buy_date}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="information_td info" align="left">{{street}}</td>
|
||||
<td class="information_td" align="right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="information_td info" align="left">{{city}}</td>
|
||||
<td class="information_td" align="right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="information_td info" align="left">{{country}}</td>
|
||||
<td class="information_td" align="right"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- bill -->
|
||||
<table class="bill_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||
<!--循环部分-->
|
||||
{{product_loop_html}}
|
||||
<!--循环部分-->
|
||||
</table>
|
||||
<!-- total -->
|
||||
<table class="total_warp" border="0" align="right" cellpadding="0" cellspacing="0" width="50%">
|
||||
<tr>
|
||||
<td class="total_td" align="right">Subtotal</td>
|
||||
<td class="total_td info" align="right">${{subtotal_price}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td" align="right">Shipping Fee</td>
|
||||
<td class="total_td info" align="right">Free</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td border-dashed" align="right">Tax</td>
|
||||
<td class="total_td info border-dashed" align="right">${{tax}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td" align="right">Total</td>
|
||||
<td class="total_td info" align="right">${{total_price}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td border-solid" align="right">Deposit Requested</td>
|
||||
<td class="total_td info border-solid" align="right">${{deposit_price}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td total" align="right">Deposit Due</td>
|
||||
<td class="total_td total" align="right">${{deposit_price}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- notes -->
|
||||
<table class="notes_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="notes_td title" align="left">Payment Method:</td>
|
||||
<td class="notes_td title" align="left">Notes:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="notes_td" align="left">{{payment_method}}</td>
|
||||
<td class="notes_td notes" align="left" rowspan="2">{{notes}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="notes_td" align="left">Account No. {{account_number}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- header -->
|
||||
<table class="header_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="header_td logo" align="left">
|
||||
<img class="header_logo" src="https://fusenapi.kayue.cn:8010/storage/email/logo.png" alt="logo">
|
||||
</td>
|
||||
<td class="header_td title" align="right">Invoice</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- information -->
|
||||
<table class="information_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="information_td bill" align="left">Bill To:</td>
|
||||
<td class="information_td right" align="right">Invoice No. #20220562040</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="information_td info" align="left">Timmy Turner</td>
|
||||
<td class="information_td right" align="right">Date: 2023/12/04</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="information_td info" align="left">North Street</td>
|
||||
<td class="information_td" align="right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="information_td info" align="left">London, SE20 3JW</td>
|
||||
<td class="information_td" align="right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="information_td info" align="left">United Kingdom</td>
|
||||
<td class="information_td" align="right"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- bill -->
|
||||
<table class="bill_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<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">Quantity</td>
|
||||
<td class="bill_td title" align="right">Total</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bill_td info" align="left">Plastic bowl</td>
|
||||
<td class="bill_td info" align="right">$01.00</td>
|
||||
<td class="bill_td info" align="right">20,000 Units</td>
|
||||
<td class="bill_td info" align="right">$99.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bill_td info" align="left">Paper bag with handlexxxxxxxxxxxxxxx second line</td>
|
||||
<td class="bill_td info" align="right">$01.00</td>
|
||||
<td class="bill_td info" align="right">20,000 Units</td>
|
||||
<td class="bill_td info" align="right">$99.00</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- total -->
|
||||
<table class="total_warp" border="0" align="right" cellpadding="0" cellspacing="0" width="50%">
|
||||
<tr>
|
||||
<td class="total_td" align="right">Subtotal</td>
|
||||
<td class="total_td info" align="right">$198.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td" align="right">Shipping Fee</td>
|
||||
<td class="total_td info" align="right">Free</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td border-dashed" align="right">Tax</td>
|
||||
<td class="total_td info border-dashed" align="right">$0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td" align="right">Total</td>
|
||||
<td class="total_td info" align="right">$198.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td border-solid" align="right">Deposit Requested</td>
|
||||
<td class="total_td info border-solid" align="right">$99.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="total_td total" align="right">Deposit Due</td>
|
||||
<td class="total_td total" align="right">$99.00</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- notes -->
|
||||
<table class="notes_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="notes_td title" align="left">Payment Method:</td>
|
||||
<td class="notes_td title" align="left">Notes:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="notes_td" align="left">ICBC</td>
|
||||
<td class="notes_td notes" align="left" rowspan="2">Thank you for your business !</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="notes_td" align="left">Account No. :****4589</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
`
|
||||
|
||||
// 产品循环部分{{product_loop_html}}
|
||||
const PRODUCT_LOOP_HTML_CONTENT = ` <tr>
|
||||
<td class="bill_td title" align="left">{{product_name}}</td>
|
||||
<td class="bill_td title" align="right">${{product_item_price}}</td>
|
||||
<td class="bill_td title" align="right">{{purchase_quantity}}</td>
|
||||
<td class="bill_td title" align="right">${{product_total_price}}</td>
|
||||
</tr>`
|
||||
`
|
||||
|
|
|
@ -4,41 +4,43 @@ import "fusenapi/constants"
|
|||
|
||||
// 入口数据格式错误
|
||||
func (w *wsConnectItem) incomeDataFormatErrResponse(data interface{}) {
|
||||
if w.openDebug {
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ERR_DATA_FORMAT, data))
|
||||
if !w.openDebug {
|
||||
return
|
||||
}
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ERR_DATA_FORMAT, data))
|
||||
}
|
||||
|
||||
// 渲染错误通知
|
||||
func (w *wsConnectItem) renderErrResponse(renderId, requestId, templateTag, taskId, description string, productId, userId, guestId, templateId, modelId, sizeId, elementModelId int64) {
|
||||
if w.openDebug {
|
||||
data := make(map[string]interface{})
|
||||
data["render_id"] = renderId
|
||||
data["request_id"] = requestId
|
||||
data["description"] = description
|
||||
data["template_tag"] = templateTag
|
||||
data["product_id"] = productId
|
||||
if taskId != "" {
|
||||
data["task_id"] = taskId
|
||||
}
|
||||
if userId >= 0 {
|
||||
data["user_id"] = userId
|
||||
}
|
||||
if guestId >= 0 {
|
||||
data["guest_id"] = guestId
|
||||
}
|
||||
if templateId > 0 {
|
||||
data["template_id"] = templateId
|
||||
}
|
||||
if modelId > 0 {
|
||||
data["model_id"] = modelId
|
||||
}
|
||||
if sizeId > 0 {
|
||||
data["size_id"] = sizeId
|
||||
}
|
||||
if elementModelId > 0 {
|
||||
data["element_model_id"] = elementModelId
|
||||
}
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE_ERR, data))
|
||||
if !w.openDebug {
|
||||
return
|
||||
}
|
||||
data := make(map[string]interface{})
|
||||
data["render_id"] = renderId
|
||||
data["request_id"] = requestId
|
||||
data["description"] = description
|
||||
data["template_tag"] = templateTag
|
||||
data["product_id"] = productId
|
||||
if taskId != "" {
|
||||
data["task_id"] = taskId
|
||||
}
|
||||
if userId >= 0 {
|
||||
data["user_id"] = userId
|
||||
}
|
||||
if guestId >= 0 {
|
||||
data["guest_id"] = guestId
|
||||
}
|
||||
if templateId > 0 {
|
||||
data["template_id"] = templateId
|
||||
}
|
||||
if modelId > 0 {
|
||||
data["model_id"] = modelId
|
||||
}
|
||||
if sizeId > 0 {
|
||||
data["size_id"] = sizeId
|
||||
}
|
||||
if elementModelId > 0 {
|
||||
data["element_model_id"] = elementModelId
|
||||
}
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE_ERR, data))
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, combineImage st
|
|||
if element.Base != nil && *element.Base != "" {
|
||||
tempData = append(tempData, map[string]interface{}{
|
||||
"name": "model",
|
||||
"data": "0," + combineImage + "," + *element.Base + " " + fmt.Sprintf("%d", time.Now().UTC().UnixMilli()),
|
||||
"data": "0," + combineImage + "," + *element.Base,
|
||||
"type": "other",
|
||||
"layer": "0",
|
||||
"is_update": 1,
|
||||
|
@ -437,51 +437,6 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, combineImage st
|
|||
return nil
|
||||
}
|
||||
|
||||
// 发送合图完毕阶段通知消息
|
||||
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId, combineTime, uploadTime int64) {
|
||||
if w.openDebug {
|
||||
combineTakesTime := "cache"
|
||||
uploadCombineImageTakesTime := "cache"
|
||||
if combineTime > 0 {
|
||||
combineTakesTime = fmt.Sprintf("%dms", combineTime)
|
||||
}
|
||||
if uploadTime > 0 {
|
||||
uploadCombineImageTakesTime = fmt.Sprintf("%dms", uploadTime)
|
||||
}
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{
|
||||
RenderId: renderId,
|
||||
RequestId: requestId,
|
||||
CombineImage: combineImage,
|
||||
SizeId: sizeId,
|
||||
ModelId: modelId,
|
||||
TemplateId: templateId,
|
||||
CombineProcessTime: websocket_data.CombineProcessTime{
|
||||
CombineTakesTime: combineTakesTime,
|
||||
UploadCombineImageTakesTime: uploadCombineImageTakesTime,
|
||||
},
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
// 发送组装unity需要的数据完毕消息
|
||||
func (w *wsConnectItem) sendAssembleRenderDataStepResponseMessage(renderId string, requestId string) {
|
||||
if w.openDebug {
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ASSEMBLE_RENDER_DATA, websocket_data.ToUnityRspMsg{RenderId: renderId, RequestId: requestId}))
|
||||
}
|
||||
}
|
||||
|
||||
// 发送组装数据到unity完毕阶段通知消息
|
||||
func (w *wsConnectItem) sendRenderDataToUnityStepResponseMessage(renderId string, requestId string) {
|
||||
if w.openDebug {
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.AssembleRenderDataRspMsg{RenderId: renderId, RequestId: requestId}))
|
||||
}
|
||||
}
|
||||
|
||||
// 发送渲染最终结果数据到前端
|
||||
func (w *wsConnectItem) sendRenderResultData(data websocket_data.RenderImageRspMsg) {
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, data))
|
||||
}
|
||||
|
||||
// 组装渲染任务id
|
||||
func (w *wsConnectItem) genRenderTaskId(combineImage string, renderImageData websocket_data.RenderImageReqMsg, model3dInfo *gmodel.FsProductModel3d, productTemplate *gmodel.FsProductTemplateV2, element *gmodel.FsProductTemplateElement) string {
|
||||
//生成任务id(需要把user_id,guest_id设为0)
|
||||
|
@ -508,3 +463,52 @@ func (w *wsConnectItem) genRenderTaskId(combineImage string, renderImageData web
|
|||
}
|
||||
return hash.JsonHashKey(hashMap)
|
||||
}
|
||||
|
||||
// ****************************下面的发送消息的*********************************
|
||||
// 发送合图完毕阶段通知消息
|
||||
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId, combineTime, uploadTime int64) {
|
||||
if !w.openDebug {
|
||||
return
|
||||
}
|
||||
combineTakesTime := "cache"
|
||||
uploadCombineImageTakesTime := "cache"
|
||||
if combineTime > 0 {
|
||||
combineTakesTime = fmt.Sprintf("%dms", combineTime)
|
||||
}
|
||||
if uploadTime > 0 {
|
||||
uploadCombineImageTakesTime = fmt.Sprintf("%dms", uploadTime)
|
||||
}
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{
|
||||
RenderId: renderId,
|
||||
RequestId: requestId,
|
||||
CombineImage: combineImage,
|
||||
SizeId: sizeId,
|
||||
ModelId: modelId,
|
||||
TemplateId: templateId,
|
||||
CombineProcessTime: websocket_data.CombineProcessTime{
|
||||
CombineTakesTime: combineTakesTime,
|
||||
UploadCombineImageTakesTime: uploadCombineImageTakesTime,
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
||||
// 发送组装unity需要的数据完毕消息
|
||||
func (w *wsConnectItem) sendAssembleRenderDataStepResponseMessage(renderId string, requestId string) {
|
||||
if !w.openDebug {
|
||||
return
|
||||
}
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ASSEMBLE_RENDER_DATA, websocket_data.ToUnityRspMsg{RenderId: renderId, RequestId: requestId}))
|
||||
}
|
||||
|
||||
// 发送组装数据到unity完毕阶段通知消息
|
||||
func (w *wsConnectItem) sendRenderDataToUnityStepResponseMessage(renderId string, requestId string) {
|
||||
if !w.openDebug {
|
||||
return
|
||||
}
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.AssembleRenderDataRspMsg{RenderId: renderId, RequestId: requestId}))
|
||||
}
|
||||
|
||||
// 发送渲染最终结果数据到前端
|
||||
func (w *wsConnectItem) sendRenderResultData(data websocket_data.RenderImageRspMsg) {
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, data))
|
||||
}
|
||||
|
|
|
@ -46,21 +46,6 @@ func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
|||
userConnPoolCtlChan <- data
|
||||
}
|
||||
|
||||
// 根据用户索引发现链接并发送(广播)消息到出口队列
|
||||
func sendToOutChanByUserIndex(userId, guestId int64, message []byte) {
|
||||
data := userConnPoolCtlChanItem{
|
||||
userId: userId,
|
||||
guestId: guestId,
|
||||
uniqueId: "",
|
||||
message: message,
|
||||
option: 2,
|
||||
}
|
||||
select {
|
||||
case userConnPoolCtlChan <- data:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 消费用户索引创建/删除/发送消息中的任务数据
|
||||
func ConsumeUserConnPoolCtlChanData(ctx context.Context) {
|
||||
defer func() {
|
||||
|
@ -130,3 +115,18 @@ func getmapUserConnPoolUniqueId(userId, guestId int64) (uniqueId string) {
|
|||
}
|
||||
return fmt.Sprintf("%d_%d", userId, guestId)
|
||||
}
|
||||
|
||||
// 根据用户索引发现链接并发送(广播)消息到出口队列
|
||||
func sendToOutChanByUserIndex(userId, guestId int64, message []byte) {
|
||||
data := userConnPoolCtlChanItem{
|
||||
userId: userId,
|
||||
guestId: guestId,
|
||||
uniqueId: "",
|
||||
message: message,
|
||||
option: 2,
|
||||
}
|
||||
select {
|
||||
case userConnPoolCtlChan <- data:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ service product {
|
|||
//获取列表页推荐产品列表
|
||||
@handler HomePageRecommendProductListHandler
|
||||
get /api/product/home_page_recommend(HomePageRecommendProductListReq) returns (response);
|
||||
//获取产品详情(重构版)
|
||||
@handler GetProductDetailHandler
|
||||
get /api/product/get_product_detail(GetProductDetailReq) returns (response);
|
||||
}
|
||||
|
||||
//获取详情页推荐产品列表
|
||||
|
@ -221,4 +224,58 @@ type HomePageRecommendProductListRsp {
|
|||
CoverDefault []CoverDefaultItem `json:"cover_default"`
|
||||
HaveOptionalFitting bool `json:"have_optional_fitting"`
|
||||
IsCustomization int64 `json:"is_customization"`
|
||||
}
|
||||
|
||||
//获取产品详情(重构版)
|
||||
type GetProductDetailReq{
|
||||
ProductId int64 `form:"product_id"`//产品id
|
||||
TemplateTag string `form:"template_tag"` //模板标签
|
||||
SelectColorIndex int `form:"select_color_index"` //模板标签颜色索引
|
||||
}
|
||||
type GetProductDetailRsp{
|
||||
TemplateTagColorInfo TemplateTagColorInfo `json:"template_tag_color_info"` //标签颜色信息
|
||||
ProductInfo ProductInfo `json:"product_info"` //产品基本信息
|
||||
BaseColors interface{} `json:"base_colors"` //一些返回写死的颜色
|
||||
SizeInfo SizeInfo `json:"size_info"` //尺寸相关信息
|
||||
}
|
||||
type SizeInfo{
|
||||
SizeId int64 `json:"size_id"`
|
||||
Title interface{} `json:"title"`
|
||||
Capacity string `json:"capacity"`
|
||||
PartsCanDeleted bool `json:"parts_can_deleted"`
|
||||
ModelId int64 `json:"model_id"`
|
||||
IsHot int64 `json:"is_hot"`
|
||||
MinPrice string `json:"min_price"`
|
||||
IsDefault bool `json:"is_default"`
|
||||
TemplateInfo TemplateInfo `json:"template_info"`
|
||||
ModelInfo ModelInfo `json:"model_info"`
|
||||
}
|
||||
type ModelInfo{
|
||||
ModelId int64 `json:"model_id"` //模型id
|
||||
ModelDesignInfo interface{} `json:"design_info"` //模型设计信息
|
||||
LightInfo LightInfo `json:"light_info"` //灯光信息
|
||||
}
|
||||
type LightInfo{
|
||||
LightId int64 `json:"light_id"` //灯光id
|
||||
LightName string `json:"light_name"` //灯光组名称
|
||||
LightDesignInfo interface{} `json:"light_design_info"` //灯光设计信息
|
||||
}
|
||||
type TemplateInfo {
|
||||
TemplateSwitchInfo interface{} `json:"template_switch_info"` //对应模板标签下模板的开关信息,同列表页
|
||||
CombineIsVisible bool `json:"combine_is_visible"` //合图开关是否开启
|
||||
Material string `json:"material"` //默认素材
|
||||
}
|
||||
type ProductInfo{
|
||||
ProductId int64 `json:"product_id"` //产品id
|
||||
ProductType int64 `json:"product_type"` //产品类型id
|
||||
ProductTypeName string `json:"product_type_name"` //产品类型名称
|
||||
Title string `json:"title"` //产品标题
|
||||
IsEnv int64 `json:"is_env"` //是否环保
|
||||
IsMicro int64 `json:"is_micro"` //是否可微波炉
|
||||
IsCustomization int64 `json:"is_customization"` //是否可定制产品
|
||||
}
|
||||
type TemplateTagColorInfo{
|
||||
Colors []string `json:"colors"`
|
||||
SelectedColorIndex int `json:"selected_color_index"`
|
||||
TemplateTagGroups interface{} `json:"template_tag_groups"`
|
||||
}
|
|
@ -816,7 +816,7 @@ func (d *defaultOrder) CreatePrePaymentByDeposit(ctx context.Context, in *Create
|
|||
var orderAddressByte []byte
|
||||
var statusLinkByte []byte
|
||||
|
||||
if in.DeliveryMethod == constants.DELIVERYMETHODDIRECTMAIL {
|
||||
if in.DeliveryMethod == constants.DELIVERYMETHODDIRECTMAIL && in.DeliveryAddress != nil {
|
||||
orderAddress = &gmodel.OrderAddress{
|
||||
Name: in.DeliveryAddress.Name,
|
||||
Mobile: in.DeliveryAddress.Mobile,
|
||||
|
@ -830,6 +830,16 @@ func (d *defaultOrder) CreatePrePaymentByDeposit(ctx context.Context, in *Create
|
|||
ErrorCode: errorCode,
|
||||
}, err
|
||||
}
|
||||
} else {
|
||||
var orderAddress *gmodel.OrderAddress
|
||||
orderAddressByte, err = json.Marshal(orderAddress)
|
||||
if err != nil {
|
||||
logc.Errorf(ctx, "create prePayment deposit failed orderAddressByte, err: %v", err)
|
||||
errorCode = *basic.CodeServiceErr
|
||||
return &CreatePrePaymentByDepositRes{
|
||||
ErrorCode: errorCode,
|
||||
}, err
|
||||
}
|
||||
}
|
||||
// 订单状态--链路
|
||||
tPlus60Days := ntime.AddDate(0, 0, 60).UTC()
|
||||
|
@ -845,12 +855,8 @@ func (d *defaultOrder) CreatePrePaymentByDeposit(ctx context.Context, in *Create
|
|||
|
||||
// 更新数据库
|
||||
var table = gmodel.NewAllModels(d.MysqlConn).FsOrder.TableName()
|
||||
var resUpdate *gorm.DB
|
||||
if in.DeliveryMethod == constants.DELIVERYMETHODDIRECTMAIL {
|
||||
resUpdate = d.MysqlConn.Exec(fmt.Sprintf("UPDATE %s SET `delivery_method` = ? , `utime` = ?, `order_address` = JSON_MERGE_PATCH(`order_address`,?), `status_link` = JSON_MERGE_PATCH(`status_link`,?) WHERE `id` = ?", table), in.DeliveryMethod, ntime, orderAddressByte, statusLinkByte, orderInfo.Id)
|
||||
} else {
|
||||
resUpdate = d.MysqlConn.Exec(fmt.Sprintf("UPDATE %s SET `delivery_method` = ? , `utime` = ? WHERE `id` = ?", table), in.DeliveryMethod, ntime, orderInfo.Id)
|
||||
}
|
||||
var resUpdate = d.MysqlConn.Exec(fmt.Sprintf("UPDATE %s SET `delivery_method` = ? , `utime` = ?, `status_link` = JSON_MERGE_PATCH(`status_link`,?), `order_address` = JSON_MERGE_PATCH(`order_address`,?) WHERE `id` = ?", table), in.DeliveryMethod, ntime, statusLinkByte, orderAddressByte, orderInfo.Id)
|
||||
|
||||
err = resUpdate.Error
|
||||
if err != nil {
|
||||
logc.Errorf(ctx, "create prePayment deposit failed update Exec, err: %v", err)
|
||||
|
@ -1264,11 +1270,7 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
|
|||
var statusLink = order.GenerateOrderStatusLink(in.DeliveryMethod, nowTime, in.ExpectedDeliveryTime)
|
||||
|
||||
byteOrderProduct, _ := json.Marshal(orderProductList)
|
||||
var byteOrderAddress []byte
|
||||
if orderAddress != nil {
|
||||
byteOrderAddress, _ = json.Marshal(orderAddress)
|
||||
}
|
||||
|
||||
byteOrderAddress, _ := json.Marshal(orderAddress)
|
||||
byteOrderAmount, _ := json.Marshal(orderAmount)
|
||||
byteShoppingCartSnapshot, _ := json.Marshal(shoppingCartSnapshotList)
|
||||
byteShoppingProductSnapshot, _ := json.Marshal(shoppingProductSnapshotList)
|
||||
|
|
|
@ -111,6 +111,10 @@ func (c *defaultClient) PostJson(jsonData interface{}, res interface{}) error {
|
|||
if resp.StatusCode() != 200 {
|
||||
err = fmt.Errorf("服务端失败,返回结果:%+v", resp.RawResponse.Status)
|
||||
logx.Errorf("客户端 请求失败 Client PostForm Server error:%+v", err)
|
||||
// if resp.RawResponse.StatusCode == 422 {
|
||||
// jsonDataB, _ := json.Marshal(jsonData)
|
||||
// logc.Infof(c.ctx, "服务端失败,返回状态码:%+v,请求参数:%+v", resp.RawResponse.StatusCode, string(jsonDataB))
|
||||
// }
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user