Commit 555873e4a504ed4fded4bd43aeaa2ed2c8a05fbb
1 parent
4235f957
feat(etrade_card_client):修改右下角时间控件
修改时间控件,在服务器获取不到当前时间时,获取当前系统时间。
Showing
9 changed files
with
27 additions
and
170 deletions
etrade_card_client/Config/application_config.json
etrade_card_client/Config/url_cfg.json
... | ... | @@ -9,5 +9,5 @@ |
9 | 9 | "user_msg_count_path":"/message/countUserMessage.do", |
10 | 10 | "user_msg_path":"/message/userMessageInit.page", |
11 | 11 | "modify_pwd_path":"/employee/client/initModifyPassword.page", |
12 | - "server_time_path":"/system/getSystemTime.do" | |
12 | + "server_time_path":"/system/getSystemTime.d" | |
13 | 13 | } |
14 | 14 | \ No newline at end of file | ... | ... |
etrade_card_client/ETradeClient/browser/async_js_callback_handler.cpp
... | ... | @@ -112,7 +112,7 @@ namespace HW |
112 | 112 | |
113 | 113 | HardwareCmd::Reply reply = m_hw_cmd_map.at(hw_req.cmd + hw_req.file_id).Execute(hw_req.data); |
114 | 114 | std::string answer = ""; |
115 | - if (boost::iequals(OK, reply.error_code) || boost::iequals("309", reply.error_code)) // Succeed. | |
115 | + if (boost::iequals(OK, reply.error_code)) // Succeed. | |
116 | 116 | answer = hw_req.cmd + "_ack"; |
117 | 117 | else |
118 | 118 | answer = hw_req.cmd + "_failed"; | ... | ... |
etrade_card_client/ETradeClient/hardware/DLCardManager.h
1 | - | |
2 | -// 作者:刘野 | |
3 | -// 卡片硬件操作库导出接口。 | |
4 | -// 包含dll导出接口和so库导出接口 | |
5 | - | |
6 | 1 | #ifndef DL_CARD_MANAGER_H |
7 | 2 | #define DL_CARD_MANAGER_H |
8 | 3 | |
9 | 4 | #define DL_DLL_API extern "C" __declspec(dllexport) |
10 | 5 | |
6 | +DL_DLL_API int __stdcall ConnectDLDevice(); | |
7 | +DL_DLL_API int __stdcall FindDLCard(); | |
8 | +DL_DLL_API int __stdcall AuthenticationDLKey(unsigned char* pKey); | |
9 | +DL_DLL_API int __stdcall ReadDLCardData(unsigned char* pDirID, unsigned char cFileID, short u16Offset, int u32DateLen, unsigned char* pData, unsigned char* pKey = 0); | |
10 | +DL_DLL_API int __stdcall WriteDLCardData(unsigned char* pDirID, unsigned char cFileID, unsigned char cOffset, unsigned short cDateLen, unsigned char* pData, unsigned char* pKey); | |
11 | +DL_DLL_API int __stdcall InstallDLKey(unsigned char* pDirID, unsigned char cKeyID, unsigned char* pNewKey, int iKeyType, unsigned char* pMainKey); | |
12 | +DL_DLL_API int __stdcall DisconnectDLDevice(); | |
11 | 13 | |
12 | - | |
13 | -/* 连接读卡器 */ | |
14 | -DL_DLL_API int __stdcall DLCConnectDevice(); | |
15 | - | |
16 | -/* 关闭读卡器 */ | |
17 | -DL_DLL_API int __stdcall DLCDisconnectDevice(); | |
18 | - | |
19 | -/* 寻卡 */ | |
20 | -DL_DLL_API int __stdcall DLCFindCard(); | |
21 | - | |
22 | -/* | |
23 | - * 验证秘钥 | |
24 | - * 输入16字节秘钥key_。 | |
25 | - * 返回值返回结果 | |
26 | - * */ | |
27 | -DL_DLL_API int __stdcall DLCAuthenticationKey(const unsigned char* dir, const unsigned char key_id, const unsigned char* key); | |
28 | - | |
29 | -/* | |
30 | - * 读取数据 | |
31 | - * 输入dir2字节目录标识、file_id1字节文件标识、read_offset2字节、 | |
32 | - * data_len2字节、read_key16字节读秘钥(没有置空)和read_data(长度依据读取长度而定)。 | |
33 | - * 输出结果填入read_data。 | |
34 | - * */ | |
35 | -DL_DLL_API int __stdcall DLCReadCardData(const unsigned char* dir, const unsigned char file_id, const unsigned int data_offset, const unsigned int data_len, const unsigned char* read_key, unsigned char* read_data); | |
36 | - | |
37 | -/* | |
38 | -* 写入数据 | |
39 | -* 输入dir2字节目录标识、file_id2字节文件标识、read_offset2字节、 | |
40 | -* data_len2字节、read_key16字节读秘钥(没有置空)和read_data(长度依据读取长度而定)。 | |
41 | -* 输出结果填入read_data。 | |
42 | -* */ | |
43 | -DL_DLL_API int __stdcall DLCWriteCardData(const unsigned char* dir, const unsigned char file_id, const unsigned int data_offset, const unsigned int data_len, const unsigned char* write_key, const unsigned char* write_data); | |
44 | - | |
45 | -/* | |
46 | - * 安装/更新秘钥 | |
47 | - * 输入dir2字节目录标识、key_id1字节文件标识、key_type32位秘钥类型、 | |
48 | - * main_key16字节主控秘钥(没有置空)、new_key16字节新秘钥。 | |
49 | - **/ | |
50 | -DL_DLL_API int __stdcall DLCInstallKey(const unsigned char* dir, const unsigned char key_id, const int key_type, const unsigned char* main_key, const unsigned char* new_key); | |
51 | - | |
52 | -/* | |
53 | - * 建立文件 | |
54 | - * 输入parent_dir2字节父目录、parent_key2字节父目录主控秘钥、file_name2字节文件标识、 | |
55 | - * file_size2字节文件大小、safe_type4字节安全类型和file_type4字节文件类型 | |
56 | - **/ | |
57 | -DL_DLL_API int __stdcall DLCCreateFile(const unsigned char* parent_dir, const unsigned char* parent_key, const unsigned char* file_name, const unsigned char* file_size, const int file_type); | |
58 | - | |
59 | - | |
60 | -DL_DLL_API int __stdcall DLCSelectFile(const unsigned char* dir); | |
61 | - | |
62 | -//SO库API | |
63 | -// | |
64 | -/* | |
65 | - * 该函数用以获取8字节随机数 | |
66 | - * 输入5字节的无符号字符型数组指针,函数将更改数组内容,输出5字节指令。 | |
67 | - * 返回值返回错误码。 | |
68 | - */ | |
69 | -int __stdcall DLCSOGetRandom(unsigned char* get_randam_cmd); | |
70 | - | |
71 | -/* | |
72 | - * 该函数用于验证秘钥。 | |
73 | - * 输入key_id1字节秘钥标识、key16字节16进制秘钥值和random8字节16进制随机数,返回cmd13字节16进制指令。 | |
74 | - * 返回值返回结果。 | |
75 | - */ | |
76 | -int __stdcall DLCSOAuthenticationKey(const unsigned char key_id, const unsigned char* key, const unsigned char* random, unsigned char* cmd); | |
77 | - | |
78 | -/* | |
79 | - * 该函数用于读取数据。 | |
80 | - * 输入data_offfset数据初始偏移,data_offfset最大为ffff,data_len数据长度,data_len最大为ff,返回16进制cmd指令,cmd数组长度 = data_len + 5。 | |
81 | - * 读出的数据将存在data_中。 | |
82 | - * 返回值返回错误码。 | |
83 | - */ | |
84 | -int __stdcall DLCSOReadData(const unsigned int data_offfset, const unsigned int data_len, unsigned char* cmd); | |
85 | - | |
86 | -/* | |
87 | -* 该函数用于写入数据。 | |
88 | -* 输入write_key字节16进制读秘钥(没有置空)、random8字节16进制随机数(没有置空)、data_offfset2字节数据初始偏移、data_len2字节数据长度和data16进制数据,cmd数组长度 = data_len + 9。 | |
89 | -* 返回值返回错误码。 | |
90 | -*/ | |
91 | -int __stdcall DLCSOWriteData(const unsigned char* write_key, const unsigned char* random, const unsigned int data_offfset, const unsigned int data_len, const unsigned char* data, unsigned char* cmd); | |
92 | - | |
93 | - | |
94 | -/*该函数用于选择目录 | |
95 | - *输入dir两字节16进制目录标识,返回cmd7字节16进制指令 | |
96 | - **/ | |
97 | -int __stdcall DLCSOSelectDir(const unsigned char* dir, unsigned char* cmd); | |
98 | - | |
99 | -#endif //end DL_CARD_MANAGER_H | |
100 | - | |
14 | +#endif | |
101 | 15 | \ No newline at end of file | ... | ... |
etrade_card_client/ETradeClient/hardware/dili_card_device.cpp
... | ... | @@ -113,7 +113,7 @@ namespace DILICard |
113 | 113 | { |
114 | 114 | bool bResult = true; |
115 | 115 | |
116 | - int iResult = DLCConnectDevice(); | |
116 | + int iResult = ConnectDLDevice(); | |
117 | 117 | if (0 != iResult) |
118 | 118 | { |
119 | 119 | bResult = false; |
... | ... | @@ -124,7 +124,7 @@ namespace DILICard |
124 | 124 | } |
125 | 125 | void RWDevice::Disconnect() const |
126 | 126 | { |
127 | - DLCDisconnectDevice(); | |
127 | + DisconnectDLDevice(); | |
128 | 128 | } |
129 | 129 | void RWDevice::Beep(uint32_t time) const |
130 | 130 | { |
... | ... | @@ -134,7 +134,7 @@ namespace DILICard |
134 | 134 | { |
135 | 135 | bool bResult = true; |
136 | 136 | |
137 | - int iResult = DLCFindCard(); | |
137 | + int iResult = FindDLCard(); | |
138 | 138 | if (0 != iResult) |
139 | 139 | { |
140 | 140 | bResult = false; |
... | ... | @@ -306,7 +306,7 @@ namespace DILICard |
306 | 306 | |
307 | 307 | //将业务信息文件中的数据长度设置为0. |
308 | 308 | WriteCardFile(DF01_DIR, SERVICE_INFO_FILE_ID, 0/*offset*/, ACTIVATE_KEY_ID, key_F0015_DAMK1, DecToHex(0)); // Default length is 0. |
309 | -} | |
309 | + } | |
310 | 310 | |
311 | 311 | void RWDevice::ResetCard(const std::string& key_DCCK, const std::string& key_F0015_DACK) const |
312 | 312 | { |
... | ... | @@ -457,11 +457,11 @@ namespace DILICard |
457 | 457 | if (NULL != key_id) |
458 | 458 | { |
459 | 459 | memcpy(aucKey, key.c_str(), 32); |
460 | - iResult = DLCReadCardData(aucDir, file_id, offset, length, aucKey, aucData); | |
460 | + iResult = ReadDLCardData(aucDir, file_id, offset, length, aucData, aucKey); | |
461 | 461 | } |
462 | 462 | else |
463 | 463 | { |
464 | - iResult = DLCReadCardData(aucDir, file_id, offset, length, NULL, aucData); | |
464 | + iResult = ReadDLCardData(aucDir, file_id, offset, length, aucData); | |
465 | 465 | } |
466 | 466 | |
467 | 467 | |
... | ... | @@ -499,7 +499,7 @@ namespace DILICard |
499 | 499 | { |
500 | 500 | unsigned char aucDataBlock[DATA_MAX_LEN] = { 0 }; |
501 | 501 | memcpy(aucDataBlock, data.substr(iStartIndex, DATA_MAX_LEN).c_str(), DATA_MAX_LEN); |
502 | - iResult = DLCWriteCardData(aucDir, file_id, iOffset, DATA_MAX_LEN, aucDataBlock, aucKey); | |
502 | + iResult = WriteDLCardData(aucDir, file_id, iOffset, DATA_MAX_LEN, aucDataBlock, aucKey); | |
503 | 503 | if (0 != iResult) |
504 | 504 | { |
505 | 505 | err_msg << "Write data to file failed, FILE: " << file_id << ", ErrorCode: " << iResult; |
... | ... | @@ -514,7 +514,7 @@ namespace DILICard |
514 | 514 | { |
515 | 515 | unsigned char aucData[DATA_MAX_LEN] = { 0 }; |
516 | 516 | memcpy(aucData, data.substr(iStartIndex, iDataLength).c_str(), iDataLength); |
517 | - iResult = DLCWriteCardData(aucDir, file_id, iOffset, iDataLength, aucData, aucKey); | |
517 | + iResult = WriteDLCardData(aucDir, file_id, iOffset, iDataLength, aucData, aucKey); | |
518 | 518 | if (0 != iResult) |
519 | 519 | { |
520 | 520 | err_msg << "Write data to file failed, FILE: " << file_id << ", ErrorCode: " << iResult; |
... | ... | @@ -536,7 +536,7 @@ namespace DILICard |
536 | 536 | memcpy(aucDir, dir.c_str(), 4); |
537 | 537 | memcpy(aucMainKey, main_key.c_str(), 32); |
538 | 538 | memcpy(aucNewKey, install_key.c_str(), 32); |
539 | - int iResult = DLCInstallKey(aucDir, key_id, emKeyType, aucNewKey, aucMainKey); | |
539 | + int iResult = InstallDLKey(aucDir, key_id, aucNewKey, emKeyType, aucMainKey); | |
540 | 540 | if (0 != iResult) |
541 | 541 | { |
542 | 542 | err_msg << "Update key failed, key to be updated: " << install_key << ", ErrorCode: " << iResult; |
... | ... | @@ -544,33 +544,12 @@ namespace DILICard |
544 | 544 | } |
545 | 545 | } |
546 | 546 | |
547 | - void RWDevice::CreateCardFile(const std::string dir, const std::string dir_key, const std::string file_name, const std::string file_size, const int file_type) const | |
548 | - { | |
549 | - std::stringstream err_msg; | |
550 | - unsigned char aucDir[4] = { 0 }, aucKey[32] = { 0 }, aucFileName[4] = { 0 }, aucFileSize[4] = { 0 }; | |
551 | - memcpy(aucDir, dir.c_str(), 4); | |
552 | - memcpy(aucKey, dir_key.c_str(), 32); | |
553 | - memcpy(aucFileName, file_name.c_str(), 4); | |
554 | - memcpy(aucFileSize, file_size.c_str(), 4); | |
555 | - int iResult = DLCCreateFile(aucDir, aucKey, aucFileName, aucFileSize, file_type); | |
556 | - if (0 != iResult) | |
557 | - { | |
558 | - err_msg << "Create file failed, ErrorCode: " << iResult; | |
559 | - throw std::exception(err_msg.str().c_str()); | |
560 | - } | |
561 | - } | |
562 | - | |
563 | - bool RWDevice::NeedCreateFile() const | |
564 | - { | |
565 | - return DLCSelectFile((const unsigned char*)"df20") == 0 ? false : true; | |
566 | - } | |
567 | - | |
568 | 547 | bool RWDevice::AuthenticationKey(const std::string sKey) const |
569 | 548 | { |
570 | 549 | bool bResult = true; |
571 | 550 | unsigned char aucKey[32] = { 0 }; |
572 | 551 | memcpy(aucKey, sKey.c_str(), 32); |
573 | - int iResult = DLCAuthenticationKey((const unsigned char*)"3f00", 0, aucKey); | |
552 | + int iResult = AuthenticationDLKey(aucKey); | |
574 | 553 | if (iResult) |
575 | 554 | { |
576 | 555 | bResult = false; | ... | ... |
etrade_card_client/ETradeClient/hardware/dili_card_device.h
... | ... | @@ -69,15 +69,6 @@ namespace DILICard |
69 | 69 | std::string ReadCardServiceInfo(const std::string& key_F0015_DEAK) const; |
70 | 70 | void WriteCardServiceInfo(const std::string& key_F0015_DAMK1, const std::string& data) const; |
71 | 71 | bool AuthenticationKey(const std::string sKey) const; |
72 | - | |
73 | - //´´½¨ÍÑ»ú½»Ò×ËùÐèÎļþ add by liuye | |
74 | - void CreateCardFile(const std::string dir, | |
75 | - const std::string dir_key, | |
76 | - const std::string file_name, | |
77 | - const std::string file_size, | |
78 | - const int file_type) const; | |
79 | - | |
80 | - bool NeedCreateFile() const; | |
81 | 72 | |
82 | 73 | enum KeyType |
83 | 74 | { | ... | ... |
etrade_card_client/ETradeClient/hardware/hardware_cmd.cpp
... | ... | @@ -43,8 +43,7 @@ namespace StatusCode |
43 | 43 | static const std::string DILI_CARD_DEVICE_READ_SERVICE_INFO_FAILED = "305"; // 读取卡片业务信息失败. |
44 | 44 | static const std::string DILI_CARD_DEVICE_WRITE_SERVICE_INFO_FAILED = "306"; // 写入卡片业务信息失败. |
45 | 45 | static const std::string DILI_CARD_DEVICE_WRITE_UNMATCHED_CARD = "307"; // 写卡卡片的序列号不匹配. |
46 | - static const std::string DILI_CARD_DEVICE_NEED_UPDATE_CAN_NOT_USE = "308"; //卡片需要升级,请升级后继续使用。 | |
47 | - static const std::string DILI_CARD_DEVICE_NEED_UPDATE_CAN_USE = "309"; //卡片需要升级。 | |
46 | + static const std::string DILI_CARD_DEVICE_NEED_UPDATE = "308"; //卡片需要升级,请升级后继续使用。 | |
48 | 47 | |
49 | 48 | static const std::string PWD_MACHINE_CONNECT_FAILED = "401"; // 连接加密机失败. |
50 | 49 | static const std::string PWD_MACHINE_GET_KEY_FAILED = "402"; // 从加密机读取密钥失败. |
... | ... | @@ -469,21 +468,6 @@ ReadPINPadCmd::Reply ActivateDILICardCmd::Execute(const std::string& input) |
469 | 468 | break; |
470 | 469 | } |
471 | 470 | |
472 | - if (dili_card_device.NeedCreateFile()) | |
473 | - { | |
474 | - try | |
475 | - { | |
476 | - std::string key = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0"; | |
477 | - dili_card_device.CreateCardFile("3f00", key, "df20", std::string(), 1); | |
478 | - dili_card_device.CreateCardFile("df20", key, "0025", "0324", 3); | |
479 | - dili_card_device.CreateCardFile("df20", key, "0026", "0709", 3); | |
480 | - } | |
481 | - catch (std::exception& ex) | |
482 | - { | |
483 | - LOG_FATAL(L"创建文件失败失败,错误信息: " + str_2_wstr(ex.what())); | |
484 | - } | |
485 | - } | |
486 | - | |
487 | 471 | LOG_TRACE(L"计算SN。"); |
488 | 472 | card_sn = stuCardBasicInfo.chip_num + std::string("44494c49") + stuCardBasicInfo.chip_num; |
489 | 473 | |
... | ... | @@ -650,7 +634,7 @@ ReadPINPadCmd::Reply ResetDILICardCmd::Execute(const std::string& input) |
650 | 634 | reply.error_code = StatusCode::DILI_CARD_DEVICE_READ_BASIC_INFO_FAILED; |
651 | 635 | break; |
652 | 636 | } |
653 | - | |
637 | + | |
654 | 638 | if (slLevel == HardwareCmd::SL_0) |
655 | 639 | { |
656 | 640 | card_basic_info = stuCardBasicInfo; |
... | ... | @@ -743,7 +727,7 @@ ReadPINPadCmd::Reply ResetDILICardCmd::Execute(const std::string& input) |
743 | 727 | if (!dili_card_device.AuthenticationKey(key_DCCK)) |
744 | 728 | { |
745 | 729 | LOG_FATAL(L"秘钥验证失败,卡片需要升级!"); |
746 | - reply.error_code = StatusCode::DILI_CARD_DEVICE_NEED_UPDATE_CAN_NOT_USE; | |
730 | + reply.error_code = StatusCode::DILI_CARD_DEVICE_NEED_UPDATE; | |
747 | 731 | break; |
748 | 732 | } |
749 | 733 | } |
... | ... | @@ -870,24 +854,15 @@ ReadPINPadCmd::Reply ReadDILICardBasicInfoCmd::Execute(const std::string& input) |
870 | 854 | if (!dili_card_device.AuthenticationKey(sDCCK)) |
871 | 855 | { |
872 | 856 | LOG_FATAL(L"秘钥验证失败,卡片需要升级!"); |
873 | - reply.error_code = StatusCode::DILI_CARD_DEVICE_NEED_UPDATE_CAN_NOT_USE; | |
857 | + reply.error_code = StatusCode::DILI_CARD_DEVICE_NEED_UPDATE; | |
874 | 858 | break; |
875 | 859 | } |
876 | 860 | |
877 | 861 | } |
878 | - | |
879 | - if (dili_card_device.NeedCreateFile()) | |
880 | - { | |
881 | - LOG_FATAL(L"卡片需要升级!"); | |
882 | - reply.error_code = StatusCode::DILI_CARD_DEVICE_NEED_UPDATE_CAN_USE; | |
883 | - //启动卡片升级程序 add by liuye | |
884 | - ShellExecute(NULL, L"open", L".\\DLCardTool.exe", NULL, NULL, SW_SHOW); | |
885 | - // | |
886 | - } | |
887 | - | |
862 | + | |
888 | 863 | } while (0); |
889 | 864 | dili_card_device.Disconnect(); |
890 | - if (boost::iequals(reply.error_code, StatusCode::OK) || boost::iequals(reply.error_code, StatusCode::DILI_CARD_DEVICE_NEED_UPDATE_CAN_USE)) | |
865 | + if (boost::iequals(reply.error_code, StatusCode::OK)) | |
891 | 866 | LOG_TRACE(L"读取卡片基本信息成功。"); |
892 | 867 | |
893 | 868 | reply.data.put("chipNo", card_basic_info.chip_num); | ... | ... |
etrade_card_client/ETradeClient/utility/DLBmpManager.cpp
etrade_card_client/ETradeClient/utility/ETTimeManage.cpp