Compare commits
13 Commits
6b12c7441d
...
6d0ccb0c9d
Author | SHA1 | Date | |
---|---|---|---|
6d0ccb0c9d | |||
6cded5543f | |||
f0dbb9c9be | |||
76390c3f66 | |||
6c5ae80059 | |||
24e1eaed14 | |||
422d2acb5a | |||
5edac38772 | |||
61b7fedf0d | |||
17b557df77 | |||
64c56d5ca3 | |||
81e5d2f440 | |||
52c23bdd43 |
36
.gitignore
vendored
Normal file
36
.gitignore
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
/cmd/runtime
|
||||||
|
/cmd/logs/*.log
|
||||||
|
/cmd/runtime/log/*.log
|
||||||
|
/build/*
|
||||||
|
.vscode
|
||||||
|
.idea/*
|
||||||
|
/.idea/*
|
2
clear.sh
2
clear.sh
@ -1,2 +1,4 @@
|
|||||||
|
protoc --proto_path=. --go_out=./pb --go-triple_out=./pb --govalidators_out=./pb ./pb/bundle.proto
|
||||||
ls pb/bundle/*.pb.go | xargs -n1 -IX bash -c 'sed s/,omitempty// X > X.tmp && mv X{.tmp,}';
|
ls pb/bundle/*.pb.go | xargs -n1 -IX bash -c 'sed s/,omitempty// X > X.tmp && mv X{.tmp,}';
|
||||||
|
|
||||||
|
|
||||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module micro-bundle
|
module micro-bundle
|
||||||
|
|
||||||
go 1.18
|
go 1.23.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
dubbo.apache.org/dubbo-go/v3 v3.0.2
|
dubbo.apache.org/dubbo-go/v3 v3.0.2
|
||||||
|
@ -218,39 +218,46 @@ func CreateBundleBalance(data model.BundleBalance) error {
|
|||||||
return app.ModuleClients.BundleDB.Create(&data).Error
|
return app.ModuleClients.BundleDB.Create(&data).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLog, total int64, err error) {
|
func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLogPo, total int64, err error) {
|
||||||
session := app.ModuleClients.BundleDB.Model(&model.CostLog{})
|
session := app.ModuleClients.BundleDB.
|
||||||
if req.Title != "" {
|
Table("cast_cost_log ccl").
|
||||||
session = session.Where("title = ?", req.Title)
|
Select("ccl.*,cwl.cost_type").
|
||||||
|
Joins("left join cast_work_log cwl on cwl.work_uuid = ccl.work_uuid").
|
||||||
|
Where("cwl.work_status = 1 and cwl.deleted_at = 0 and ccl.deleted_at = 0")
|
||||||
|
if req.WorkTitle != "" {
|
||||||
|
session = session.Where("ccl.work_title like ?", "%"+req.WorkTitle+"%")
|
||||||
}
|
}
|
||||||
if req.Platform != 0 {
|
if req.Platform != 0 {
|
||||||
session = session.Where(fmt.Sprintf("JSON_CONTAINS(platform_ids,'%d')", req.Platform))
|
session = session.Where(fmt.Sprintf("JSON_CONTAINS(ccl.platform_ids,'%d')", req.Platform))
|
||||||
}
|
}
|
||||||
if req.Account != "" {
|
if req.Account != "" {
|
||||||
session = session.Where(fmt.Sprintf(`JSON_CONTAINS(media_names,'"%s"')`, req.Account))
|
session = session.Where(fmt.Sprintf(`JSON_CONTAINS(ccl.media_names,'"%s"')`, req.Account))
|
||||||
}
|
}
|
||||||
if req.SubmitTimeEnd != 0 {
|
if req.SubmitTimeEnd != 0 {
|
||||||
session = session.Where("submit_time <= ?", time.UnixMilli(req.SubmitTimeEnd))
|
session = session.Where("ccl.submit_time <= ?", time.UnixMilli(req.SubmitTimeEnd))
|
||||||
}
|
}
|
||||||
if req.SubmitTimeStart != 0 {
|
if req.SubmitTimeStart != 0 {
|
||||||
session = session.Where("submit_time >= ?", time.UnixMilli(req.SubmitTimeStart))
|
session = session.Where("ccl.submit_time >= ?", time.UnixMilli(req.SubmitTimeStart))
|
||||||
|
}
|
||||||
|
if req.CostType != 0 {
|
||||||
|
session = session.Where("cwl.cost_type = ?", req.CostType)
|
||||||
}
|
}
|
||||||
if req.User != "" {
|
if req.User != "" {
|
||||||
if utils.IsPhoneNumber(req.User) {
|
if utils.IsPhoneNumber(req.User) {
|
||||||
session = session.Where("artist_phone = ?", req.User)
|
session = session.Where("ccl.artist_phone = ?", req.User)
|
||||||
} else {
|
} else {
|
||||||
session = session.Where("artist_name like ?", "%"+req.User+"%")
|
session = session.Where("ccl.artist_name like ?", "%"+req.User+"%")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if req.Operator != "" {
|
if req.Operator != "" {
|
||||||
if utils.IsPhoneNumber(req.Operator) {
|
if utils.IsPhoneNumber(req.Operator) {
|
||||||
session = session.Where("operator_phone = ?", req.Operator)
|
session = session.Where("ccl.operator_phone = ?", req.Operator)
|
||||||
} else {
|
} else {
|
||||||
session = session.Where("operator_name like ?", "%"+req.Operator+"%")
|
session = session.Where("ccl.operator_name like ?", "%"+req.Operator+"%")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if req.Type != 0 {
|
if req.Type != 0 {
|
||||||
session = session.Where("work_category = ?", req.Type)
|
session = session.Where("ccl.work_category = ?", req.Type)
|
||||||
}
|
}
|
||||||
if err = session.Count(&total).Error; err != nil {
|
if err = session.Count(&total).Error; err != nil {
|
||||||
return
|
return
|
||||||
@ -258,7 +265,7 @@ func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLog, tota
|
|||||||
if req.Page != 0 && req.PageSize != 0 {
|
if req.Page != 0 && req.PageSize != 0 {
|
||||||
session = session.Offset(int(req.Page-1) * int(req.PageSize)).Limit(int(req.PageSize))
|
session = session.Offset(int(req.Page-1) * int(req.PageSize)).Limit(int(req.PageSize))
|
||||||
}
|
}
|
||||||
err = session.Order("updated_at desc").Find(&data).Error
|
err = session.Order("ccl.updated_at desc").Find(&data).Error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ func GetUsedRecord(req *bundle.GetUsedRecordListReq) (*bundle.GetUsedRecordListR
|
|||||||
}
|
}
|
||||||
resp := &bundle.GetUsedRecordListResp{}
|
resp := &bundle.GetUsedRecordListResp{}
|
||||||
resp.Total = total
|
resp.Total = total
|
||||||
resp.Data = lo.Map(data, func(m model.CostLog, _ int) *bundle.WorkCastItem {
|
resp.Data = lo.Map(data, func(m model.CostLogPo, _ int) *bundle.WorkCastItem {
|
||||||
result := &bundle.WorkCastItem{}
|
result := &bundle.WorkCastItem{}
|
||||||
copier.Copy(result, &m)
|
copier.Copy(result, &m)
|
||||||
return result
|
return result
|
||||||
|
@ -165,7 +165,18 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
|||||||
price, parseErr1 := strconv.ParseFloat(option.Price, 32)
|
price, parseErr1 := strconv.ParseFloat(option.Price, 32)
|
||||||
if parseErr1 != nil {
|
if parseErr1 != nil {
|
||||||
fmt.Println("优惠单价转换失败: ", parseErr1)
|
fmt.Println("优惠单价转换失败: ", parseErr1)
|
||||||
return res, errors.New("优惠单价转换失败")
|
return res, errors.New("单价不能为空: " + parseErr1.Error())
|
||||||
|
}
|
||||||
|
if option.TotalPrice == "" {
|
||||||
|
if option.Symbol == "=" {
|
||||||
|
return res, errors.New("总价不能为空")
|
||||||
|
}
|
||||||
|
option.TotalPrice = "0"
|
||||||
|
}
|
||||||
|
totalPrice, parseErr2 := strconv.ParseFloat(option.TotalPrice, 32)
|
||||||
|
if parseErr2 != nil {
|
||||||
|
fmt.Println("总价转换失败: ", parseErr2)
|
||||||
|
return res, errors.New("总价转换失败: " + parseErr2.Error())
|
||||||
}
|
}
|
||||||
if option.Num < 0 || option.Num > 99 {
|
if option.Num < 0 || option.Num > 99 {
|
||||||
return res, errors.New("数量参数需为0-99")
|
return res, errors.New("数量参数需为0-99")
|
||||||
@ -178,6 +189,7 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
|||||||
Num: option.Num,
|
Num: option.Num,
|
||||||
Symbol: option.Symbol,
|
Symbol: option.Symbol,
|
||||||
Price: float32(price),
|
Price: float32(price),
|
||||||
|
TotalPrice: float32(totalPrice),
|
||||||
})
|
})
|
||||||
index++
|
index++
|
||||||
}
|
}
|
||||||
@ -358,7 +370,12 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
|
|||||||
original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
|
original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
|
||||||
price := decimal.NewFromFloat(float64(option.Price))
|
price := decimal.NewFromFloat(float64(option.Price))
|
||||||
num := decimal.NewFromInt(int64(option.Num))
|
num := decimal.NewFromInt(int64(option.Num))
|
||||||
|
totalPrice := decimal.NewFromFloat(float64(option.TotalPrice))
|
||||||
|
if !totalPrice.IsZero() {
|
||||||
|
saveAmount = (original.Mul(num)).Sub(totalPrice)
|
||||||
|
} else {
|
||||||
saveAmount = original.Sub(price).Mul(num)
|
saveAmount = original.Sub(price).Mul(num)
|
||||||
|
}
|
||||||
case 2:
|
case 2:
|
||||||
//original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
|
//original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
|
||||||
//price := decimal.NewFromFloat(float64(option.Price))
|
//price := decimal.NewFromFloat(float64(option.Price))
|
||||||
@ -371,6 +388,7 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
|
|||||||
Num: option.Num,
|
Num: option.Num,
|
||||||
Symbol: option.Symbol,
|
Symbol: option.Symbol,
|
||||||
Price: fmt.Sprintf("%.2f", option.Price),
|
Price: fmt.Sprintf("%.2f", option.Price),
|
||||||
|
TotalPrice: fmt.Sprintf("%.2f", option.TotalPrice),
|
||||||
SaveAmount: saveAmount.StringFixed(2),
|
SaveAmount: saveAmount.StringFixed(2),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -416,7 +434,12 @@ func ValueAddServiceDetail(req *bundle.ValueAddServiceDetailRequest) (res *bundl
|
|||||||
original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
|
original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
|
||||||
price := decimal.NewFromFloat(float64(opt.Price))
|
price := decimal.NewFromFloat(float64(opt.Price))
|
||||||
num := decimal.NewFromInt(int64(opt.Num))
|
num := decimal.NewFromInt(int64(opt.Num))
|
||||||
|
totalPrice := decimal.NewFromFloat(float64(opt.TotalPrice))
|
||||||
|
if !totalPrice.IsZero() {
|
||||||
|
saveAmount = (original.Mul(num)).Sub(totalPrice)
|
||||||
|
} else {
|
||||||
saveAmount = original.Sub(price).Mul(num)
|
saveAmount = original.Sub(price).Mul(num)
|
||||||
|
}
|
||||||
case 2:
|
case 2:
|
||||||
//original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
|
//original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
|
||||||
//price := decimal.NewFromFloat(float64(opt.Price))
|
//price := decimal.NewFromFloat(float64(opt.Price))
|
||||||
@ -429,6 +452,7 @@ func ValueAddServiceDetail(req *bundle.ValueAddServiceDetailRequest) (res *bundl
|
|||||||
Num: opt.Num,
|
Num: opt.Num,
|
||||||
Symbol: opt.Symbol,
|
Symbol: opt.Symbol,
|
||||||
Price: fmt.Sprintf("%.2f", opt.Price),
|
Price: fmt.Sprintf("%.2f", opt.Price),
|
||||||
|
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
|
||||||
SaveAmount: saveAmount.StringFixed(2),
|
SaveAmount: saveAmount.StringFixed(2),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -499,7 +523,12 @@ func ValueAddServiceDetailByUuidAndLanguage(req *bundle.ValueAddServiceDetailReq
|
|||||||
original := decimal.NewFromFloat(float64(detail.OriginalPrice))
|
original := decimal.NewFromFloat(float64(detail.OriginalPrice))
|
||||||
price := decimal.NewFromFloat(float64(opt.Price))
|
price := decimal.NewFromFloat(float64(opt.Price))
|
||||||
num := decimal.NewFromInt(int64(opt.Num))
|
num := decimal.NewFromInt(int64(opt.Num))
|
||||||
|
totalPrice := decimal.NewFromFloat(float64(opt.TotalPrice))
|
||||||
|
if !totalPrice.IsZero() {
|
||||||
|
saveAmount = (original.Mul(num)).Sub(totalPrice)
|
||||||
|
} else {
|
||||||
saveAmount = original.Sub(price).Mul(num)
|
saveAmount = original.Sub(price).Mul(num)
|
||||||
|
}
|
||||||
case 2:
|
case 2:
|
||||||
//original := decimal.NewFromFloat(float64(detail.OriginalPrice))
|
//original := decimal.NewFromFloat(float64(detail.OriginalPrice))
|
||||||
//price := decimal.NewFromFloat(float64(opt.Price))
|
//price := decimal.NewFromFloat(float64(opt.Price))
|
||||||
@ -512,6 +541,7 @@ func ValueAddServiceDetailByUuidAndLanguage(req *bundle.ValueAddServiceDetailReq
|
|||||||
Num: opt.Num,
|
Num: opt.Num,
|
||||||
Symbol: opt.Symbol,
|
Symbol: opt.Symbol,
|
||||||
Price: fmt.Sprintf("%.2f", opt.Price),
|
Price: fmt.Sprintf("%.2f", opt.Price),
|
||||||
|
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
|
||||||
SaveAmount: saveAmount.StringFixed(2),
|
SaveAmount: saveAmount.StringFixed(2),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -586,7 +616,12 @@ func BatchGetValueAddServiceLang(req *bundle.BatchGetValueAddServiceLangRequest)
|
|||||||
original := decimal.NewFromFloat(float64(v.OriginalPrice))
|
original := decimal.NewFromFloat(float64(v.OriginalPrice))
|
||||||
price := decimal.NewFromFloat(float64(opt.Price))
|
price := decimal.NewFromFloat(float64(opt.Price))
|
||||||
num := decimal.NewFromInt(int64(opt.Num))
|
num := decimal.NewFromInt(int64(opt.Num))
|
||||||
|
totalPrice := decimal.NewFromFloat(float64(opt.TotalPrice))
|
||||||
|
if !totalPrice.IsZero() {
|
||||||
|
saveAmount = (original.Mul(num)).Sub(totalPrice)
|
||||||
|
} else {
|
||||||
saveAmount = original.Sub(price).Mul(num)
|
saveAmount = original.Sub(price).Mul(num)
|
||||||
|
}
|
||||||
case 2:
|
case 2:
|
||||||
//original := decimal.NewFromFloat(float64(v.OriginalPrice))
|
//original := decimal.NewFromFloat(float64(v.OriginalPrice))
|
||||||
//price := decimal.NewFromFloat(float64(opt.Price))
|
//price := decimal.NewFromFloat(float64(opt.Price))
|
||||||
@ -599,6 +634,7 @@ func BatchGetValueAddServiceLang(req *bundle.BatchGetValueAddServiceLangRequest)
|
|||||||
Num: opt.Num,
|
Num: opt.Num,
|
||||||
Symbol: opt.Symbol,
|
Symbol: opt.Symbol,
|
||||||
Price: fmt.Sprintf("%.2f", opt.Price),
|
Price: fmt.Sprintf("%.2f", opt.Price),
|
||||||
|
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
|
||||||
SaveAmount: saveAmount.StringFixed(2),
|
SaveAmount: saveAmount.StringFixed(2),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,7 @@ type CastWorkLog struct {
|
|||||||
ArtistUuid string `gorm:"column:artist_uuid;type:varchar(50);comment:艺人ID;NOT NULL" json:"artist_uuid"`
|
ArtistUuid string `gorm:"column:artist_uuid;type:varchar(50);comment:艺人ID;NOT NULL" json:"artist_uuid"`
|
||||||
MediaAccUserIds string `gorm:"column:media_acc_user_ids;type:json;comment:自媒体账号user_ids集合;NOT NULL" json:"media_acc_user_ids"`
|
MediaAccUserIds string `gorm:"column:media_acc_user_ids;type:json;comment:自媒体账号user_ids集合;NOT NULL" json:"media_acc_user_ids"`
|
||||||
MediaNames string `gorm:"column:media_names;type:varchar(600);comment:自媒体账号名称集合;NOT NULL" json:"media_names"`
|
MediaNames string `gorm:"column:media_names;type:varchar(600);comment:自媒体账号名称集合;NOT NULL" json:"media_names"`
|
||||||
|
CostType int `gorm:"column:cost_type;type:int(11)" json:"costType"`
|
||||||
ConfirmedAt int64 `gorm:"column:confirmed_at;type:int(11)" json:"confirmedAt"`
|
ConfirmedAt int64 `gorm:"column:confirmed_at;type:int(11)" json:"confirmedAt"`
|
||||||
CreatedAt int `gorm:"column:created_at;type:int(11)" json:"created_at"`
|
CreatedAt int `gorm:"column:created_at;type:int(11)" json:"created_at"`
|
||||||
UpdatedAt int `gorm:"column:updated_at;type:int(11)" json:"updated_at"`
|
UpdatedAt int `gorm:"column:updated_at;type:int(11)" json:"updated_at"`
|
||||||
@ -110,3 +111,8 @@ type CastWorkLog struct {
|
|||||||
func (m *CastWorkLog) TableName() string {
|
func (m *CastWorkLog) TableName() string {
|
||||||
return "cast_work_log"
|
return "cast_work_log"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CostLogPo struct {
|
||||||
|
CostLog
|
||||||
|
CostType int `gorm:"column:cost_type;type:int(11)" json:"costType"`
|
||||||
|
}
|
||||||
|
@ -51,7 +51,7 @@ type ValueAddServiceLang struct {
|
|||||||
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长"`
|
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长"`
|
||||||
PriceMode int32 `json:"priceMode" gorm:"column:price_mode;type:int;comment:套餐价格类型 1:单价 2:总价"`
|
PriceMode int32 `json:"priceMode" gorm:"column:price_mode;type:int;comment:套餐价格类型 1:单价 2:总价"`
|
||||||
OriginalPrice float32 `json:"originalPrice" gorm:"column:original_price;type:decimal(12,2);comment:原单价"`
|
OriginalPrice float32 `json:"originalPrice" gorm:"column:original_price;type:decimal(12,2);comment:原单价"`
|
||||||
TotalPrice float32 `json:"totalPrice" gorm:"column:total_price;type:decimal(12,2);comment:增值服务总价"`
|
TotalPrice float32 `json:"totalPrice" gorm:"column:total_price;type:decimal(12,2);comment:增值服务总价"` //总价模式不合理,该字段暂时无用
|
||||||
Unit string `json:"unit" gorm:"column:unit;type:varchar(50);comment:单位 1:个 2:条 3:天 4:月 5:年"`
|
Unit string `json:"unit" gorm:"column:unit;type:varchar(50);comment:单位 1:个 2:条 3:天 4:月 5:年"`
|
||||||
Language string `json:"language" gorm:"column:language;type:varchar(32);comment:套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)"`
|
Language string `json:"language" gorm:"column:language;type:varchar(32);comment:套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)"`
|
||||||
PriceType int64 `json:"priceType" gorm:"column:price_type;type:int;comment:币种 1:人民币 2:美元 3:日元 4:欧元"`
|
PriceType int64 `json:"priceType" gorm:"column:price_type;type:int;comment:币种 1:人民币 2:美元 3:日元 4:欧元"`
|
||||||
@ -78,6 +78,7 @@ type PriceOption struct {
|
|||||||
Num int32 `json:"num"`
|
Num int32 `json:"num"`
|
||||||
Symbol string `json:"symbol"` // 符号> < = >= <=
|
Symbol string `json:"symbol"` // 符号> < = >= <=
|
||||||
Price float32 `json:"price"` // 价格(根据priceMode决定是单价还是总价)
|
Price float32 `json:"price"` // 价格(根据priceMode决定是单价还是总价)
|
||||||
|
TotalPrice float32 `json:"totalPrice"` // 总价-新加
|
||||||
}
|
}
|
||||||
|
|
||||||
// 实现 driver.Valuer 接口
|
// 实现 driver.Valuer 接口
|
||||||
@ -150,6 +151,7 @@ func (m *ValueAddServiceHistory) TableName() string {
|
|||||||
func (options PriceOptions) CalculatePrice(priceMode, target int32) (float32, error) {
|
func (options PriceOptions) CalculatePrice(priceMode, target int32) (float32, error) {
|
||||||
for _, opt := range options {
|
for _, opt := range options {
|
||||||
match := false
|
match := false
|
||||||
|
last := false
|
||||||
switch opt.Symbol {
|
switch opt.Symbol {
|
||||||
case "=":
|
case "=":
|
||||||
match = target == opt.Num
|
match = target == opt.Num
|
||||||
@ -157,6 +159,7 @@ func (options PriceOptions) CalculatePrice(priceMode, target int32) (float32, er
|
|||||||
match = target > opt.Num
|
match = target > opt.Num
|
||||||
case ">=":
|
case ">=":
|
||||||
match = target >= opt.Num
|
match = target >= opt.Num
|
||||||
|
last = true
|
||||||
case "<":
|
case "<":
|
||||||
match = target < opt.Num
|
match = target < opt.Num
|
||||||
case "<=":
|
case "<=":
|
||||||
@ -168,6 +171,12 @@ func (options PriceOptions) CalculatePrice(priceMode, target int32) (float32, er
|
|||||||
if match {
|
if match {
|
||||||
switch priceMode { //1 单价模式
|
switch priceMode { //1 单价模式
|
||||||
case 1:
|
case 1:
|
||||||
|
if last {
|
||||||
|
return float32(target) * opt.Price, nil
|
||||||
|
}
|
||||||
|
if opt.TotalPrice > 0 {
|
||||||
|
return opt.TotalPrice, nil
|
||||||
|
}
|
||||||
return float32(target) * opt.Price, nil
|
return float32(target) * opt.Price, nil
|
||||||
case 2:
|
case 2:
|
||||||
return opt.Price, nil
|
return opt.Price, nil
|
||||||
|
@ -535,6 +535,7 @@ message ValueAddPriceOptions {
|
|||||||
string symbol = 3 [json_name = "symbol"];
|
string symbol = 3 [json_name = "symbol"];
|
||||||
string price = 4 [json_name = "price"];
|
string price = 4 [json_name = "price"];
|
||||||
string saveAmount = 5 [json_name = "saveAmount"];
|
string saveAmount = 5 [json_name = "saveAmount"];
|
||||||
|
string totalPrice = 6 [json_name = "totalPrice"];
|
||||||
|
|
||||||
}
|
}
|
||||||
//增值服务列表
|
//增值服务列表
|
||||||
@ -717,11 +718,12 @@ message GetUsedRecordListReq{
|
|||||||
string account = 3;
|
string account = 3;
|
||||||
int32 platform = 4;
|
int32 platform = 4;
|
||||||
int32 type = 5;
|
int32 type = 5;
|
||||||
string title = 6;
|
string workTitle = 6;
|
||||||
int64 submitTimeStart = 7;
|
int64 submitTimeStart = 7;
|
||||||
int64 submitTimeEnd = 8;
|
int64 submitTimeEnd = 8;
|
||||||
int32 page = 9;
|
int32 page = 9;
|
||||||
int32 pageSize = 10;
|
int32 pageSize = 10;
|
||||||
|
int32 costType = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetUsedRecordListResp {
|
message GetUsedRecordListResp {
|
||||||
@ -745,6 +747,7 @@ message WorkCastItem{
|
|||||||
string operatorName = 13; // 操作人名称
|
string operatorName = 13; // 操作人名称
|
||||||
string operatorPhone = 14; // 操作人手机号
|
string operatorPhone = 14; // 操作人手机号
|
||||||
uint32 status = 15; // 1 有效 2 失效
|
uint32 status = 15; // 1 有效 2 失效
|
||||||
|
uint32 costType = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetImageWorkDetailReq {
|
message GetImageWorkDetailReq {
|
||||||
@ -788,6 +791,7 @@ message workItem{
|
|||||||
int64 createdAt = 11; // 提交时间
|
int64 createdAt = 11; // 提交时间
|
||||||
string artistName = 12;
|
string artistName = 12;
|
||||||
string artistUuid = 13;
|
string artistUuid = 13;
|
||||||
|
uint32 costType = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ToBeComfirmedWorksResp{
|
message ToBeComfirmedWorksResp{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-triple v1.0.8
|
// - protoc-gen-go-triple v1.0.8
|
||||||
// - protoc v3.21.1
|
// - protoc v3.12.4
|
||||||
// source: pb/bundle.proto
|
// source: pb/bundle.proto
|
||||||
|
|
||||||
package bundle
|
package bundle
|
||||||
|
Loading…
Reference in New Issue
Block a user