deleteAttachment.lsc 1.93 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang 
    $Date: 2015-4-13 下午05:06:40  
    $Revision: 1.0  
    $Purpose: 
-->
<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, parameter = $ctx.parameter;
                result = {
                    head: {
                        message: " ",
                        code: $ctx.success ? 'success' : 'failure'
                    },
                    body: {}
                };
                delete_attachment_bm = new ModelService('app.deleteAttachment');
                param = {
                    "attachment_id": parameter.attachment_id
                };
                delete_attachment_bm.execute(param);
                // delete_attachment_bm.queryAsMap(param)
            
                /*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>