|
@@ -25,7 +25,7 @@ type GlobalLimitRepository interface {
|
|
// 获取套餐Id
|
|
// 获取套餐Id
|
|
GetNodeArea(ctx context.Context, nodeAreaName string) (int64, error)
|
|
GetNodeArea(ctx context.Context, nodeAreaName string) (int64, error)
|
|
// 修改套餐状态
|
|
// 修改套餐状态
|
|
- EditHostState(ctx context.Context, hostId int64, state int) error
|
|
|
|
|
|
+ EditHostState(ctx context.Context, hostId int64, state bool) error
|
|
}
|
|
}
|
|
|
|
|
|
func NewGlobalLimitRepository(
|
|
func NewGlobalLimitRepository(
|
|
@@ -62,7 +62,7 @@ func (r *globalLimitRepository) UpdateGlobalLimitByHostId(ctx context.Context, r
|
|
|
|
|
|
func (r *globalLimitRepository) IsGlobalLimitExistByHostId(ctx context.Context, hostId int64) (bool, error) {
|
|
func (r *globalLimitRepository) IsGlobalLimitExistByHostId(ctx context.Context, hostId int64) (bool, error) {
|
|
var count int64
|
|
var count int64
|
|
- err := r.DB(ctx).Model(&model.GlobalLimit{}).Where("host_id = ? AND state = 1", hostId).Count(&count).Error
|
|
|
|
|
|
+ err := r.DB(ctx).Model(&model.GlobalLimit{}).Where("host_id = ? AND state = 0", hostId).Count(&count).Error
|
|
|
|
|
|
if err != nil {
|
|
if err != nil {
|
|
return false, err
|
|
return false, err
|
|
@@ -163,7 +163,7 @@ func (r *globalLimitRepository) GetNodeArea(ctx context.Context, nodeAreaName st
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-func (r *globalLimitRepository) EditHostState(ctx context.Context, hostId int64, state int) error {
|
|
|
|
|
|
+func (r *globalLimitRepository) EditHostState(ctx context.Context, hostId int64, state bool) error {
|
|
if err := r.DB(ctx).Model(&model.GlobalLimit{}).Where("host_id = ?", hostId).Update("state", state).Error; err != nil {
|
|
if err := r.DB(ctx).Model(&model.GlobalLimit{}).Where("host_id = ?", hostId).Update("state", state).Error; err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|