20 lines
573 B
Go
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
|
|
}
|