总结:
1.action()用到的参数可在inin()定义,须是lr_eval_string(),及lr_save_string()的类型;
2.中文作为参数的解决办法,及中文返回时乱码的翻译解决办法(
lr_convert_string_encoding);
vuser_init()
{
lr_convert_string_encoding("北京", //北京
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"bankCityName" );
lr_save_string(lr_eval_string("{bankCityName}"),"bankCityName_var");
lr_convert_string_encoding("中国工商银行", //中国工商银行
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"bankName" );
lr_save_string(lr_eval_string("{bankName}"),"bankName_var");
lr_convert_string_encoding("中国青年", //
中国青年
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"bankNameWhichNotInDic" );
lr_save_string(lr_eval_string("{bankNameWhichNotInDic}"),"bankNameWhichNotInDic_var");
lr_convert_string_encoding("红色", //
红色
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"invoceMailingAddress" );
lr_save_string(lr_eval_string("{invoceMailingAddress}"),"invoceMailingAddress_var");
lr_convert_string_encoding("方不在此列", //
方不在此列
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"settlementContact" );
lr_save_string(lr_eval_string("{settlementContact}"),"settlementContact_var");
lr_convert_string_encoding("约对旅行社", //
约对旅行社
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"settlementName" );
lr_save_string(lr_eval_string("{settlementName}"),"settlementName_var");
return 0;
}
char accountPayeeName_space [50];
Action()
{
lr_convert_string_encoding("缘故_", //
缘故1
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"accountPayeeName" );
sprintf(accountPayeeName_space,"%s%s",lr_eval_string("{accountPayeeName}"),lr_eval_string("{number}"));
lr_save_string(accountPayeeName_space,"accountPayeeName_var");
web_add_header("Content-Type","application/json;charset=UTF-8");
lr_start_transaction("xxxxxxx");
web_reg_save_param("error",
"LB=",
"RB=",
"NotFound=ERROR",
"Search=Body",
LAST);
web_reg_find("Search=Body",
"SaveCount=count",
"Text=\"retcode\":0",
LAST);
// web_custom_request("post_query.exe", "Method=POST",
// "URL=",xxx
// "Body={\"accountPayeeName\":\"{accountPayeeName_var}\",\"accountPayeeNumber\":\"xxxxx\",\"bankCityId\":\"xxxx\",\"bankCityName\":\"{bankCityName_var}\",\"bankId\":xxxx,\"bankName\":\"{bankName_var}\",\"bankNameWhichNotInDic\":\"{bankNameWhichNotInDic_var}\",\"bankProvinceId\":\"xxxx\",\"bankProvinceName\":\"{bankCityName_var}\",\"createUserId\":\"cn=xxx.xxx,cn=xxxxx,cn=xxxx,dc=xxx,dc=xxxx\",\"invoceMailingAddress\":\"{invoceMailingAddress_var}\",\"invoceMailingCityId\":\"xxxx\",\"invoceMailingCityName\":\"{bankCityName_var}\",\"invoceMailingProvinceId\":\"xxxx\",\"invoceMailingProvinceName\":\"{bankCityName_var}\",\"invoceTitle\":\"xxxx\",\"invoceType\":xxxx,\"noticeMobilePhone\":\"xxxxx\",\"postCode\":\"xxxxx\",\"remark\":\"\",\"settlementAccountType\":xxx,\"settlementContact\":\"{settlementContact_var}\",\"settlementContactPhone\":\"xxxx\",\"settlementEmail\":\"xxxx.xxx@xxx.xxx.comxxx",\"settlementName\":\"{settlementName_var}\",\"supplierId\":xxx,\"swiftCode\":\"\",\"updateUserId\":\"cn=xxxx,cn=xxx,cn=xxx,dc=xxxx,dc=xxxx\"}" ,
// LAST );
// web_custom_request("post_query.exe", "Method=POST",
// "URL=http:/xxxxx:8090/xxx/xxx",
// "Body={\"accountPayeeName\":\"{accountPayeeName_var}\",\"{accountPayeeName}\":\"xxxx\",\"bankCityId\":\"xxxx\",\"bankCityName\":\"{bankCityName_var}\",\"bankId\":xxx,\"bankName\":\"{bankName_var}\",\"bankNameWhichNotInDic\":\"{bankNameWhichNotInDic_var}\",\"bankProvinceId\":\"xxxxx\",\"bankProvinceName\":\"{bankCityName_var}\",\"createUserId\":\"cn=xxx.xxx,cn=xxx,cn=xxx,dc=xxx,dc=xxxx\",\"invoceMailingAddress\":\"{invoceMailingAddress_var}\",\"invoceMailingCityId\":\"xxx\",\"invoceMailingCityName\":\"{bankCityName_var}\",\"invoceMailingProvinceId\":\"xxxx\",\"invoceMailingProvinceName\":\"{bankCityName_var}\",\"invoceTitle\":\"xxxx\",\"invoceType\":xxx,\"noticeMobilePhone\":\"xxxxx\",\"postCode\":\"xxxx\",\"remark\":\"\",\"settlementAccountType\":xxxx,\"settlementContact\":\"{settlementContact_var}\",\"settlementContactPhone\":\"xxxxxx\",\"settlementEmail\":\"xxx.xxx@xxx.xxx.xxxx\",\"settlementName\":\"{settlementName_var}\",\"supplierId\":xxx,\"swiftCode\":\"\",\"updateUserId\":\"cn=xxx.xxx,cn=xxxx,cn=xxx,dc=xxxx,dc=xxxx\"}" ,
// LAST );
web_custom_request("post_query.exe", "Method=POST",
"URL=",
"Body={\"accountPayeeName\":\"{accountPayeeName_var}\",\"accountPayeeNumber\":\"xxxx\",\"bankCityId\":\"xxxx\",\"bankCityName\":\"{bankCityName_var}\",\"bankId\":xxxx,\"bankName\":\"{bankCityName_var}\",\"bankNameWhichNotInDic\":\"{bankNameWhichNotInDic_var}\",\"bankProvinceId\":\"xxx\",\"bankProvinceName\":\"{bankCityName_var}\",\"xxx\":\"cn=xxx.xxx,cn=xxx,cn=xxx,dc=xxx,dc=xxx\",\"invoceMailingAddress\":\"{invoceMailingAddress_var}\",\"invoceMailingCityId\":\"xxxx\",\"invoceMailingCityName\":\"{bankCityName_var}\",\"invoceMailingProvinceId\":\"xxxx\",\"invoceMailingProvinceName\":\"{bankCityName_var}\",\"invoceTitle\":\"elong\",\"invoceType\":xxxx,\"noticeMobilePhone\":\"xxx\",\"postCode\":\"xxxx\",\"remark\":\"\",\"settlementAccountType\":xxxx,\"settlementContact\":\"{settlementContact_var}\",\"settlementContactPhone\":\"xxx\",\"settlementEmail\":\"xxxx.xxx@xxx.xx.xxx\",\"settlementName\":\"{settlementName_var}\",\"supplierId\":{supploerID},\"swiftCode\":\"\",\"updateUserId\":\"cn=xxx.xxx,cn=xxx,cn=xxx,dc=xxx,dc=xxx\"}" ,
LAST );
if(atoi(lr_eval_string("{count}"))>0){
lr_end_transaction("xxxx", LR_PASS);
}else{
lr_end_transaction("xxxx", LR_FAIL);
lr_error_message("%s",lr_eval_string("{error}"));
}
// lr_save_string(lr_eval_string("{error}"))
//
// lr_convert_string_encoding("{\"retcode\":-100,\"retdesc\":\"中文乱码处,\"serverIp\":\"xxxxx\"}", //北京
//
// LR_ENC_UTF8,
// LR_ENC_SYSTEM_LOCALE,
// "test" );
//
// lr_error_message("%s",lr_eval_string("{test}"));
return 0;
}