<?xml version="1.0" encoding="UTF-8"?> <a:service 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><![CDATA[ importPackage(Packages.java.util); importPackage(Packages.com.hand.hls.hlcm.emay); importPackage(Packages.com.hand.hap.system.dto); //step2 发送短信 function sendsms() { // 查询待发送短信表 var contract_collection = $bm('sys.SYS420.reminder_sms_list'); contract_collection.update(); var sms_list_bm = $bm('sys.SYS420.reminder_sms_loop'); println($ctx.parameter.batch_id); var sms_list_result = sms_list_bm.queryAsMap({ "batch_id": $ctx.parameter.batch_id }); var sms_list_records = sms_list_result.getChildren(); for (var i = 0; i < sms_list_records.length; i++) { println(1); var Phones = sms_list_records[i].phone_number; var content = sms_list_records[i].text; var sms_id = sms_list_records[i].sms_id; try { var example = new Example(); var result = example.setSingleSms(content, Phones); var req_response = result.toString(); } catch (e) { println("抛出异常:" + e); } //发送后请求更新 $bm('sys.SYS420.reminder_sms_loop').update({ sms_id: sms_id, result: req_response }); } } sendsms(); ]]></s:server-script> </a:init-procedure> <a:service-output output="/parameter"/> </a:service>