Merge branch 'master' of ssh://47.101.48.251:/data/git/wx.sstbc.com

master
weizong song 2 days ago
commit 8fbdb9b91b

@ -16,6 +16,7 @@ class DoorRepository
public $key; public $key;
public $dptNo; public $dptNo;
public $profix; public $profix;
public $httpTimeout = 30;
public function __construct() public function __construct()
{ {
@ -103,18 +104,23 @@ class DoorRepository
$params['sign'] = $this->sign($params); $params['sign'] = $this->sign($params);
$result = []; $result = [];
$finally = 0; $finally = 0;
$resultJson = '';
try { try {
$params = json_encode($params); $params = json_encode($params);
$result = httpCurl($url, 'POST', $params, $header); $resultJson = httpCurl($url, 'POST', $params, $header, $this->httpTimeout);
$result = json_decode($result, true); $result = json_decode($resultJson, true);
if (empty($result['code'])) { if (!is_array($result) || !array_key_exists('code', $result)) {
$out = is_string($resultJson) && $resultJson !== '' ? $resultJson : '门禁同步人员超时或返回异常';
$result = $out;
return false;
}
if ((int) $result['code'] === 0) {
$finally = 1; $finally = 1;
return true; return true;
} else {
$out = $result['msg'];
return false;
} }
} catch (\Exception $e) { $out = $result['msg'] ?? '门禁同步人员失败';
return false;
} catch (\Throwable $e) {
$out = $e->getMessage(); $out = $e->getMessage();
return false; return false;
} finally { } finally {
@ -155,25 +161,23 @@ class DoorRepository
$params['sign'] = $this->sign($params); $params['sign'] = $this->sign($params);
$result = []; $result = [];
$finally = 0; $finally = 0;
$resultJson = '';
try { try {
$params = json_encode($params); $params = json_encode($params);
$resultJson = httpCurl($url, 'POST', $params, $header); $resultJson = httpCurl($url, 'POST', $params, $header, $this->httpTimeout);
$result = json_decode($resultJson, true); $result = json_decode($resultJson, true);
if (empty($result['code']) && ($result['msg'] == '执行成功' || str_contains($result['msg'], '已有权限'))) { $msg = is_array($result) ? (string) ($result['msg'] ?? '') : '';
if (is_array($result) && array_key_exists('code', $result) && (int) $result['code'] === 0 && ($msg === '执行成功' || str_contains($msg, '已有权限'))) {
$finally = 1; $finally = 1;
// 写日志
ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result, $finally, '门禁预约', $door['doorName'], $endTime); ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result, $finally, '门禁预约', $door['doorName'], $endTime);
return true; return true;
} else {
$out = $result['msg'];
// 写日志
ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result, $finally, '门禁预约', $door['doorName'], $endTime);
return false;
} }
} catch (\Exception $e) { $out = $msg !== '' ? $msg : (is_string($resultJson) && $resultJson !== '' ? $resultJson : '门禁下发超时或返回异常');
ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, is_array($result) ? $result : $out, $finally, '门禁预约', $door['doorName'], $endTime);
return false;
} catch (\Throwable $e) {
$out = $e->getMessage(); $out = $e->getMessage();
// 写日志 ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result ?: $resultJson, $finally, '门禁预约', $door['doorName'], $endTime);
ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result, $finally, '门禁预约', $door['doorName'], $endTime);
return false; return false;
} }
} }
@ -268,18 +272,23 @@ class DoorRepository
$params['sign'] = $this->sign($params); $params['sign'] = $this->sign($params);
$result = []; $result = [];
$finally = 0; $finally = 0;
$resultJson = '';
try { try {
$params = json_encode($params); $params = json_encode($params);
$result = httpCurl($url, 'POST', $params, $header); $resultJson = httpCurl($url, 'POST', $params, $header, $this->httpTimeout);
$result = json_decode($result, true); $result = json_decode($resultJson, true);
if (empty($result['code'])) { if (!is_array($result) || !array_key_exists('code', $result)) {
$out = is_string($resultJson) && $resultJson !== '' ? $resultJson : '门禁同步人员超时或返回异常';
$result = $out;
return false;
}
if ((int) $result['code'] === 0) {
$finally = 1; $finally = 1;
return true; return true;
} else {
$out = $result['msg'];
return false;
} }
} catch (\Exception $e) { $out = $result['msg'] ?? '门禁同步人员失败';
return false;
} catch (\Throwable $e) {
$out = $e->getMessage(); $out = $e->getMessage();
return false; return false;
} finally { } finally {
@ -327,16 +336,19 @@ class DoorRepository
$finally = 0; $finally = 0;
try { try {
$params = json_encode($params, JSON_UNESCAPED_UNICODE); $params = json_encode($params, JSON_UNESCAPED_UNICODE);
$resultJson = httpCurl($url, 'POST', $params, $header); $resultJson = httpCurl($url, 'POST', $params, $header, $this->httpTimeout);
$result = json_decode($resultJson, true); $result = json_decode($resultJson, true);
if (empty($result['code'])) { $msg = is_array($result) ? (string) ($result['msg'] ?? '') : '';
if (is_array($result) && array_key_exists('code', $result) && (int) $result['code'] === 0) {
$finally = 1; $finally = 1;
return true; return true;
} else {
$out = $result['msg'];
return false;
} }
} catch (\Exception $e) { $out = $msg !== '' ? $msg : (is_string($resultJson) && $resultJson !== '' ? $resultJson : '门禁下发超时或返回异常');
if (!is_array($result)) {
$result = $out;
}
return false;
} catch (\Throwable $e) {
$out = $e->getMessage(); $out = $e->getMessage();
return false; return false;
} finally { } finally {

@ -14,6 +14,7 @@ class MeetRepository
public $account; public $account;
public $password; public $password;
public $companyId; public $companyId;
public $httpTimeout = 30;
public function __construct() public function __construct()
{ {
@ -37,14 +38,13 @@ class MeetRepository
'password' => $this->password 'password' => $this->password
]; ];
try { try {
$result = httpCurl($url, 'GET', $params, $header); $result = httpCurl($url, 'GET', $params, $header, $this->httpTimeout);
$result = json_decode($result, true); $result = json_decode($result, true);
if ($result['success']) { if (is_array($result) && !empty($result['success'])) {
return $result['companyId']; return $result['companyId'];
} else {
return false;
} }
} catch (\Exception $e) { return false;
} catch (\Throwable $e) {
return false; return false;
} }
} }
@ -62,7 +62,7 @@ class MeetRepository
'password' => md5($this->password) 'password' => md5($this->password)
]; ];
try { try {
$resultJson = httpCurl($url, 'GET', $params, $header, 30); $resultJson = httpCurl($url, 'GET', $params, $header, $this->httpTimeout);
$result = json_decode($resultJson, true); $result = json_decode($resultJson, true);
if (!is_array($result) || empty($result['success']) || empty($result['data'])) { if (!is_array($result) || empty($result['success']) || empty($result['data'])) {
return false; return false;
@ -93,7 +93,13 @@ class MeetRepository
$startDateTime = new \DateTime($model->start_time); $startDateTime = new \DateTime($model->start_time);
$endDateTime = new \DateTime($model->end_time); $endDateTime = new \DateTime($model->end_time);
$meetOther = json_decode($appointmentConfig->room, true); $meetOther = is_array($appointmentConfig->room)
? $appointmentConfig->room
: json_decode($appointmentConfig->room, true);
if (!is_array($meetOther) || empty($meetOther['code']) || empty($meetOther['address'])) {
$out = '会议室信息不完整,缺少 code 或 address';
return false;
}
$url = $this->baseUrl . '/services/api/BookingService.aspx'; $url = $this->baseUrl . '/services/api/BookingService.aspx';
$header[] = 'Content-Type: application/json'; $header[] = 'Content-Type: application/json';
@ -132,24 +138,25 @@ class MeetRepository
$result = []; $result = [];
$finally = 0; $finally = 0;
$resultJson = '';
try { try {
$resultJson = httpCurl($url, 'GET', $params, $header); $resultJson = httpCurl($url, 'GET', $params, $header, $this->httpTimeout);
$result = json_decode($resultJson, true); $result = json_decode($resultJson, true);
if ($result['success']) { if (is_array($result) && !empty($result['success'])) {
$finally = 1; $finally = 1;
$allMeetIds[] = $result['data']; $allMeetIds[] = $result['data'];
$allResults[] = $result; $allResults[] = $result;
ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result, $finally, '会议室预约-' . $currentDate->format('Y-m-d')); ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result, $finally, '会议室预约-' . $currentDate->format('Y-m-d'));
} else { } else {
$out = $resultJson; $out = is_string($resultJson) && $resultJson !== '' ? $resultJson : '爱预约请求超时或返回异常';
ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result, $finally, '会议室预约-' . $currentDate->format('Y-m-d')); ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, is_array($result) ? $result : $out, $finally, '会议室预约-' . $currentDate->format('Y-m-d'));
return false; return false;
} }
} catch (\Exception $e) { } catch (\Throwable $e) {
$out = $e->getMessage(); $out = $e->getMessage();
ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result, $finally, '会议室预约-' . $currentDate->format('Y-m-d')); ThirdAppointmentLog::add($model->id, 0, $model->user_id, $url, $params, $result ?: $resultJson, $finally, '会议室预约-' . $currentDate->format('Y-m-d'));
return false; return false;
} }
@ -187,17 +194,16 @@ class MeetRepository
$result = []; $result = [];
$finally = 0; $finally = 0;
try { try {
$resultJson = httpCurl($url, 'GET', $params, $header); $resultJson = httpCurl($url, 'GET', $params, $header, $this->httpTimeout);
$out = $resultJson; $out = $resultJson;
$result = json_decode($resultJson, true); $result = json_decode($resultJson, true);
if ($result['success']) { if (is_array($result) && !empty($result['success'])) {
$finally = 1; $finally = 1;
return true; return true;
} else {
$out = $resultJson;
return false;
} }
} catch (\Exception $e) { $out = is_string($resultJson) && $resultJson !== '' ? $resultJson : '爱预约取消请求超时或返回异常';
return false;
} catch (\Throwable $e) {
$out = $e->getMessage(); $out = $e->getMessage();
return false; return false;
} finally { } finally {
@ -223,17 +229,16 @@ class MeetRepository
'end' => $endDate, 'end' => $endDate,
]; ];
try { try {
$resultJson = httpCurl($url, 'GET', $params, $header); $resultJson = httpCurl($url, 'GET', $params, $header, $this->httpTimeout);
$out = $resultJson; $out = $resultJson;
$result = json_decode($resultJson, true); $result = json_decode($resultJson, true);
if ($result['success']) { if (is_array($result) && !empty($result['success'])) {
$out = $result['data']; $out = $result['data'];
return true; return true;
} else {
$out = $resultJson;
return false;
} }
} catch (\Exception $e) { $out = is_string($resultJson) && $resultJson !== '' ? $resultJson : '爱预约查询超时或返回异常';
return false;
} catch (\Throwable $e) {
$out = $e->getMessage(); $out = $e->getMessage();
return false; return false;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0c5774"],{"3ee1":function(e,n,a){"use strict";a.r(n);var t=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("div",[e._v(" 123 "),a("avue-input-map",{attrs:{params:e.mapparams,placeholder:"请选择地图"},model:{value:e.mapform,callback:function(n){e.mapform=n},expression:"mapform"}}),a("xyTinymce",{model:{value:e.content,callback:function(n){e.content=n},expression:"content"}})],1)},o=[],c=a("eace"),p=a("795b"),m={components:{AvueMap:c["a"],xyTinymce:p["a"]},data:function(){return{mapparams:{zoom:11},mapform:[],content:""}}},r=m,l=a("2877"),u=Object(l["a"])(r,t,o,!1,null,null,null);n["default"]=u.exports}}]);

@ -0,0 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0c5774"],{"3ee1":function(n,e,o){"use strict";o.r(e);var a=function(){var n=this,e=n.$createElement,o=n._self._c||e;return o("div",[n._v(" 123 "),o("xy-map",{attrs:{raw:"",zoom:n.mapparams.zoom},model:{value:n.mapform,callback:function(e){n.mapform=e},expression:"mapform"}}),o("xyTinymce",{model:{value:n.content,callback:function(e){n.content=e},expression:"content"}})],1)},t=[],c=o("795b"),m={components:{xyTinymce:c["a"]},data:function(){return{mapparams:{zoom:11},mapform:[],content:""}}},r=m,p=o("2877"),l=Object(p["a"])(r,a,t,!1,null,null,null);e["default"]=l.exports}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save