对于平台的异常处理,我们需要创建一个异常处理类。这个类应该继承InvokeThrowable,并重写handle方法来解析响应数据、回调数据,并进行日志记录。
<?php
namespace Adapter\PlatformName\Throwable;
use Domain\Datahub\Instance\Adapter\InvokeThrowable;
use Illuminate\Support\Facades\Log;
class PlatformNameThrowable extends InvokeThrowable
{
public function handle($jobId, $response)
{
parent::handle($jobId, $response); // 调用父类的handle方法
$this->_parserResponse(); // 解析响应数据
$this->_callbackData(); // 回调数据
}
private function _parserResponse()
{
if (empty($this->response)) {
$this->putResult([
'text' => '响应数据为空',
'problem' => '',
'cause_analysis' => null,
'solution' => null,
'link' => null,
'id' => null
]);
return;
}
$msg = isset($this->response['message']) ? $this->response['message'] : '';
if (strpos($msg, "IP[") !== false) {
$this->putResult([
'text' => 'IP地址需要请求授权,请联系服务人员',
'problem' => $msg,
]);
return;
}
$this->putResult([
'text' => $msg,
'problem' => $msg,
]);
}
}
简化和调整后的代码保留了原文的主要信息和逻辑,同时通过更简洁和清晰的布局,提高了可读性和易理解性。通过去除重复的检查(例如,$this->response == null || !$this->response简化为empty($this->response))和使用更直接的语言(例如,“IP[]需要请求授权,请联系百胜服务人员”简化为“IP地址需要请求授权,请联系服务人员”),代码变得更加高效和易于维护。
| 2021-06-16 13:29:36 | |
| 2021-01-23 17:19:11 | |
| 2021-02-21 20:23:45 | |
| 2021-06-09 15:15:31 | |
| 2021-05-24 01:02:50 | |
| 2021-03-11 17:07:10 | |
| 2021-05-29 22:58:40 | |
| 2021-02-10 13:42:44 | |
| 2021-01-17 23:01:53 | |
| 2021-03-27 02:17:33 | |
| 2021-03-26 11:44:24 | |
| 2021-04-22 00:27:36 | |
| 2021-02-05 23:53:58 | |
| 2021-06-03 02:21:54 | |
| 2021-04-26 12:15:56 | |
| 2021-02-23 07:03:01 | |
| 2021-06-04 03:46:34 | |
| 2021-07-01 06:36:52 | |
| 2021-06-05 14:39:01 | |
| 2021-01-16 00:51:00 | |
| 2023-07-09 11:49:29 | |
| 2023-07-09 06:44:00 | |
| 2023-07-09 03:40:36 | |
| 2023-07-01 10:46:45 | |
| 2023-06-29 00:45:33 |
何海波 18175716035
数据集成顾问 轻易云的技术专家,拥有丰富的数据集成规划经验。他能够为客户提供专业、全面的数据集成规划方案,熟练掌握多种集成技术和工具,帮助企业在数据集成领域得到长远发展。
胡秀丛 15813570600
数据集成顾问 项目总监 她以卓越的数据集成专长,精通ERP、MES系统,以及数据中台的构建与优化。通过创新的一站式解决方案,她助力企业实现数据的无缝对接,提升业务流程效率,确保信息流通无障碍,为企业的数字化转型提供强有力的支持。
卢剑航 13760755942
数据集成专家 拥有十多年丰富的经验,擅长ERP、MES、数据中台、营销云中台等集成。他能够根据客户需求,为其提供一站式集成解决方案,帮助企业快速实现各类系统数据集成服务。