app_delete_attment.lsc 1.7 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
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
    <a:init-procedure>
        <s:server-script import="app/app_login_check.js"><![CDATA[
            function app_prj_atm_delete() {
                var app_prj_atm_delete_bm = $bm('app.attachment.app_cdd_atm_delete');
                var root = $ctx.parameter;
                var cdd_atm_array = root.getChild('picturelist').getChildren();
                try {
                    for (var i = 0;i < cdd_atm_array.length;i++) {
                        var cdd_atm = cdd_atm_array[i];
                        app_prj_atm_delete_bm.update({
                            attachment_id: cdd_atm.attachment_id
                        });
                    }
                    $ctx.parameter.return_status = 'S';
                    $ctx.parameter.return_message = '删除成功';
                } catch (e) {
                    $ctx.success = "true";
                    $ctx.parameter.return_status = 'E';
                    $ctx.parameter.return_message = $ctx.get('/error/@message') || String(e);
                }
                var result = {
                    result: $ctx.parameter.return_status,
                    message: $ctx.parameter.return_message
                };
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
                app_prj_atm_delete();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>