mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): support distinct sku by name
This commit is contained in:
@@ -83,6 +83,9 @@ type ServerSkuListInput struct {
|
||||
|
||||
// 预付费状态
|
||||
PrepaidStatus string `json:"prepaid_status"`
|
||||
|
||||
// 按套餐名称去重
|
||||
Distinct bool `json:"distinct"`
|
||||
}
|
||||
|
||||
type ElasticcacheSkuListInput struct {
|
||||
|
||||
@@ -725,6 +725,10 @@ func (manager *SServerSkuManager) ListItemFilter(
|
||||
}
|
||||
}
|
||||
|
||||
if query.Distinct {
|
||||
q = q.GroupBy(q.Field("name"))
|
||||
}
|
||||
|
||||
brands := query.Brands
|
||||
if len(brands) > 0 {
|
||||
q = q.Filter(sqlchemy.In(q.Field("brand"), brands))
|
||||
|
||||
@@ -28,6 +28,7 @@ type ServerSkusListOptions struct {
|
||||
PostpaidStatus string `help:"Postpaid status" choices:"soldout|available"`
|
||||
PrepaidStatus string `help:"Prepaid status" choices:"soldout|available"`
|
||||
Enabled *bool `help:"Filter enabled skus"`
|
||||
Distinct bool `help:"distinct sku by name"`
|
||||
}
|
||||
|
||||
func (opts *ServerSkusListOptions) GetId() string {
|
||||
|
||||
Reference in New Issue
Block a user