1. 返回合适的错误标识
This commit is contained in:
@@ -84,7 +84,7 @@ func (h *HIKNvr) UTCDiff() int {
|
|||||||
if h.State {
|
if h.State {
|
||||||
data := nvrUTCDiff(h.core)
|
data := nvrUTCDiff(h.core)
|
||||||
h.mux.RUnlock()
|
h.mux.RUnlock()
|
||||||
if nvrUTCDiff(h.core) == 500 {
|
if nvrUTCDiff(h.core) == 5000 {
|
||||||
h.mux.Lock()
|
h.mux.Lock()
|
||||||
h.State = false
|
h.State = false
|
||||||
h.mux.Unlock()
|
h.mux.Unlock()
|
||||||
@@ -97,5 +97,5 @@ func (h *HIKNvr) UTCDiff() int {
|
|||||||
} else {
|
} else {
|
||||||
h.mux.RUnlock()
|
h.mux.RUnlock()
|
||||||
}
|
}
|
||||||
return 1000
|
return 5000
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ char *CheckTimeRegionWithMonth(void *PtrHIKNvr, int year, int month) {
|
|||||||
|
|
||||||
if (nRet == 0) {
|
if (nRet == 0) {
|
||||||
res = HIKNvrObj->TimeToJson(select_time, &available_date_vec).dump();
|
res = HIKNvrObj->TimeToJson(select_time, &available_date_vec).dump();
|
||||||
|
}else{
|
||||||
|
res = "";
|
||||||
}
|
}
|
||||||
char *cString = new char[res.size() + 1];
|
char *cString = new char[res.size() + 1];
|
||||||
std::strcpy(cString, res.c_str());
|
std::strcpy(cString, res.c_str());
|
||||||
@@ -77,6 +79,8 @@ char *CheckTimeRegionWithDay(void *PtrHIKNvr, int year, int month, int day) {
|
|||||||
int nRet = HIKNvrObj->CheckTimeRegionWithDay(select_time, available_time_vec);
|
int nRet = HIKNvrObj->CheckTimeRegionWithDay(select_time, available_time_vec);
|
||||||
if (nRet == 0) {
|
if (nRet == 0) {
|
||||||
res = HIKNvrObj->TimeToJsonInDay(select_time, &available_time_vec).dump();
|
res = HIKNvrObj->TimeToJsonInDay(select_time, &available_time_vec).dump();
|
||||||
|
}else{
|
||||||
|
res = "";
|
||||||
}
|
}
|
||||||
char *cString = new char[res.size() + 1];
|
char *cString = new char[res.size() + 1];
|
||||||
std::strcpy(cString, res.c_str());
|
std::strcpy(cString, res.c_str());
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ bool HIKNvr::InitNvr(std::string ip, std::string port, std::string username, std
|
|||||||
int HIKNvr::GetNvrUTCDiff(){
|
int HIKNvr::GetNvrUTCDiff(){
|
||||||
NET_DVR_NETAPPCFG struNAC = {0};
|
NET_DVR_NETAPPCFG struNAC = {0};
|
||||||
DWORD ZoneSize = 0;
|
DWORD ZoneSize = 0;
|
||||||
NET_DVR_GetDVRConfig(LoginID, NET_DVR_GET_NETAPPCFG, 0, &struNAC, sizeof(NET_DVR_NETAPPCFG), &ZoneSize);
|
if (NET_DVR_GetDVRConfig(LoginID, NET_DVR_GET_NETAPPCFG, 0, &struNAC, sizeof(NET_DVR_NETAPPCFG), &ZoneSize)){
|
||||||
|
return 5000;
|
||||||
|
};
|
||||||
int nDiffHour = struNAC.struNtpClientParam.cTimeDifferenceH;
|
int nDiffHour = struNAC.struNtpClientParam.cTimeDifferenceH;
|
||||||
int nDiffMin = struNAC.struNtpClientParam.cTimeDifferenceM;
|
int nDiffMin = struNAC.struNtpClientParam.cTimeDifferenceM;
|
||||||
nDiffTotalMin = (nDiffHour < 0 ? -1 : 1) * (abs(nDiffHour) * 60 + nDiffMin);
|
nDiffTotalMin = (nDiffHour < 0 ? -1 : 1) * (abs(nDiffHour) * 60 + nDiffMin);
|
||||||
|
|||||||
Reference in New Issue
Block a user