|
|
|
|
@ -62,19 +62,24 @@ class MeetRepository
|
|
|
|
|
'password' => md5($this->password)
|
|
|
|
|
];
|
|
|
|
|
try {
|
|
|
|
|
$result = httpCurl($url, 'GET', $params, $header);
|
|
|
|
|
$result = json_decode($result, true);
|
|
|
|
|
if ($result['success']) {
|
|
|
|
|
// 更新下config配置
|
|
|
|
|
$resultJson = httpCurl($url, 'GET', $params, $header, 30);
|
|
|
|
|
$result = json_decode($resultJson, true);
|
|
|
|
|
if (!is_array($result) || empty($result['success']) || empty($result['data'])) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// value/room/remark 在模型中为 guarded,需 unguarded 才能写入
|
|
|
|
|
AppointmentConfig::unguarded(function () use ($result) {
|
|
|
|
|
foreach ($result['data'] as $item) {
|
|
|
|
|
$where = ['value' => $item['id']];
|
|
|
|
|
$data = ['remark' => $item['name'], 'value' => $item['id'], 'room' => json_encode($item, JSON_UNESCAPED_UNICODE)];
|
|
|
|
|
$data = [
|
|
|
|
|
'remark' => $item['name'],
|
|
|
|
|
'value' => $item['id'],
|
|
|
|
|
'room' => json_encode($item, JSON_UNESCAPED_UNICODE),
|
|
|
|
|
];
|
|
|
|
|
AppointmentConfig::updateOrCreate($where, $data);
|
|
|
|
|
}
|
|
|
|
|
return $result['data'];
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return $result['data'];
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|