Applogin ()
{
Web_set_max_html_param_len ("100000");
Web_add_auto_header ("AppKey", "f50c76fbc8271d361e1f6b5973f54585");
Web_add_auto_header ("ClientId", "2014022801010");
Web_add_auto_header ("AppVersion", "v0.5.01_0228");
Web_add_auto_header ("AppId", "mb-uzhsh-0000");
Web_add_auto_header ("Content-type", "application/json;charset=utf-8");
Web_add_auto_header ("FuncName", "Addbonuspoint");
Web_add_auto_header ("SysName", "SCRM-YXB");
Web_add_auto_header ("timestamp", "20180510113725");
Lr_start_transaction ("Step1-login");
Web_save_header (Request, "Requestheader");//request is a built-in variable that holds the requested header information and needs to be registered using
Web_save_header before sending a URL request (RESPONSE , "Responseheader");//Response Save the header information of the response
Web_reg_save_param ("Responsebody", "lb=", "rb=", "Search=body", last);
Web_reg_save_param ("RetCode", "Lb=\" retcode\ ": \" "," rb=\ ",", "Notfound=error", "Search=body", last);
Web_reg_save_param ("UserId", "lb=chiefuserid\": \ "", "rb=\", "," Notfound=error "," Search=body ", last);
Web_reg_save_param ("Accesstoken", "Lb=accesstoken:", "rb=\n", "Notfound=error", "Search=all", last);
Web_reg_save_param ("Sdtoken", "Lb=sdtoken:", "rb=\n", "Notfound=error", "Search=all", last);
Web_custom_request ("Web_custom_request",
"Url=http://210.51.17.150:7500/emuplus/secuag/security/userlogin",
"Method=post",
"Targetframe=",
"Resource=0",
"Referer=",
"Enctype=application/json",
"Body={\" sequenceid\ ": \" 20140305102633000001\ ", \" acctype\ ": 0,\" loginid\ ": \" 18109286803\ ", \" password\ ": \" 123456 !\ ", \" thirdpartyappid\ ": \" \ ", \" thirdpartyaccesstoken\ ": \" \ ", \" logintype\ ": \" 1\ "}",
last);
Character escapes, escaped UTF-8 format
Lr_convert_string_encoding (Lr_eval_string ("{requestheader}"), Lr_enc_utf8, Lr_enc_system_locale, " RequestHeaderUTF8 ");
Lr_convert_string_encoding (Lr_eval_string ("{responseheader}"), Lr_enc_utf8, Lr_enc_system_locale, " ResponseHeaderUTF8 ");
Lr_convert_string_encoding (Lr_eval_string ("{responsebody}"), Lr_enc_utf8, Lr_enc_system_locale, "ResponseBodyUTF8 ");
Output information
Lr_output_message ("# Request header information: \ n%s", lr_eval_string ("{RequestHeaderUTF8}"));
Lr_output_message ("# Response header:\n%s", lr_eval_string ("{ResponseHeaderUTF8}"));
Lr_output_message ("# Response body:\n%s", lr_eval_string ("{ResponseBodyUTF8}"));
if (strcmp (lr_eval_string ("{RetCode}"), "00000") ==0) {
Lr_output_message ("Login Successful");
}
else {
Lr_set_transaction_status (Lr_fail);
Lr_end_transaction ("Step1-login", Lr_auto);
return 0;
}
Lr_end_transaction ("Step1-login", Lr_auto);
Lr_start_transaction ("Step2-getsign");
Web_reg_save_param ("Responsebody", "lb=", "rb=", "Search=body", last);
Web_reg_save_param ("RetCode", "Lb=\" retcode\ ": \" "," rb=\ ",", "Notfound=error", "Search=body", last);
Web_reg_save_param ("sign", "lb=data\": \ "", "rb=\" "," Notfound=error "," Search=body ", last);
Web_custom_request ("Getaddresssign",
"Url=http://210.51.17.150:7500/emuplus/secuag/invite/getsigncode",
"Method=post",
"Targetframe=",
"Resource=0",
"Referer=",
"Enctype=application/json",
"Body={\" sdtoken\ ": \" {sdtoken}\ ", \" checkintegral\ ": \" 1\ ", \" id\ ": \" \ ", \" name\ ": \" Zhang 7\ ", \" phone\ ": \" 13259901209\ " , \ "province\": \ "hydropower \", \ "citycode\": \ "0298\", \ "city\": \ "received \", \ "areacode\": \ "120089\", \ "address\": \ "gold \", \ " Isdefault\ ": 1}",
last);
if (strcmp (lr_eval_string ("{RetCode}"), "00000") ==0) {
Lr_output_message ("Get sign Success");
Lr_convert_string_encoding (Lr_eval_string ("{responsebody}"), Lr_enc_utf8, Lr_enc_system_locale, "ResponseBodyUTF8 ");
Lr_output_message (Lr_eval_string ("{ResponseBodyUTF8}"));
}
else {
Lr_set_transaction_status (Lr_fail);
Lr_end_transaction ("Step1-login", Lr_auto);
return 0;
}
Lr_end_transaction ("Step2-getsign", Lr_auto);
Lr_start_transaction ("step3-addnewaddress");
Web_add_auto_header ("Sign", lr_eval_string ("{sign}"));
Web_add_auto_header ("Accesstoken", "tgt3150vb9mddkxf2encn6c9rvhmr0");
Web_save_header (RESPONSE, "Responseheader");//RESPONSE the header information to save the response
Web_reg_save_param ("Responsebody", "lb=", "rb=", "Search=body", last);
Web_save_header (REQUEST, "Requestheader");
Web_custom_request ("Getaddresssign",
"Url=http://210.51.17.150:7500/emuplus/user/{userid}/addr/v0.1/addaddr",
"Method=post",
"Targetframe=",
"Resource=0",
"Referer=",
"Enctype=application/json",
"Body={\" sdtoken\ ": \" {sdtoken}\ ", \" checkintegral\ ": \" 1\ ", \" id\ ": \" \ ", \" name\ ": \" Zhang 7\ ", \" phone\ ": \" 13259901209\ " , \ "province\": \ "hydropower \", \ "citycode\": \ "0298\", \ "city\": \ "received \", \ "areacode\": \ "120089\", \ "address\": \ "gold \", \ " Isdefault\ ": 1}",
last);
Lr_convert_string_encoding (Lr_eval_string ("{requestheader}"), Lr_enc_utf8, Lr_enc_system_locale, " RequestHeaderUTF8 ");
Lr_convert_string_encoding (Lr_eval_string ("{responsebody}"), Lr_enc_utf8, Lr_enc_system_locale, "ResponseBodyUTF8 ");
Lr_output_message (Lr_eval_string ("{ResponseBodyUTF8}"));
Lr_output_message (Lr_eval_string ("{RequestHeaderUTF8}"));
Lr_end_transaction ("Step3-addnewaddress", Lr_auto);
return 0;
}
HTTP Interface Authoring