业务流程:
1、注册
2、登录
3、重置支付密码
4、下订单
5、支付订单
6、查看订单列表

通用md5.h代码如下:

 #ifndef MD5_H
#define MD5_H
#ifdef __alpha
typedef unsigned int uint32;
#else
typedef unsigned long uint32;
#endif
struct MD5Context {
uint32 buf[];
uint32 bits[];
unsigned char in[];
};
extern void MD5Init();
extern void MD5Update();
extern void MD5Final();
extern void MD5Transform();
typedef struct MD5Context MD5_CTX;
#endif
#ifdef sgi
#define HIGHFIRST
#endif
#ifdef sun
#define HIGHFIRST
#endif
#ifndef HIGHFIRST
#define byteReverse(buf, len) /* Nothing */
#else
void byteReverse(buf, longs)unsigned char *buf; unsigned longs;
{
uint32 t;
do {
t = (uint32) ((unsigned) buf[] << | buf[]) << |((unsigned) buf[] << | buf[]);
*(uint32 *) buf = t;
buf += ;
} while (--longs);
}
#endif
void MD5Init(ctx)struct MD5Context *ctx;
{
ctx->buf[] = 0x67452301;
ctx->buf[] = 0xefcdab89;
ctx->buf[] = 0x98badcfe;
ctx->buf[] = 0x10325476;
ctx->bits[] = ;
ctx->bits[] = ;
}
void MD5Update(ctx, buf, len) struct MD5Context *ctx; unsigned char *buf; unsigned len;
{
uint32 t;
t = ctx->bits[];
if ((ctx->bits[] = t + ((uint32) len << )) < t)
ctx->bits[]++;
ctx->bits[] += len >> ;
t = (t >> ) & 0x3f;
if (t) {
unsigned char *p = (unsigned char *) ctx->in + t;
t = - t;
if (len < t) {
memcpy(p, buf, len);
return;
}
memcpy(p, buf, t);
byteReverse(ctx->in, );
MD5Transform(ctx->buf, (uint32 *) ctx->in);
buf += t;
len -= t;
}
while (len >= ) {
memcpy(ctx->in, buf, );
byteReverse(ctx->in, );
MD5Transform(ctx->buf, (uint32 *) ctx->in);
buf += ;
len -= ;
}
memcpy(ctx->in, buf, len);
}
void MD5Final(digest, ctx)
unsigned char digest[]; struct MD5Context *ctx;
{
unsigned count;
unsigned char *p;
count = (ctx->bits[] >> ) & 0x3F;
p = ctx->in + count;
*p++ = 0x80;
count = - - count;
if (count < ) {
memset(p, , count);
byteReverse(ctx->in, );
MD5Transform(ctx->buf, (uint32 *) ctx->in);
memset(ctx->in, , );
} else {
memset(p, , count - );
}
byteReverse(ctx->in, );
((uint32 *) ctx->in)[] = ctx->bits[];
((uint32 *) ctx->in)[] = ctx->bits[];
MD5Transform(ctx->buf, (uint32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, );
memcpy(digest, ctx->buf, );
memset(ctx, , sizeof(ctx));
} #define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1(z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))
#define MD5STEP(f, w, x, y, z, data, s) ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
void MD5Transform(buf, in)
uint32 buf[]; uint32 in[];
{
register uint32 a, b, c, d;
a = buf[];
b = buf[];
c = buf[];
d = buf[];
MD5STEP(F1, a, b, c, d, in[] + 0xd76aa478, );
MD5STEP(F1, d, a, b, c, in[] + 0xe8c7b756, );
MD5STEP(F1, c, d, a, b, in[] + 0x242070db, );
MD5STEP(F1, b, c, d, a, in[] + 0xc1bdceee, );
MD5STEP(F1, a, b, c, d, in[] + 0xf57c0faf, );
MD5STEP(F1, d, a, b, c, in[] + 0x4787c62a, );
MD5STEP(F1, c, d, a, b, in[] + 0xa8304613, );
MD5STEP(F1, b, c, d, a, in[] + 0xfd469501, );
MD5STEP(F1, a, b, c, d, in[] + 0x698098d8, );
MD5STEP(F1, d, a, b, c, in[] + 0x8b44f7af, );
MD5STEP(F1, c, d, a, b, in[] + 0xffff5bb1, );
MD5STEP(F1, b, c, d, a, in[] + 0x895cd7be, );
MD5STEP(F1, a, b, c, d, in[] + 0x6b901122, );
MD5STEP(F1, d, a, b, c, in[] + 0xfd987193, );
MD5STEP(F1, c, d, a, b, in[] + 0xa679438e, );
MD5STEP(F1, b, c, d, a, in[] + 0x49b40821, );
MD5STEP(F2, a, b, c, d, in[] + 0xf61e2562, );
MD5STEP(F2, d, a, b, c, in[] + 0xc040b340, );
MD5STEP(F2, c, d, a, b, in[] + 0x265e5a51, );
MD5STEP(F2, b, c, d, a, in[] + 0xe9b6c7aa, );
MD5STEP(F2, a, b, c, d, in[] + 0xd62f105d, );
MD5STEP(F2, d, a, b, c, in[] + 0x02441453, );
MD5STEP(F2, c, d, a, b, in[] + 0xd8a1e681, );
MD5STEP(F2, b, c, d, a, in[] + 0xe7d3fbc8, );
MD5STEP(F2, a, b, c, d, in[] + 0x21e1cde6, );
MD5STEP(F2, d, a, b, c, in[] + 0xc33707d6, );
MD5STEP(F2, c, d, a, b, in[] + 0xf4d50d87, );
MD5STEP(F2, b, c, d, a, in[] + 0x455a14ed, );
MD5STEP(F2, a, b, c, d, in[] + 0xa9e3e905, );
MD5STEP(F2, d, a, b, c, in[] + 0xfcefa3f8, );
MD5STEP(F2, c, d, a, b, in[] + 0x676f02d9, );
MD5STEP(F2, b, c, d, a, in[] + 0x8d2a4c8a, );
MD5STEP(F3, a, b, c, d, in[] + 0xfffa3942, );
MD5STEP(F3, d, a, b, c, in[] + 0x8771f681, );
MD5STEP(F3, c, d, a, b, in[] + 0x6d9d6122, );
MD5STEP(F3, b, c, d, a, in[] + 0xfde5380c, );
MD5STEP(F3, a, b, c, d, in[] + 0xa4beea44, );
MD5STEP(F3, d, a, b, c, in[] + 0x4bdecfa9, );
MD5STEP(F3, c, d, a, b, in[] + 0xf6bb4b60, );
MD5STEP(F3, b, c, d, a, in[] + 0xbebfbc70, );
MD5STEP(F3, a, b, c, d, in[] + 0x289b7ec6, );
MD5STEP(F3, d, a, b, c, in[] + 0xeaa127fa, );
MD5STEP(F3, c, d, a, b, in[] + 0xd4ef3085, );
MD5STEP(F3, b, c, d, a, in[] + 0x04881d05, );
MD5STEP(F3, a, b, c, d, in[] + 0xd9d4d039, );
MD5STEP(F3, d, a, b, c, in[] + 0xe6db99e5, );
MD5STEP(F3, c, d, a, b, in[] + 0x1fa27cf8, );
MD5STEP(F3, b, c, d, a, in[] + 0xc4ac5665, );
MD5STEP(F4, a, b, c, d, in[] + 0xf4292244, );
MD5STEP(F4, d, a, b, c, in[] + 0x432aff97, );
MD5STEP(F4, c, d, a, b, in[] + 0xab9423a7, );
MD5STEP(F4, b, c, d, a, in[] + 0xfc93a039, );
MD5STEP(F4, a, b, c, d, in[] + 0x655b59c3, );
MD5STEP(F4, d, a, b, c, in[] + 0x8f0ccc92, );
MD5STEP(F4, c, d, a, b, in[] + 0xffeff47d, );
MD5STEP(F4, b, c, d, a, in[] + 0x85845dd1, );
MD5STEP(F4, a, b, c, d, in[] + 0x6fa87e4f, );
MD5STEP(F4, d, a, b, c, in[] + 0xfe2ce6e0, );
MD5STEP(F4, c, d, a, b, in[] + 0xa3014314, );
MD5STEP(F4, b, c, d, a, in[] + 0x4e0811a1, );
MD5STEP(F4, a, b, c, d, in[] + 0xf7537e82, );
MD5STEP(F4, d, a, b, c, in[] + 0xbd3af235, );
MD5STEP(F4, c, d, a, b, in[] + 0x2ad7d2bb, );
MD5STEP(F4, b, c, d, a, in[] + 0xeb86d391, );
buf[] += a;
buf[] += b;
buf[] += c;
buf[] += d;
}
char* CMd5(const char* s)
{
struct MD5Context md5c;
unsigned char ss[];
char subStr[],resStr[];
int i;
MD5Init( &md5c );
MD5Update( &md5c, s, strlen(s) );
MD5Final( ss, &md5c );
strcpy(resStr,"");
for( i=; i<; i++ )
{
sprintf(subStr, "%02x", ss[i] );
itoa(ss[i],subStr,);
if (strlen(subStr)==) {
strcat(resStr,"");
}
strcat(resStr,subStr);
}
strcat(resStr,"\0");
return resStr;
}

业务lr脚本如下:

 Action()
{ //================注册===========================
// web_custom_request("注册",
// "URL=http://192.168.145.130:8080/mobile/api/user/register",
// "Method=POST",
// "TargetFrame=",
// "Resource=0",
// "Referer=",
// "Mode=HTML",
// "EncType=application/json",
// "Body={\"mobile\":\"{mobile}\",\"password\":\"123456\",\"code\":\"3367\",\"platform\":\"windows\",\"username\":\"shon01\"}",
// LAST); //调用md5小写32位加密函数,将密码加密后赋值给paypassword
lr_save_string(CMd5(""),"paypassword"); web_reg_save_param_ex(
"ParamName=get_code",
"LB={\"code\":",
"RB=,\"msg\"",
SEARCH_FILTERS,
LAST);
web_reg_save_param_ex(
"ParamName=get_token",
"LB=\"token\":\"",
"RB=\",\"identity",
SEARCH_FILTERS,
LAST);
//=====================登录=====================
web_custom_request("登录",
"URL=http://192.168.145.130:8080/mobile/api/user/login",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTML",
"EncType=application/json",
"Body={\"mobile\":\"18705092505\",\"password\":\"123456\"}",
LAST);
lr_error_message("用户登录成功!%s",lr_eval_string("{get_code}"));
lr_error_message("token:%s",lr_eval_string("{get_token}")); web_reg_save_param_ex(
"ParamName=get_payId",
"LB=payId\":\"",
"RB=\",\"orders",
SEARCH_FILTERS,
LAST);
web_reg_save_param_ex(
"ParamName=value01",
"LB=,\"msg\":\"",
"RB=,\"data",
SEARCH_FILTERS,
LAST);
//中文请求参数转换
lr_convert_string_encoding( "我是肖恩",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8, "str" );
lr_save_string(lr_eval_string("{str}"),"strvalue");
//====================下订单==============================
web_custom_request("下订单",
"URL=http://192.168.145.130:8080/mobile/api/order/addorder",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTML",
"EncType=application/json",
"Body={\"token\":\"{get_token}\",\"getAddrId\":1,\"getCarId\":23,\"payType\":2,\"remark\":\"{strvalue}\",\"price\":88,\"orders\":[{\"getTime\":\"1450921104000\",\"goodss\":[{\"goodsId\":93,\"count\":1},{\"goodsId\":96,\"count\":1}]}],\"invoiceTitle\":\"fapiao\"}",
LAST);
//响应乱码转换
lr_convert_string_encoding(lr_eval_string("{value01}"), LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"BM");
lr_error_message(lr_eval_string("{BM}"));
lr_error_message("payId:%s",lr_eval_string("{get_payId}")); web_reg_save_param_ex(
"ParamName=value03",
"LB=,\"msg\":\"",
"RB=,\"data",
SEARCH_FILTERS,
LAST); //================重置密码========================重置一次之后就不需要再重置了
/*web_custom_request("重置密码",
"URL=http://192.168.145.130:8080/mobile/api/user/resetpaypwd",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTML",
"EncType=application/json",
"Body={\"token\":\"{get_token}\",\"password\":\"{paypassword}\"}",
LAST);
lr_convert_string_encoding(lr_eval_string("{value03}"), LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"chong");
lr_error_message(lr_eval_string("{chong}"));
lr_error_message(lr_eval_string("{paypassword}")); */ web_reg_save_param_ex(
"ParamName=value02",
"LB=,\"msg\":\"",
"RB=,\"data",
SEARCH_FILTERS,
LAST);
//=================支付订单============================
web_custom_request("支付订单",
"URL=http://192.168.145.130:8080/mobile/api/pay/pay",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTML",
"EncType=application/json",
"Body={\"token\":\"{get_token}\",\"payId\":\"{get_payId}\",\"payPwd\":\"{paypassword}\",\"platform\":3}",
LAST);
lr_convert_string_encoding(lr_eval_string("{value02}"), LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"msg");
lr_error_message(lr_eval_string("{msg}")); lr_save_string(lr_eval_string("{get_token}"),"url_token");
//将文本格式的token转换成url的
web_convert_param("url_token", "SourceEncoding=PLAIN",
"TargetEncoding=URL", LAST ); //=====================查看订单列表========================
web_custom_request("查看订单列表",
"URL=http://192.168.145.130:8080/mobile/api/order/getorders?token={url_token}&offset=0&size=15",
"Method=GET",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTML",
"EncType=application/json",
"Body=",
LAST);
return ;
}

注意:

1、将md5文件放置脚本文件下后要,添加文件,操作如下图:

2、添加md5.h文件之后,在globals.h文件里面要输入#include "md5.h" 引入,如图:

易捷支付完整业务流程的lr脚本编写的更多相关文章

  1. LR脚本编写时的几个小技巧

    参数化空值 如上图所示,当参数化时某个值需要为空值(非空格),直接在参数化文件中空一行/格即可,虽然Parameter List界面上没有显示空的那一行,但并不影响取值. 手工日志跟踪 lr_set_ ...

  2. loadrunner学习系列---脚本编写(2)

    loadrunner学习系列---脚本编写(2) 今天接着翻译http://www.wilsonmar.com/1lrscrīpt.htm上面关于LR脚本编写部分. VUser_Init部分 这里是V ...

  3. 【Java EE 学习 21 下】【 使用易宝支付接口实现java网上支付功能】

    一.网上支付分为两种情况,一种方法是使用直接和银行的支付接口,另外一种方法是使用第三方支付平台和银行对接完成支付. 1.直接和银行对接. 2.使用第三方支付平台 3.常见的第三方支付平台 二.使用易宝 ...

  4. 易宝支付Demo,生产中封装成简洁的代付接口,不用request如何获取项目运行时的真实路径

    最近项目在做融360引流,涉及到了易宝支付的代扣和代付.易宝官方给出的demo只能简单运行,而且都是通过form表单的形式提交,返回XML格式.同时接口代码都写在了JSP中看起来不友好.项目在生成中想 ...

  5. 自动生成LR脚本且运行

    背景:作为一个测试,特别是性能测试,尤其在活动的测试,时间紧,有很多要测的,我们的LR11因为浏览器兼容问题全录制不了脚本了,用浏览器加代理或手机加代理录制,我感觉好麻烦 ,所以就想如果能用脚本把所有 ...

  6. 易汇金在线支付接口实例。ecshop和shopex,shopnc,iwebshop下完美无错(最新)

    最近为客户的一个在线商城做了一个易汇金在线支付的接口.跟大家分享一下. 1 首先可以模仿其他的接口,比如支付宝,财付通等的接口,构建模块功能文件和语言文件. 功能模块构建: /includes/mod ...

  7. java实现将指定文件夹里所有文件路径输出到指定文件作为参数化文件给lr脚本使用

    java实现将指定文件夹里所有文件路径输出到指定文件作为参数化文件给lr脚本使用 import java.io.BufferedReader; import java.io.BufferedWrite ...

  8. 【SSH网上商城项目实战21】从Demo中看易宝支付的流程

         转自: https://blog.csdn.net/eson_15/article/details/51447492 这一节我们先写一个简单点的Demo来测试易宝支付的流程,熟悉这个流程后, ...

  9. 开发自己的网上支付案例代码(易宝支付php)

    1.简单的图解(如上所示) 易宝支付与支付宝是不一样的,但也有类似之处,支付宝是专门为淘宝软件开发的一套机制,资金会在中间支付公司(支付宝)停留,等待顾客确认,当顾客确认后,才会真正扣钱.而易宝支付时 ...

随机推荐

  1. “北航学堂”M2阶段postmortem

    “北航学堂”M2阶段postmortem 设想和目标 1. 我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有清晰的描述? 这个问题我们在M1阶段的时候就已经探讨的比较明确了,就是 ...

  2. 关于在VB.NET中调用使用VC++编写的类库dll的一点笔记

    前言 结对作业要求一出来,我就立刻想到了把“计算核心”封装成dll,然后使用vb.net编写UI调用dll的思路.然而在实现过程中却遇到了很多的问题. 我在这个过程中是负责使用vb.net编写UI并调 ...

  3. 《Linux内核分析》课程第七周学习总结

    姓名:何伟钦 学号:20135223 ( *原创作品转载请注明出处*) ( 学习课程:<Linux内核分析>MOOC课程http://mooc.study.163.com/course/U ...

  4. github链接

    github链接:https://github.com/bjing123     test1:https://github.com/bjing123/test-/blob/master/test1.t ...

  5. MSA微服务

    https://github.com/das2017?tab=repositories https://github.com/icsharpcode/ILSpy/releases LayerDemo ...

  6. HTML 页面的 批量删除的按钮

    function delAll(){ var sid=""; $("[name='ids']:checked").each(function(){ sid+=$ ...

  7. Activiti解析.bpmn文件获得User Task节点的CandidateUsers特性的值

    参考文档: http://www.cnblogs.com/mingforyou/p/5351332.html http://blog.csdn.net/jackyrongvip/article/det ...

  8. 简单对比一下不同Windows操作系统在相同硬件配置的情况下浏览器js引擎的性能

    最近部门进行Windows客户端的测试产品单点性能, 感觉不在通的windows版本以及浏览器内核的情况下性能可能有差异, 也一直没有找到一个比较好的对比工具, 今天用chrome的控制台简单测试了下 ...

  9. cmd常用

    npm install -g npm              npm就自动为我们更新到最新版本 npm install -g cnpm --registry=https://registry.npm ...

  10. 小项目分析之C++ 实现模拟银行排队

      一.问题定义与分析 问题定义 •要解决的问题——银行一天之内的: 1.总客户数 2.客户总逗留时间 3.客户平均逗留时间 问题分析 •新来的人找个短的队伍,站在队尾开始排队 •排在队头的人可以办理 ...