app_calc.lsc 1.86 KB
<?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_calc() {
                var app_calc_bm = $bm('app.app_calc');
                try {
                    app_calc_bm.update();
                    $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,
                    project_id: String($ctx.parameter.project_id),
                    pmt: String($ctx.parameter.pmt),
                    down_payment: String($ctx.parameter.down_payment),
                    finance_amount: String($ctx.parameter.finance_amount),
                    deposit: String($ctx.parameter.deposit),
                    lease_charge: String($ctx.parameter.lease_charge),
                    balloon: String($ctx.parameter.balloon),
                    times: String($ctx.parameter.times),
                    first_payment: String($ctx.parameter.first_payment)
                };
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
                app_calc();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>