Files
iotlcm/server/internal/logic/warningnotify/preference.go
T
2026-10-29 14:36:49 +08:00

20 lines
573 B
Go

package warningnotify
import (
"context"
"fmt"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao"
)
func warningWechatEnabled(ctx context.Context, tenantID string, userID int64) (bool, error) {
var preference *struct {
Value string `orm:"config_value"`
}
err := dao.SysConfig.Ctx(ctx).Fields("config_value").Where("tenant_id", tenantID).
Where("config_key", fmt.Sprintf("app.wechat.warning.enabled.%d", userID)).OrderDesc("config_id").Scan(&preference)
if err != nil {
return false, err
}
return preference == nil || preference.Value == "1", nil
}