Update code
This commit is contained in:
parent
2b6425c88f
commit
1b947cecd2
65
main.cpp
65
main.cpp
@ -11,9 +11,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include <cpplib/cpplib#time>
|
||||
#include <conio.h>
|
||||
|
||||
#include "NetworkWrapper.h"
|
||||
using namespace std;
|
||||
|
||||
int parseValue(string Filename,double& val,double& val2)
|
||||
@ -74,7 +72,13 @@ cashinfo LocalParse(int id)
|
||||
|
||||
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;
|
||||
@ -90,18 +94,21 @@ void BeginNetwork()
|
||||
|
||||
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);
|
||||
|
||||
system(cmd.c_str());
|
||||
c.setURL(url);
|
||||
c.perform();
|
||||
}
|
||||
|
||||
void RemoteQuery(string PreCode,int ID)
|
||||
@ -130,12 +137,6 @@ int _beginnum=0;
|
||||
const int& BEGIN_NUM = _beginnum;
|
||||
bool _begin_after_singlemode = false;
|
||||
|
||||
|
||||
void _ClearKbhit()
|
||||
{
|
||||
while(kbhit()) getch();
|
||||
}
|
||||
|
||||
int ParseCommand(string Command)
|
||||
{
|
||||
istringstream istr(Command);
|
||||
@ -292,7 +293,6 @@ int ParseCommand(string Command)
|
||||
void SingleModeMain()
|
||||
{
|
||||
printf("已进入特殊模式.\n");
|
||||
_ClearKbhit();
|
||||
printf("键入指令以实现功能\n");
|
||||
while(1)
|
||||
{
|
||||
@ -312,22 +312,15 @@ bool EnterSingleMode()
|
||||
int interval=50;/// ms
|
||||
int looptime=3000/interval;
|
||||
|
||||
for(int i=0;i<looptime;i++)
|
||||
{
|
||||
if((looptime-i)*interval/1000!=lastval)
|
||||
{
|
||||
lastval=(looptime-i)*interval/1000;
|
||||
printf("按下任何按键来中断常规启动. %d秒后将进入自动模式.\n",lastval);
|
||||
}
|
||||
if(kbhit())
|
||||
{
|
||||
SingleModeMain();
|
||||
return true;
|
||||
}
|
||||
this_thread::sleep_for(chrono::milliseconds(interval));
|
||||
}
|
||||
|
||||
return false;
|
||||
printf("输入任何内容以进入特殊模式. 按下回车进入自动模式.\n");
|
||||
string str;
|
||||
getline(cin, str);
|
||||
if (!str.empty())
|
||||
{
|
||||
SingleModeMain();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool _out_file_targeted=false;
|
||||
@ -446,9 +439,9 @@ int main(int argc,char* argv[])
|
||||
///未指定文件名称(交互式)
|
||||
else
|
||||
{
|
||||
s_time now=whattime();
|
||||
time_t stamp = time(NULL);
|
||||
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");
|
||||
getline(cin,fname);
|
||||
fname=string("result/")+fname;
|
||||
|
Reference in New Issue
Block a user