首页 技术 正文
技术 2022年11月19日
0 收藏 519 点赞 3,976 浏览 8600 个字

业务流程:
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文件放置脚本文件下后要,添加文件,操作如下图:

易捷支付完整业务流程的lr脚本编写

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

易捷支付完整业务流程的lr脚本编写

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,105
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,582
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,429
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,200
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,836
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,919