<?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 bp_master_save() {
                var root = $ctx.parameter;
                var bp_master_list = root.getChild('financing_info');  //获取前台数据
                
                var bp_master_save_bm = $bm('app.financing_due.financing_cate');  //获取过程
                try {
                    bp_master_list.user_id = root.user_id;
                   
                    bp_master_save_bm.update(bp_master_list);
                    
                    
                    $ctx.parameter.return_status = 'S';
                    $ctx.parameter.return_message = '保存成功';
                    $ctx.parameter.json = JSON.stringify(result);
                } 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,
                    financing_info: []
                };
                var financing_info = result.financing_info;
                financing_info.push({
                    "calc_session_id": bp_master_list.calc_session_id
                });
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
                bp_master_save();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>