Update code
This commit is contained in:
parent
2b6425c88f
commit
1b947cecd2
65
main.cpp
65
main.cpp
@ -11,9 +11,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include <cpplib/cpplib#time>
|
#include "NetworkWrapper.h"
|
||||||
#include <conio.h>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int parseValue(string Filename,double& val,double& val2)
|
int parseValue(string Filename,double& val,double& val2)
|
||||||
@ -74,7 +72,13 @@ cashinfo LocalParse(int id)
|
|||||||
|
|
||||||
void prepareCookie()
|
void prepareCookie()
|
||||||
{
|
{
|
||||||
system(R"(curl -s "life.ccb.com/tran/WCCMainPlatV5?CCB_IBSVersion=V5&SERVLET_NAME=WCCMainPlatV5&TXCODE=100119&USERID=&SKEY=" --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1" -c temp/cookie1.txt > temp/step1.txt)");
|
HTTPConnection c;
|
||||||
|
c.setUserAgent("Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1");
|
||||||
|
c.setURL("life.ccb.com/tran/WCCMainPlatV5?CCB_IBSVersion=V5&SERVLET_NAME=WCCMainPlatV5&TXCODE=100119&USERID=&SKEY=");
|
||||||
|
c.setCookieOutputFile("temp/cookie1.txt");
|
||||||
|
c.setVerbos(true);
|
||||||
|
|
||||||
|
c.perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _fetched_cookie=false;
|
bool _fetched_cookie=false;
|
||||||
@ -90,18 +94,21 @@ void BeginNetwork()
|
|||||||
|
|
||||||
void RunCommand(string stuNumber,string outputFilename)
|
void RunCommand(string stuNumber,string outputFilename)
|
||||||
{
|
{
|
||||||
string cmd=R"(curl -s "life.ccb.com/tran/WCCMainPlatV5?CCB_IBSVersion=V5&SERVLET_NAME=WCCMainPlatV5&isAjaxRequest=true&TXCODE=JF1103&OPUN_COD=370200&MERCHANT=#STUCODE#100010&COMM=#STUCODE#&BANK_COD=370000&BIll_CODE=100010&PAY_TYPE=11&BILL_FLAG=0&BIll_MERCHANT=600007&BANK_NAME=%E5%B1%B1%E4%B8%9C%E7%9C%81&OPUN_NAME=%E9%9D%92%E5%B2%9B%E5%B8%82&MERCHANT_NAME=%E9%9D%92%E5%B2%9B%E7%A7%91%E6%8A%80%E5%A4%A7%E5%AD%A6%E6%A0%A1%E5%9B%AD%E5%8D%A1%E5%85%85%E5%80%BC&BILL_TYPE=2&BRAN_NO=371000000&BILL_ITEM=01013&BILL_NAME=IC%E5%8D%A1%E3%80%81%E8%81%94%E5%90%8D%E5%8D%A1%E5%85%85%E5%80%BC&RE1CON=&RE2CON=" --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1" -b "temp/cookie1.txt" > )" ;
|
HTTPConnection c;
|
||||||
|
c.setUserAgent("Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1");
|
||||||
|
c.setCookieInputFile("temp/cookie1.txt");
|
||||||
|
c.setDataOutputFile(outputFilename);
|
||||||
|
|
||||||
string target="#STUCODE#";
|
string url = "life.ccb.com/tran/WCCMainPlatV5?CCB_IBSVersion=V5&SERVLET_NAME=WCCMainPlatV5&isAjaxRequest=true&TXCODE=JF1103&OPUN_COD=370200&MERCHANT=#STUCODE#100010&COMM=#STUCODE#&BANK_COD=370000&BIll_CODE=100010&PAY_TYPE=11&BILL_FLAG=0&BIll_MERCHANT=600007&BANK_NAME=%E5%B1%B1%E4%B8%9C%E7%9C%81&OPUN_NAME=%E9%9D%92%E5%B2%9B%E5%B8%82&MERCHANT_NAME=%E9%9D%92%E5%B2%9B%E7%A7%91%E6%8A%80%E5%A4%A7%E5%AD%A6%E6%A0%A1%E5%9B%AD%E5%8D%A1%E5%85%85%E5%80%BC&BILL_TYPE=2&BRAN_NO=371000000&BILL_ITEM=01013&BILL_NAME=IC%E5%8D%A1%E3%80%81%E8%81%94%E5%90%8D%E5%8D%A1%E5%85%85%E5%80%BC&RE1CON=&RE2CON=";
|
||||||
|
string target="#STUCODE#";
|
||||||
|
|
||||||
while( cmd.find(target)!= string::npos )
|
while( url.find(target)!= string::npos )
|
||||||
{
|
{
|
||||||
cmd=cmd.replace(cmd.find(target),target.size(),stuNumber);
|
url = url.replace(url.find(target),target.size(),stuNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.append(outputFilename);
|
c.setURL(url);
|
||||||
|
c.perform();
|
||||||
system(cmd.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteQuery(string PreCode,int ID)
|
void RemoteQuery(string PreCode,int ID)
|
||||||
@ -130,12 +137,6 @@ int _beginnum=0;
|
|||||||
const int& BEGIN_NUM = _beginnum;
|
const int& BEGIN_NUM = _beginnum;
|
||||||
bool _begin_after_singlemode = false;
|
bool _begin_after_singlemode = false;
|
||||||
|
|
||||||
|
|
||||||
void _ClearKbhit()
|
|
||||||
{
|
|
||||||
while(kbhit()) getch();
|
|
||||||
}
|
|
||||||
|
|
||||||
int ParseCommand(string Command)
|
int ParseCommand(string Command)
|
||||||
{
|
{
|
||||||
istringstream istr(Command);
|
istringstream istr(Command);
|
||||||
@ -292,7 +293,6 @@ int ParseCommand(string Command)
|
|||||||
void SingleModeMain()
|
void SingleModeMain()
|
||||||
{
|
{
|
||||||
printf("已进入特殊模式.\n");
|
printf("已进入特殊模式.\n");
|
||||||
_ClearKbhit();
|
|
||||||
printf("键入指令以实现功能\n");
|
printf("键入指令以实现功能\n");
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
@ -312,22 +312,15 @@ bool EnterSingleMode()
|
|||||||
int interval=50;/// ms
|
int interval=50;/// ms
|
||||||
int looptime=3000/interval;
|
int looptime=3000/interval;
|
||||||
|
|
||||||
for(int i=0;i<looptime;i++)
|
printf("输入任何内容以进入特殊模式. 按下回车进入自动模式.\n");
|
||||||
{
|
string str;
|
||||||
if((looptime-i)*interval/1000!=lastval)
|
getline(cin, str);
|
||||||
{
|
if (!str.empty())
|
||||||
lastval=(looptime-i)*interval/1000;
|
{
|
||||||
printf("按下任何按键来中断常规启动. %d秒后将进入自动模式.\n",lastval);
|
SingleModeMain();
|
||||||
}
|
return true;
|
||||||
if(kbhit())
|
}
|
||||||
{
|
return false;
|
||||||
SingleModeMain();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
this_thread::sleep_for(chrono::milliseconds(interval));
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _out_file_targeted=false;
|
bool _out_file_targeted=false;
|
||||||
@ -446,9 +439,9 @@ int main(int argc,char* argv[])
|
|||||||
///未指定文件名称(交互式)
|
///未指定文件名称(交互式)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s_time now=whattime();
|
time_t stamp = time(NULL);
|
||||||
char gpbuff[1024];
|
char gpbuff[1024];
|
||||||
sprintf(gpbuff,"-%04d%02d%02d-%02d%02d%02d",now.year,now.mon,now.day,now.hour,now.min,now.sec);
|
sprintf(gpbuff, "%ld", stamp);
|
||||||
printf("请输入保存文件名称,时间将会自动追加到结尾,后缀名为txt\n");
|
printf("请输入保存文件名称,时间将会自动追加到结尾,后缀名为txt\n");
|
||||||
getline(cin,fname);
|
getline(cin,fname);
|
||||||
fname=string("result/")+fname;
|
fname=string("result/")+fname;
|
||||||
|
Reference in New Issue
Block a user