|
|
@@ -49,29 +49,34 @@ bool CDepttelextOffice::InitDepttelext()
|
|
49
|
49
|
|
|
50
|
50
|
ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{CDepttelextOffice}: 分机号码列表结束初始化"));
|
|
51
|
51
|
IOtlRecordset::DestroyInstance(record); // 释放记录集
|
|
|
52
|
+
|
|
|
53
|
+ // 定时器初始化
|
|
|
54
|
+ //m_PollTimer.SetTimedEvent(this, &CDepttelextOffice::__onTimerPoll);
|
|
|
55
|
+ //m_PollTimer.Start(1000 * 60); // 每分钟一次
|
|
|
56
|
+
|
|
52
|
57
|
return true;
|
|
53
|
58
|
}
|
|
54
|
59
|
|
|
55
|
|
-void CDepttelextOffice::UpdateDepttelext(UINT extno, int state)
|
|
|
60
|
+bool CDepttelextOffice::UpdateDepttelext(UINT extno, int state)
|
|
56
|
61
|
{
|
|
57
|
62
|
auto it = m_DeptTelextmap.find(extno);
|
|
58
|
|
- if (it == m_DeptTelextmap.end()) return;
|
|
|
63
|
+ if (it == m_DeptTelextmap.end()) return false;
|
|
59
|
64
|
if (it->second) {
|
|
60
|
|
- it->second->State = state;
|
|
|
65
|
+ it->second->UpdateState(state);
|
|
61
|
66
|
}
|
|
|
67
|
+ return true;
|
|
62
|
68
|
}
|
|
63
|
69
|
|
|
64
|
70
|
std::string CDepttelextOffice::GetAllDeptTelext()
|
|
65
|
71
|
{
|
|
66
|
72
|
Json::Value root;
|
|
67
|
|
- Json::Value body;
|
|
68
|
73
|
Json::FastWriter writer;
|
|
69
|
|
-
|
|
70
|
74
|
auto it = m_DeptTelextmap.begin();
|
|
71
|
75
|
DeptTelext *pDeptTelext = nullptr;
|
|
72
|
76
|
while (it != m_DeptTelextmap.end()){
|
|
73
|
77
|
pDeptTelext = it->second;
|
|
74
|
78
|
if (pDeptTelext) {
|
|
|
79
|
+ Json::Value body;
|
|
75
|
80
|
body["Name"] = pDeptTelext->Name.GetBuffer(0);
|
|
76
|
81
|
body["Telephone"] = pDeptTelext->Telephone.GetBuffer(0);
|
|
77
|
82
|
body["AgentExten"] = pDeptTelext->Extension.GetBuffer(0);
|
|
|
@@ -82,3 +87,12 @@ std::string CDepttelextOffice::GetAllDeptTelext()
|
|
82
|
87
|
}
|
|
83
|
88
|
return writer.write(root);
|
|
84
|
89
|
}
|
|
|
90
|
+
|
|
|
91
|
+void CDepttelextOffice::__onTimerPoll(void)
|
|
|
92
|
+{
|
|
|
93
|
+ auto it = m_DeptTelextmap.begin();
|
|
|
94
|
+ DeptTelext *pDeptTelext = nullptr;
|
|
|
95
|
+ while (it != m_DeptTelextmap.end()) {
|
|
|
96
|
+ it->second->UpdateTimeCount();
|
|
|
97
|
+ }
|
|
|
98
|
+}
|