Commit 34183082 by wuyang.zou

Configure ODS 机器使用 域名访问

插件程序新增读取 ip 配置便于核对 门店终端程序是否升级成功使用 域名访问 ods
更新配置文件中ods服务的 ip 为 域名

Verison:1.2.8 RC
parent 4bd09aa1
......@@ -38,4 +38,6 @@ build:编译中间文件<br>
products[i].specs[j] 数组对象字段: extraPrice:套餐子商品加价价格;originalPrice: 套餐子商品原价; <br> 扩展 extendedAttributes 对象字段, 如下: amountMax:剩余活动金额; pointsMultiple:福利分倍数; memberDayPoint:积分会员日积分
3.8 2021-07-26 wuyang.zou Version: 1.2.7-2 RC //新增属性字段:
orderCoupons[i] 数组对象字段: 仅orderCoupons[i].type="P"->是商品券时存在 ①bonusDayBusinessType:日商类型 ->入门店(S)默认值,入总部(T); ② bonusDayBusinessAmt:日商金(单位分);
\ No newline at end of file
orderCoupons[i] 数组对象字段: 仅orderCoupons[i].type="P"->是商品券时存在 ①bonusDayBusinessType:日商类型 ->入门店(S)默认值,入总部(T); ② bonusDayBusinessAmt:日商金(单位分);
3. 9 2021-10-13 wuyang.zou Version: 1.2.8 RC //新增插件的备注 属性字段;
\ No newline at end of file
[SYS]
[SYS]
port=24446
#<<贝瑞>>
......@@ -8,16 +8,15 @@ port=24446
#(测试环境外网 IP [内网IP:10.0.103.116] )
#ip: 103.13.247.78
#<<全家>>
#<<全家>
#config.ini 文件 中 [ODS] 模块中的
#(生产环境外网 IP [内网IP:10.0.100.70] )
#ip: 103.13.247.72
#(测试环境外网 IP [内网IP:10.0.102.14] )
#ip: 103.13.247.7*
#ip: 103.13.247.73
[ODS]
ip=127.0.0.1
;ip=103.13.247.78
ip=api.ods.chinafamilymart.com.cn
pushPort=30001
recvPort=30002
......@@ -29,8 +28,8 @@ port=24445
;Windows 模拟程序 新增可配置功能:
;配置门店号, POS号, 是否主POS标识, 插件模拟角色: 默认是插件(可控制是否自动登录) / simulatorRole=pos 标识模拟POS发送登录请求;
;storeId=207777
;storeId=2077777
;posId=1
;isMaster=false
;simulatorRole=pos
;autoLogin=true
\ No newline at end of file
;autoLogin=true
[SYS]
port=24446
#<<贝瑞>>
#config.ini 文件 中 [ODS] 模块中的
#(生产环境外网 IP)
#ip: 103.13.247.77
#(测试环境外网 IP [内网IP:10.0.103.116] )
#ip: 103.13.247.78
#<<全家>
#config.ini 文件 中 [ODS] 模块中的
#(生产环境外网 IP [内网IP:10.0.100.70] )
#ip: 103.13.247.72
#(测试环境外网 IP [内网IP:10.0.102.14] )
#ip: 103.13.247.73
[ODS]
ip=api.ods.chinafamilymart.com.cn
pushPort=30001
recvPort=30002
socketTimeout=120
[POS]
ip=127.0.0.1
port=24445
;Windows 模拟程序 新增可配置功能:
;配置门店号, POS号, 是否主POS标识, 插件模拟角色: 默认是插件(可控制是否自动登录) / simulatorRole=pos 标识模拟POS发送登录请求;
;storeId=2077777
;posId=1
;isMaster=false
;simulatorRole=pos
;autoLogin=true
......@@ -11,6 +11,7 @@
std::string g_store_id = "";
std::string g_pos_id = "";
bool g_pos_ismaster = false;
std::string g_plugin_comment = "";
using namespace rapidjson;
......@@ -560,6 +561,9 @@ bool JsonModule::convertInitDataPos2Ods(IN const std::string& data, OUT std::str
writer.Key("is_master");
writer.Bool(is_master);
writer.Key("plugin_comment");
writer.String(g_plugin_comment.data());
writer.Key("ver");
writer.Int(1);
......@@ -1872,6 +1876,8 @@ bool JsonModule::_getOrderResponseJson(IN const std::string& posResponse, IN con
writer.String(g_pos_id.c_str());
writer.Key("is_master");
writer.Bool(g_pos_ismaster);
writer.Key("plugin_comment");
writer.String(g_plugin_comment.c_str());
writer.Key("child_store_id");
writer.String(child_store_id.c_str());
......
......@@ -10,9 +10,9 @@
extern std::string g_store_id;
extern std::string g_pos_id;
extern bool g_pos_ismaster;
extern std::string g_plugin_comment;
#define VERSION "1.2.7-2 RC" //版本号;
#define VERSION "1.2.8 RC" //版本号;
class JsonModule
......
......@@ -47,6 +47,7 @@ int pos_listen_port;
extern std::string g_store_id; //进程运行期间存储全局 Store 编号;
extern std::string g_pos_id; //进程运行期间存储全局 Pos 编号;
extern bool g_pos_ismaster; //进程运行期间存储全局 是否主POS 编号;
extern std::string g_plugin_comment; //插件的备注功能: 目前用来存储终端 使用 域名/IP 连接ODS;
/****** Windows X86 模式,才支持插件脱离POS独立运行 ******/
#ifdef WIN32
......@@ -332,6 +333,7 @@ int main(int argc,char *argv[])
LOG(INFO) << "strIniPath: " << strIniPath.data();
ods_ip = ZIni::readString("ODS","ip", "", strIniPath.c_str());
g_plugin_comment = ods_ip;
getIpByDns(ods_ip);
ods_push_port = ZIni::readInt("ODS", "pushPort", 0, strIniPath.c_str());
ods_recv_port = ZIni::readInt("ODS", "recvPort", 0, strIniPath.c_str());
......@@ -357,17 +359,20 @@ int main(int argc,char *argv[])
}
else {
g_init_data = "{ \"fm_cmd\":1000,\"storeId\":\"" + pos_config_storeid + "\",\"pos_id\":\"" + std::to_string(pos_config_posid)
+ "\",\"operator_id\":\"zouwuyang\",\"business_date\":\"20210515\",\"is_master\":" + pos_config_ismaster + ",\"version\":\"" + VERSION + "\",\"listen_port\":24445 }";
+ "\",\"operator_id\":\"zouwuyang\",\"business_date\":\"20211015\",\"is_master\":" + pos_config_ismaster + " ,\"plugin_comment\":\"" + g_plugin_comment +
+ "\",\"version\":\"" + VERSION + "\",\"listen_port\":24445 }";
}
LOG(INFO) << "[ODS]ip: " << ods_ip.data() << "-push port: " << ods_push_port << "-recv port: " << ods_recv_port << "-socket timeout: " << ods_socket_timeout;
LOG(INFO) << "[POS]ip:" << pos_ip << "-listen port:" << pos_listen_port << " storeId:" << pos_config_storeid << " posId:" << pos_config_posid << " is_master:" << pos_config_ismaster;
LOG(INFO) << "[PosPlugin] Listen Port: " << client_listen_port;
LOG(INFO) << "[PosPlugin] Comment: " << g_plugin_comment;
#else
LOG(INFO) << "[ODS]ip: " << ods_ip.data() << "-push port: " << ods_push_port << "-recv port: " << ods_recv_port << "-socket timeout: " << ods_socket_timeout;
LOG(INFO) << "[POS]ip: " << pos_ip << "-listen port: " << pos_listen_port;
LOG(INFO) << "[PosPlugin] Listen Port: " << client_listen_port;
LOG(INFO) << "[PosPlugin] Comment: " << g_plugin_comment;
#endif
#ifdef WIN32
......@@ -623,6 +628,7 @@ bool order_send_to_pos(IN std::string &order_json,IN std::string &ods_json,OUT s
void getIpByDns(IN std::string &ods_ip) {
if (ods_ip.front() < '0' || ods_ip.front() > '9') {
LOG(INFO) << "DNS Resolve IP Begin , Origin ods_ip: " << ods_ip.c_str();
struct hostent* pHost = NULL;
bool bGetDnsRet = false;
......@@ -645,7 +651,9 @@ void getIpByDns(IN std::string &ods_ip) {
char **pptr;
pptr = pHost->h_addr_list;
#ifdef WIN32
ods_ip = *(ULONG*)(pHost->h_addr);
// ods_ip = *(ULONG*)pHost->h_addr; // 转换失败;
// ods_ip = inet_ntoa(*(in_addr*)*pHost->h_addr_list); // 转换成功
ods_ip = inet_ntoa(*(in_addr*)pHost->h_addr); // 转换首个IP成功
#else
for (; *pptr != NULL; pptr++) {
inet_ntop(pHost->h_addrtype, *pptr, str, sizeof(str));
......
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