From 89eec1406abb72332864813764e68aab40f88871 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 17 Apr 2026 17:28:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20iot=5Fcard/device=20Store=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20UpdateRealnamePolicy=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- internal/store/postgres/device_store.go | 7 +++++++ internal/store/postgres/iot_card_store.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/internal/store/postgres/device_store.go b/internal/store/postgres/device_store.go index 3f6001d..c911414 100644 --- a/internal/store/postgres/device_store.go +++ b/internal/store/postgres/device_store.go @@ -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 +} diff --git a/internal/store/postgres/iot_card_store.go b/internal/store/postgres/iot_card_store.go index 7967052..06bd027 100644 --- a/internal/store/postgres/iot_card_store.go +++ b/internal/store/postgres/iot_card_store.go @@ -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 }