我必须在Groovy中创建这个JSON文件.我尝试了很多东西(JsonOutput.toJson()/ JsonSlurper.parseText())但没有成功.
{
"attachments":[
{
"fallback":"New open task [Urgent]: <http://url_to_task|Test out Slack message attachments>",
"pretext":"New open task [Urgent]: <http://url_to_task|Test out Slack message attachments>",
"color":"#D00000",
"fields":[
{
"title":"Notes",
"value":"This is much easier than I thought it would be.",
"short":false
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是为了向Slack发布Jenkins构建消息.
例如,我有一个EFQ请求,如:
$query ->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'contenttype')
->propertyCondition('status', 1)
->propertyCondition('language', $language->language, '=')
->fieldOrderBy('field_date', 'value', 'DESC')
->fieldOrderBy('field_code', 'value', 'DESC')
Run Code Online (Sandbox Code Playgroud)
可以field_code为空.当我按此字段排序时,它将排除所有获得空值的行.如何避免这种行为并让他们留在结果中?