Commit a955dec6 by wuyang.zou

New Feature:

    1、Dll 生成订单号精确到毫秒级;
    2、订单请求报文超大,内存拷贝越界, 56个商品且每个商品有56个优惠折扣;
    3、请求报文中保护 PosIp

Version: 2.21.7.15
parent a0e5839e
No preview for this file type
No preview for this file type
......@@ -7,6 +7,7 @@
//#define ERROR_INDATA "{\"statusCode\": 302, \"message\": \"输入参数非json或为空\"}"
//#define ERROR_INDATA "{\"statusCode\": 302, \"message\": \"\u8F93\u5165\u53C2\u6570\u975Ejson\u6216\u4E3A\u7A7A\"}"
#define ERROR_INDATA "{\"statusCode\": 302, \"message\": \"\350\276\223\345\205\245\345\217\202\346\225\260\351\235\236json\346\210\226\344\270\272\347\251\272\"}"
#define ERROR_MALLOC_MEMORY "{\"statusCode\": 302, \"message\": \"Malloc Big Memory Failed\"}"
//#define ERROR_OUTDATA "{\"statusCode\": 303, \"message\": \"服务端返回数据异常\"}"
//#define ERROR_OUTDATA "{\"statusCode\": 303, \"message\": \"\u670D\u52A1\u7AEF\u8FD4\u56DE\u6570\u636E\u5F02\u5E38\"}"
#define ERROR_OUTDATA "{\"statusCode\": 303, \"message\": \"\346\234\215\345\212\241\347\253\257\350\277\224\345\233\236\346\225\260\346\215\256\345\274\202\345\270\270\"}"
......
......@@ -10,14 +10,15 @@
#define MAX_SIGN_LEN 256
#define CFG_FILE_NAME "fmclient.cfg"
#define RBG_FILE_NAME "fmclient.rbk"
#define REQUEST_CRET "{\"ver\": 1,\"reqType\": 99,\"partnerId\":%d,\"storeId\":\"%s\",\"stationId\": \"%s\",\"mac\":\"%s\",\"posType\":%d,\"dllVersion\":\"%s\",\"serverUrl\":\"%s\"}"
#define REQUEST_CRET "{\"ver\": 1,\"reqType\": 99,\"partnerId\":%d,\"storeId\":\"%s\",\"stationId\": \"%s\",\"mac\":\"%s\",\"posIp\":\"%s\",\"posType\":%d,\"dllVersion\":\"%s\",\"serverUrl\":\"%s\"}"
//CCO-1438
#define CCO_DES3_KEY "ABCD@#9876DFSAAWKLDEOPDD"
//EC-1446
#define EC_DES3_KEY "DDDDEEEE45LPODDCXZZLKDDO"
#define DLL_VERSION "2.21.1.12"
// Modify Running Program Version , Also Need Modify fmclient.rc File Version;
#define DLL_VERSION "2.21.7.15"
#define CRET_FILE_NAME "client.p12"
#define JSON_KEY_ONLY "partnerOrderId"
......@@ -30,4 +31,5 @@
#define POS_TYPE_KEY "posType"
#define UPS_URL_KEY "serverUrl"
#define DLL_VER_KEY "dllVersion"
#define POS_LOCAL_IP "posIp"
#endif
\ No newline at end of file
......@@ -12,6 +12,7 @@
#include "filesystem.h"
#include <winsock2.h>
#include <WS2tcpip.h>
#include <iphlpapi.h>
#pragma comment(lib, "IPHLPAPI.lib")
......@@ -21,8 +22,8 @@ using namespace rapidjson;
class Tool {
public:
static int GetMacByAdaptersAddresses(std::string& macOut) {
bool ret = 0;
static int GetMacIpByAdaptersAddresses(std::string& macOut, std::string& ipOut ) {
bool ret = 0;
ULONG outBufLen = sizeof(IP_ADAPTER_ADDRESSES);
PIP_ADAPTER_ADDRESSES pAddresses = (IP_ADAPTER_ADDRESSES*)malloc(outBufLen);
......@@ -39,6 +40,8 @@ public:
if(GetAdaptersAddresses(AF_UNSPEC, 0, NULL, pAddresses, &outBufLen) == NO_ERROR)
{
char buff[20] = { 0 };
DWORD bufflen = 20;
// If successful, output some information from the data we received
for(PIP_ADAPTER_ADDRESSES pCurrAddresses = pAddresses; pCurrAddresses != NULL; pCurrAddresses = pCurrAddresses->Next)
{
......@@ -55,10 +58,38 @@ public:
int (pCurrAddresses->PhysicalAddress[5]));
macOut = acMAC;
ret = 1;
break;
}
}
//pCurrAddresses->Dhcpv4Server // 通过 SOCKET_ADDRESS 地址进行 转换获取 准确的IPv4 地址;
PIP_ADAPTER_UNICAST_ADDRESS pUnicast = pCurrAddresses->FirstUnicastAddress;
if (pUnicast != NULL) {
for (int i = 0; pUnicast != NULL; i++) {
if (pUnicast->Address.lpSockaddr->sa_family == AF_INET) {
sockaddr_in *sa_in = (sockaddr_in *)pUnicast->Address.lpSockaddr;
inet_ntop(AF_INET, &(sa_in->sin_addr), buff, bufflen);
LOG() <<" GetMacIpByAdaptersAddresses IPv4: "<< buff;
ipOut = buff;
}
else if (pUnicast->Address.lpSockaddr->sa_family == AF_INET6) {
/*
sockaddr_in6 *sa_in6 = (sockaddr_in6 *)pUnicast->Address.lpSockaddr;
printf("\tIPV6:%s\n", inet_ntop(AF_INET6, &(sa_in6->sin6_addr), buff, bufflen));
*/
} else {
LOG() << "GetMacIpByAdaptersAddresses sa_family UNSPEC";
ipOut = "sa_family UNSPEC";
}
pUnicast = pUnicast->Next;
}
} else {
LOG() << " GetMacIpByAdaptersAddresses No Unicast Addresses";
ipOut = "FirstUnicastAddress Is NULL";
}
// Get First Unicast IP Address From Adapter Finished ;
ret = 1;
break;
}
}
free(pAddresses);
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment