Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
b9b7309edc
|
@ -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{}{
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
25
utils/format/number.go
Normal file
25
utils/format/number.go
Normal file
|
@ -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()
|
||||
}
|
Loading…
Reference in New Issue
Block a user