1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: wanghaitao
$Date: 2016-01-16 下午04:38:31
$Revision: 1.0
$Purpose: APP,
-->
<a:service xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
<a:init-procedure>
<s:server-script><![CDATA[
/**
*read me
*1.bm部分需改为相应系统的逻辑,此处逻辑为hr系统,仅供参考
*2.session、cookie部分不用修改,如果出现session、cookie方面的问题,可检查此处的session、cookie(如'/session/@session_id'是否有值)
*3.调试函数:println(Object);会将Object打印在控制台(如应用服务器tomcat的控制台)。例如:println($session.toXML());会将session对象以xml格式打印出来。
*/
try {
var result,
app_picture_bm,
app_picture_records,
app_picture_len;
result = {
head: {
message: " ",
code: $ctx.success ? 'success' : 'failure'
},
body: {
pics:[]
}
};
/* 图片数据 */
pics = result.body.pics;
app_picture_bm = new ModelService('price_app.app_picture');
app_picture_records = app_picture_bm.queryAsMap().getChildren();
app_picture_len = app_picture_records.length;
for(var i = 0;i < app_picture_len;i++){
pics.push({
"pic_code":app_picture_records[i].pic_code,
"app_picture":app_picture_records[i].app_picture
});
}
/*test*/
// result.head.message = model_len;
} catch (e) {
println(e);
} finally {
//执行finally代码,将result对象回写
// $ctx.parameter.json = JSON.stringify(result);
$ctx.parameter.json = JSON.stringify(result);
}
]]></s:server-script>
</a:init-procedure>
<a:service-output output="/parameter/@json"/>
</a:service>