[账单]显示账单、手动生成账单

This commit is contained in:
GoEdgeLab
2020-12-11 21:39:10 +08:00
parent d2f72d7e87
commit 641df4ccc5
13 changed files with 429 additions and 14 deletions

View File

@@ -10,6 +10,8 @@ import (
const (
NodePriceItemStateEnabled = 1 // 已启用
NodePriceItemStateDisabled = 0 // 已禁用
NodePriceTypeTraffic = "traffic" // 价格类型之流量
)
type NodePriceItemDAO dbs.DAO
@@ -118,3 +120,15 @@ func (this *NodePriceItemDAO) FindAllEnabledAndOnRegionPrices(priceType string)
FindAll()
return
}
// 根据字节查找付费项目
func (this *NodePriceItemDAO) SearchItemsWithBytes(items []*NodePriceItem, bytes int64) int64 {
bytes *= 8
for _, item := range items {
if bytes >= int64(item.BitsFrom) && (bytes < int64(item.BitsTo) || item.BitsTo == 0) {
return int64(item.Id)
}
}
return 0
}