...
|
...
|
@@ -82,6 +82,18 @@ public function response($msg = 'success', $code = self::SUCCESS, $data = [], $r |
|
|
throw new HttpResponseException($response);
|
|
|
}
|
|
|
|
|
|
public function responseNew($message = 'success', $status = self::SUCCESS, $data = [], $result_code = 200, $type = 'application/json')
|
|
|
{
|
|
|
$result = [
|
|
|
'message' => $message,
|
|
|
'status' => $status,
|
|
|
'data' => $data,
|
|
|
];
|
|
|
$this->header['Content-Type'] = $type;
|
|
|
$response = response($result, $result_code, $this->header);
|
|
|
throw new HttpResponseException($response);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* GET请求
|
|
|
* @param $url
|
...
|
...
|
@@ -465,7 +477,7 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA |
|
|
{
|
|
|
$data = $request->all();
|
|
|
if (empty($data)) {
|
|
|
$this->success();
|
|
|
$this->response();
|
|
|
}
|
|
|
|
|
|
if($type == self::TYPEINQUIRY){
|
...
|
...
|
@@ -481,7 +493,7 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA |
|
|
//判断是否是爬虫
|
|
|
$isReptile = $this->isReptile($request);
|
|
|
if ($isReptile) {
|
|
|
$this->success();
|
|
|
$this->response();
|
|
|
}
|
|
|
|
|
|
$data["device_port"] = $this->userAgentHandle($request->header('User-Agent'), $data["device_port"] ?? self::DEVICE_PORT_ONE);
|
...
|
...
|
@@ -512,7 +524,7 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA |
|
|
if($type == self::TYPEINQUIRY){
|
|
|
$this->response("success", self::SUCCESS, $resp["data"] ?? []);
|
|
|
}else{
|
|
|
$this->success($resp["data"] ?? []);
|
|
|
$this->responseNew("success", self::SUCCESS, $resp["data"] ?? []);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|