feat: iot_card/device Store 新增 UpdateRealnamePolicy 方法

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-17 17:28:58 +08:00
parent 9a625f51ef
commit 89eec1406a
2 changed files with 14 additions and 0 deletions

View File

@@ -250,3 +250,10 @@ func (s *DeviceStore) UpdatePollingStatus(ctx context.Context, deviceID uint, en
Where("id = ?", deviceID).
Update("enable_polling", enablePolling).Error
}
// UpdateRealnamePolicy 更新设备的实名认证策略
func (s *DeviceStore) UpdateRealnamePolicy(ctx context.Context, deviceID uint, realnamePolicy string) error {
return s.db.WithContext(ctx).Model(&model.Device{}).
Where("id = ?", deviceID).
Update("realname_policy", realnamePolicy).Error
}

View File

@@ -124,6 +124,13 @@ func (s *IotCardStore) UpdatePollingStatus(ctx context.Context, cardID uint, ena
Update("enable_polling", enablePolling).Error
}
// UpdateRealnamePolicy 更新卡的实名认证策略
func (s *IotCardStore) UpdateRealnamePolicy(ctx context.Context, cardID uint, realnamePolicy string) error {
return s.db.WithContext(ctx).Model(&model.IotCard{}).
Where("id = ?", cardID).
Update("realname_policy", realnamePolicy).Error
}
func (s *IotCardStore) Delete(ctx context.Context, id uint) error {
return s.db.WithContext(ctx).Delete(&model.IotCard{}, id).Error
}