diff --git a/server/product/internal/logic/getproductsteppricelogic.go b/server/product/internal/logic/getproductsteppricelogic.go index e30b39bd..9a96014c 100644 --- a/server/product/internal/logic/getproductsteppricelogic.go +++ b/server/product/internal/logic/getproductsteppricelogic.go @@ -105,11 +105,18 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep } } stepRange := make([]interface{}, 0, rangeLen) - for _, rangeInfo := range stepPrice.PriceRange { + for rIndex, rangeInfo := range stepPrice.PriceRange { + //最后一个 + if rIndex+1 == rangeLen { + stepRange = append(stepRange, map[string]interface{}{ + "range_description": fmt.Sprintf(">=%s Units", format.NumToStringWithThousandthPercentile(rangeInfo.StartQuantity)), + "item_price": format.CentitoDollar(rangeInfo.Price, 3), + }) + break + } stepRange = append(stepRange, map[string]interface{}{ - "start_quantity": rangeInfo.StartQuantity, - "end_quantity": rangeInfo.EndQuantity, - "item_price": format.CentitoDollar(rangeInfo.Price, 3), + "range_description": fmt.Sprintf("%s-%s Units", format.NumToStringWithThousandthPercentile(rangeInfo.StartQuantity), format.NumToStringWithThousandthPercentile(rangeInfo.EndQuantity)), + "item_price": format.CentitoDollar(rangeInfo.Price, 3), }) } mapRsp[fmt.Sprintf("_%d", *modelPriceInfo.SizeId)] = map[string]interface{}{ diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 94475c07..13b27117 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -23,7 +23,7 @@ var ( //每个websocket渲染任务缓冲队列长度默认值 renderChanLen = 500 //每个websocket渲染并发数 - renderChanConcurrency = 1 + renderChanConcurrency = 500 ) // 渲染处理器 @@ -369,7 +369,7 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, combineImage st } //发送运行阶段消息 w.sendRenderDataToUnityStepResponseMessage(info.RenderId) - logx.Info("发送到unity成功,刀版图:", combineImage , " 请求unity的数据:", string(postDataBytes)) + logx.Info("发送到unity成功,刀版图:", combineImage, " 请求unity的数据:", string(postDataBytes)) return nil } diff --git a/utils/format/number.go b/utils/format/number.go new file mode 100644 index 00000000..8cbca6d3 --- /dev/null +++ b/utils/format/number.go @@ -0,0 +1,25 @@ +package format + +import ( + "fmt" + "strings" +) + +// 数字变成带千分位的字符串 +func NumToStringWithThousandthPercentile(number int64) string { + s := fmt.Sprintf("%d", number) + l := len(s) + if l <= 3 { + return s + } + r := l % 3 //前面第几位开始加入千分位 + b := strings.Builder{} + for i := 0; i < l; i++ { + b.WriteString(string(s[i])) + if i+1 == r && i != l-1 { + b.WriteString(",") + r += 3 + } + } + return b.String() +}