关键代码:
if(StringUtils.
isEmpty
(model.getUserid())){
//广播 发送全部用户
JPushHandler.
broadCast
(getConfigValue($R.ConfigKey.Jpush.
QFH_APP_KEY
),
getConfigValue($R.ConfigKey.Jpush.
QFH_MASTER_SECRET
),
model.getTitle(),
model.getContent());
}else{
//发送给单个用户
JPushHandler.
pushForOne
(getConfigValue($R.ConfigKey.Jpush.
QFH_APP_KEY
),
getConfigValue($R.ConfigKey.Jpush.
QFH_MASTER_SECRET
),
Convert.
toLong
(model.getUserid()),
model.getTitle(),
model.getContent());
}
注意: $R.ConfigKey.Jpush.
QFH_APP_KEY 是一个类中的变量
$R 类 :
public final static class
ConfigKey {
public final static class Jpush {
public final static String
QFH_APP_KEY
= "QFH_APP_KEY";//去发货app_key
public final static String
QFH_MASTER_SECRET
= "QFH_MASTER_SECRET";//去发货MASTER_SECRET
public final static String
EDS_APP_KEY
= "EDS_APP_KEY";//E贷收app_key
public final static String
EDS_MASTER_SECRET
= "EDS_MASTER_SECRET";//E贷收MASTER_SECRET
}