-
Notifications
You must be signed in to change notification settings - Fork 77
Dinger 3.2 动态指定@群成员
Jaemon edited this page Oct 17, 2022
·
1 revision
public interface DemoDinger {
@DingerMarkdown(
value = "#### 用户登录通知\n - 用户Id: ${userId}\n - 用户名: ${userName}@13520201016@13520201017",
title = "用户登录反馈",
phones = {"13520201016", "13520201017"}
)
DingerResponse failed(long userId, String userName);
}
public interface DemoDinger {
@DingerMarkdown(
value = "#### 用户登录通知\n - 用户Id: ${userId}\n - 用户名: ${userName}",
title = "用户登录反馈"
)
DingerResponse failed(@DingerPhone List<String> phones, long userId, String userName);
}
- type默认值为: PhoneParamType.ARRAY
- 如果type值为PhoneParamType.ARRAY, 则方法参数类型必须定义为
List<String>
或者String[]
- 如果type值为PhoneParamType.STRING, 则方法参数类型必须定义为
String
,多个值用逗号','分隔
public interface DemoDinger {
// 参数类型为数组
DingerResponse failed(@DingerPhone String[] phones, long userId, String userName);
DingerResponse failed(@DingerPhone List<String> phones, long userId, String userName);
// 参数类型为字符串,多个号码用逗号隔开, EG: 13520201016,13520201017
DingerResponse failed(@DingerPhone(type = PhoneParamType.STRING) String phones, long userId, String userName);
}
- force默认为false
- 如果注解或XML配置里指定了phones信息, 则优先使用phones指定的值
- 如果DingerPhone中force属性定义为true, 则强制使用方法传入的参数ats的值
public interface DemoDinger {
// 此定义会强制使用注解中phones的值
@DingerMarkdown(
value = "#### 用户登录通知\n - 用户Id: ${userId}\n - 用户名: ${userName}",
title = "用户登录反馈",
phones = {"13520201016"}
)
DingerResponse success(@DingerPhone String[] ats, long userId, String userName);
// 此定义会强制使用ats参数的值
@DingerMarkdown(
value = "#### 用户登录通知\n - 用户Id: ${userId}\n - 用户名: ${userName}",
title = "用户登录反馈",
phones = {"13520201016"}
)
DingerResponse failed(@DingerPhone(force = true) String[] ats, long userId, String userName);
}