#ifndef _GLOBALS_H
#define _GLOBALS_H
//--------------------------------------------------------------------
// Include Files
#include "lrun.h"
#include "web_api.h"
#include "lrw_custom_body.h"
#include "Ptt_Mysql.h"
#define MYSQLSERVER "ip"
#define MYSQLUSERNAME "user"
#define MYSQLPASSWORD "pwd"
#define MYSQLDB "xin"
#define MYSQLPORT 3306
MYSQL *Mconn;
int rc;
//--------------------------------------------------------------------
// Global Variables
#endif // _GLOBALS_H
vuser_init()
{
rc = lr_load_dll("libmysql.dll");
if (rc != 0) {
lr_error_message("Could not load libmysql.dll");
lr_abort();
}
// 连接到MySQL数据库
Mconn = lr_mysql_connect(MYSQLSERVER, MYSQLUSERNAME, MYSQLPASSWORD, MYSQLDB, MYSQLPORT);
return 0;
}
{
lr_mysql_disconnect(Mconn);
return 0;
}
Action()
{
char *str;
char *old = "交易成功";
char *dengdai = "任务正在等待处理,请稍后~";
char *zhenxing = "查询未完成,请稍后~";
char *ycldd;
int i,j;
char chQuery[128];
mysql_query(Mconn,lr_eval_string("SET NAMES gbk")); //遇到中文字符乱码,在插入带中文字的数据前,增加了如下语句:
sprintf(chQuery, "select t.userid,t.bank_id,t.username from xin.webank_apply_data t where t.login_mobile=14725001445;");
lr_mysql_query(Mconn, chQuery);
lr_save_string(row[0][0].cell, "userid");
lr_save_string(row[1][0].cell, "bank_id");
lr_save_string(row[2][0].cell, "username");
lr_output_message(lr_eval_string("userid: {userid}; bank_id: {bank_id}; username:{username}"));
//[desc] =>
web_reg_save_param_ex(
"ParamName=yansi",
"LB=[desc] => ",
"RB=\n",
"Ordinal=1",
SEARCH_FILTERS,
LAST);
//验四
web_url("chouzhouyansi","URL=http://ip:3306/newCzCreditApply?user_ids={userid}",LAST);
str = lr_eval_string("{yansi}"); //取出关联字段与实际值做比较。
lr_output_message("关联字段: %s",str);
if(strcmp(str,old) == 0)
{
lr_think_time(5);
i:
web_reg_save_param_ex(
"ParamName=yuchuli",
"LB=[desc] => ",
"RB=\n",
"Ordinal=1",
SEARCH_FILTERS,
LAST);
ycldd = lr_eval_string("{yuchuli}");
//预处理
lr_output_message("预处理:%s","预处理");
lr_think_time(1);
web_url("chouzhouyuchuli","URL=http://ip:3306/newCzCreditQuery?user_ids={userid}",LAST);
lr_think_time(5);
if((strcmp(ycldd,dengdai) == 0) && (strcmp(ycldd,zhenxing) == 0))
{
lr_output_message("提示目前状态是: %s",lr_eval_string("{jiayichenggong}"));
return 0;
}
else
{
lr_output_message("这是显示结果:%s","eles中的语句");
lr_think_time(10);
web_reg_save_param_ex(
"ParamName=jiayichenggong",
"LB=[desc] => ",
"RB=\n",
"Ordinal=1",
SEARCH_FILTERS,
LAST);
web_url("chouzhouyuchuli","URL=http://ip:3306/newCzCreditQuery?user_ids={userid}",LAST);
ycldd = lr_eval_string("{jiayichenggong}");
if(strcmp(old,ycldd) == 0)
{
lr_output_message("交易成功");
lr_think_time(1);
}
else
{
goto i;
}
}
}
return 0;
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。