Browse Source

优化

master
wanghongjun 3 years ago
parent
commit
c5e1fa3282
  1. 6
      tasks/Base.php

6
tasks/Base.php

@ -252,7 +252,7 @@ class Base
if (empty($url)) return ['status' => 0, 'msg' => 'url不能为空']; if (empty($url)) return ['status' => 0, 'msg' => 'url不能为空'];
# 获取请求路径 # 获取请求路径
if (empty($host_path)) { if (empty($host_path)) {
$config = config('api_config'); $config = $this->config('api_config');
$host_path = $config['host_path']; $host_path = $config['host_path'];
} }
# 验证令牌 # 验证令牌
@ -260,10 +260,10 @@ class Base
# 请求接口数据 # 请求接口数据
$data = [ $data = [
'data' => $encrypt ? json_encode($requestData) : base64_encode(json_encode($requestData)), 'data' => $encrypt ? json_encode($requestData) : base64_encode(json_encode($requestData)),
'token' => md5($token . date('Ymd')) 'encrypt' => $encrypt ? 1 : 0
]; ];
$date = (int)date("d"); $date = (int)date("d");
$date['signature'] = md5($token . ($date % 2) . md5($data['data'])); $data['signature'] = md5($token . ($date % 2) . md5($data['data']));
$json_data = json_encode($data); $json_data = json_encode($data);
$createUrl = $host_path . $url; $createUrl = $host_path . $url;
# 发起请求 # 发起请求

Loading…
Cancel
Save