Commit 14fcb105 authored by jianghaiming's avatar jianghaiming

update:set

parent e7fa0b7d
...@@ -8,9 +8,9 @@ class IdCertification ...@@ -8,9 +8,9 @@ class IdCertification
{ {
private const key = '_v7QkFPgzb887YD6BuBqzHPJMJalJ6Zt'; private const key = '_v7QkFPgzb887YD6BuBqzHPJMJalJ6Zt';
private const secret = 'mDenoicZs2U_wd2jVmQQpCOPeM8jaFRu'; private const secret = 'mDenoicZs2U_wd2jVmQQpCOPeM8jaFRu';
private const kuangshi_ocr_url = 'https://api.megvii.com/faceid/v3/ocridcard'; public const kuangshi_ocr_url = 'https://api.megvii.com/faceid/v3/ocridcard';
private const kuangshi_get_token = 'https://api.megvii.com/faceid/v3/sdk/get_biz_token'; public const kuangshi_get_token = 'https://api.megvii.com/faceid/v3/sdk/get_biz_token';
private const kuangshi_face_compare = 'https://api.megvii.com/faceid/v3/sdk/verify'; public const kuangshi_face_compare = 'https://api.megvii.com/faceid/v3/sdk/verify';
/** /**
* 身份证合法校验 * 身份证合法校验
...@@ -232,6 +232,7 @@ class IdCertification ...@@ -232,6 +232,7 @@ class IdCertification
$final_data['birth_year'] = $ocr_data['response']['birth_year']['result'] ?? ''; $final_data['birth_year'] = $ocr_data['response']['birth_year']['result'] ?? '';
$final_data['completeness'] = $ocr_data['response']['completeness'] ?? -1; $final_data['completeness'] = $ocr_data['response']['completeness'] ?? -1;
$final_data['legality'] = $ocr_data['response']['legality'] ?? (object)[]; $final_data['legality'] = $ocr_data['response']['legality'] ?? (object)[];
$final_data['code'] = $ocr_data['response']['code'] ?? -1;
return $final_data; return $final_data;
} }
...@@ -247,6 +248,7 @@ class IdCertification ...@@ -247,6 +248,7 @@ class IdCertification
$final_data['valid_date_end'] = $ocr_data['response']['valid_date_end']['result'] ?? ''; $final_data['valid_date_end'] = $ocr_data['response']['valid_date_end']['result'] ?? '';
$final_data['completeness'] = $ocr_data['response']['completeness'] ?? -1; $final_data['completeness'] = $ocr_data['response']['completeness'] ?? -1;
$final_data['legality'] = $ocr_data['response']['legality'] ?? (object)[]; $final_data['legality'] = $ocr_data['response']['legality'] ?? (object)[];
$final_data['code'] = $ocr_data['response']['code'] ?? -1;
return $final_data; return $final_data;
} }
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ class SocialCreditCertification ...@@ -7,7 +7,7 @@ class SocialCreditCertification
{ {
private const account = 'BJyimingzhineng'; private const account = 'BJyimingzhineng';
private const app_key = 'deee9c9877e5452f8838cfc5130ac5ad'; private const app_key = 'deee9c9877e5452f8838cfc5130ac5ad';
private const ocr_bussiness_url = 'http://apistore.xmturui.com/apistore/ocr-new'; public const ocr_bussiness_url = 'http://apistore.xmturui.com/apistore/ocr-new';
private const engine_type = 'blic-new'; private const engine_type = 'blic-new';
/** /**
......
...@@ -8,7 +8,7 @@ class ThreeElementsCertification ...@@ -8,7 +8,7 @@ class ThreeElementsCertification
{ {
private const app_key = '392df35aa98721c597cf20b85d21eebc'; private const app_key = '392df35aa98721c597cf20b85d21eebc';
//运营商三要素检测接口 //运营商三要素检测接口
private const test_mobile3_ele_Sim_url = 'https://api.goodsdatas.com:8443/credit/Mobile3EleSim'; public const test_mobile3_ele_Sim_url = 'https://api.goodsdatas.com:8443/credit/Mobile3EleSim';
//加密需要的相关参数 //加密需要的相关参数
private const salt = 'A99BC8325635E303'; private const salt = 'A99BC8325635E303';
......
...@@ -263,11 +263,12 @@ class Daemon ...@@ -263,11 +263,12 @@ class Daemon
*/ */
protected function set_base_config(){ protected function set_base_config(){
ini_set("display_errors", 1); ini_set("display_errors", 1);
error_reporting('E_ALL');
ini_set('date.timezone','Asia/Shanghai'); ini_set('date.timezone','Asia/Shanghai');
ini_set("memory_limit", '2048M'); ini_set("memory_limit", '2048M');
error_reporting(E_ALL); error_reporting(E_ALL);
//日志存储到 php-error.log
/*
//创建任务日志文件 //创建任务日志文件
$log_dir = ROOT_PATH.'/logs/daemon/'.$this->task_name; $log_dir = ROOT_PATH.'/logs/daemon/'.$this->task_name;
$log_path = $log_dir.'/'.$this->task_name.'.log'; $log_path = $log_dir.'/'.$this->task_name.'.log';
...@@ -280,6 +281,7 @@ class Daemon ...@@ -280,6 +281,7 @@ class Daemon
die($log_path."文件无法创建"."\n"); die($log_path."文件无法创建"."\n");
} }
} }
*/
$this->log_signature = "daemon:".$this->task_name; $this->log_signature = "daemon:".$this->task_name;
} }
......
...@@ -14,6 +14,7 @@ use Api\PhpUtils\Common\TimeOut; ...@@ -14,6 +14,7 @@ use Api\PhpUtils\Common\TimeOut;
use Api\PhpUtils\Http\Request; use Api\PhpUtils\Http\Request;
use App\Exception\custom\CodeSpecialException; use App\Exception\custom\CodeSpecialException;
use Api\PhpUtils\Log\FileLog; use Api\PhpUtils\Log\FileLog;
use Api\PhpUtils\Mon\MonUtil;
class JwUser class JwUser
{ {
...@@ -61,7 +62,16 @@ class JwUser ...@@ -61,7 +62,16 @@ class JwUser
$params = ["userId" => $params['user_id']]; $params = ["userId" => $params['user_id']];
//$user_info = (new TimeOut())->runPost($url, $params); //$user_info = (new TimeOut())->runPost($url, $params);
$user_info = (new Request())->post($url, $params, 0, '', '', 0,true,'jw_user'); $begin = microtime(true);
$user_info = (new Request())->post($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin),4) * 1000;
if(!empty($user_info['response'])){
$code = $user_info['response']['code'];
}else{
$code = -1;
}
MonUtil::proxyMon($url, $code, 'jw_user', $total_time);
FileLog::info('jw_user_getUserByUserId', json_encode($user_info)); FileLog::info('jw_user_getUserByUserId', json_encode($user_info));
if (!$user_info) { if (!$user_info) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
......
...@@ -47,7 +47,7 @@ class Ks3Api ...@@ -47,7 +47,7 @@ class Ks3Api
"signature" => $signature, "signature" => $signature,
"type" => $type, "type" => $type,
]; ];
return HttpUtil::POST($url, $params); return HttpUtil::post($url, $params);
} }
/** /**
...@@ -59,12 +59,11 @@ class Ks3Api ...@@ -59,12 +59,11 @@ class Ks3Api
* @param $headers * @param $headers
* @return array * @return array
*/ */
public static function signature($resource, $httpMethod, $contentType, $contentMd5, $headers) public static function signature($resource, $httpMethod, $contentType, $contentMd5, $headers, $date)
{ {
$url = self::BASE_URL . self::PATH_SIGNATURE; $url = self::BASE_URL . self::PATH_SIGNATURE;
$timestamp = self::msectime(); $timestamp = self::msectime();
$date = gmdate(self::KS_DATE_SCHEME);
$md5Str = $httpMethod . "&" . $contentType . "&" . $contentMd5 . "&" . $date . "&" . $resource . "&" . $headers . "&" . $timestamp . "&" . self::KSYUN_SK; $md5Str = $httpMethod . "&" . $contentType . "&" . $contentMd5 . "&" . $date . "&" . $resource . "&" . $headers . "&" . $timestamp . "&" . self::KSYUN_SK;
$signature = self::KSYUN_AK . ":" . md5($md5Str); $signature = self::KSYUN_AK . ":" . md5($md5Str);
...@@ -79,7 +78,7 @@ class Ks3Api ...@@ -79,7 +78,7 @@ class Ks3Api
"resource" => $resource, "resource" => $resource,
"headers" => $headers, "headers" => $headers,
]; ];
return HttpUtil::POST($url, $params); return HttpUtil::post($url, $params);
} }
/** /**
...@@ -113,7 +112,7 @@ class Ks3Api ...@@ -113,7 +112,7 @@ class Ks3Api
"content_type" => $contentType, "content_type" => $contentType,
"extend" => $extendJsonStr, "extend" => $extendJsonStr,
]; ];
return HttpUtil::POST($url, $params); return HttpUtil::post($url, $params);
} }
/** /**
...@@ -140,7 +139,7 @@ class Ks3Api ...@@ -140,7 +139,7 @@ class Ks3Api
"signature" => $signature, "signature" => $signature,
"extend" => $extendJsonStr, "extend" => $extendJsonStr,
]; ];
return HttpUtil::POST($url, $params); return HttpUtil::post($url, $params);
} }
/** /**
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Api\PhpServices\Ksy; namespace Api\PhpServices\Ksy;
use Api\PhpUtils\Http\Request; use Api\PhpUtils\Http\Request;
use Api\PhpUtils\Mon\MonUtil;
class Ksyun class Ksyun
{ {
...@@ -39,8 +40,16 @@ class Ksyun ...@@ -39,8 +40,16 @@ class Ksyun
'bucket' => $bucket, 'bucket' => $bucket,
'expire' => $expire_time, 'expire' => $expire_time,
]; ];
$begin = microtime(true);
$res = (new Request())->post(self::get_down_from_ksyun, $post_data,50, 'json',[],1,true); $res = (new Request())->post(self::get_down_from_ksyun, $post_data,50, 'json',[],1,true);
$end = microtime(true);
$total_time = round(($end - $begin),4) * 1000;
if(isset($res['response']['code'])){
$code = $res['response']['code'];
}else{
$code = -1;
}
MonUtil::proxyMon(self::get_down_from_ksyun, $code, 'merchant', $total_time);
if (isset($res['code'],$res['response']['status']) && $res['response']['status'] === 'success') { if (isset($res['code'],$res['response']['status']) && $res['response']['status'] === 'success') {
return $res['response']['data']; return $res['response']['data'];
} }
......
...@@ -252,7 +252,44 @@ class GetImage ...@@ -252,7 +252,44 @@ class GetImage
return $image_thump; return $image_thump;
} }
private function curlImage($url, $save_dir='',$filename='',$type=0){ private function curlImage($url, $save_dir='',$filename='',$type=0){
$mimes = array(
'image/bmp'=>'bmp',
'image/gif'=>'gif',
'image/jpeg'=>'jpg',
'image/png'=>'png',
'image/tiff'=>'tiff',
'image/x-icon'=>'ico',
'mage/vnd.wap.wbmp'=>'wbmp',
'image/fax'=>'fax',
'image/pnetvue'=>'net',
'image/vnd.rn-realpix'=>'rp'
);
//创建保存目录
if(!file_exists($save_dir)&&!mkdir($save_dir,0777,true)){
return false;
}
// 获取响应头
if(($headers = get_headers($url, 1))!==false){
$type = $headers['Content-Type'];
if(isset($mimes[$type]))
{
$this->extension = $mimes[$type];
$file_path = $save_dir.$filename.".".$this->extension;
$contents = file_get_contents($url);
if(file_put_contents($file_path , $contents))
{
return $save_dir.$filename.".".$this->extension;
}
}
}
}
private function curlImageBak($url, $save_dir='',$filename='',$type=0){
if(trim($url)==''){ if(trim($url)==''){
return array('file_name'=>'','save_path'=>'','error'=>1); return array('file_name'=>'','save_path'=>'','error'=>1);
} }
......
...@@ -25,37 +25,104 @@ use Api\PhpUtils\Mon\MonUtil; ...@@ -25,37 +25,104 @@ use Api\PhpUtils\Mon\MonUtil;
class HttpUtil class HttpUtil
{ {
// 成功
private const CODE_SUCCESS = 0; private const CODE_SUCCESS = 0;
// 失败
private const CODE_FAIL = 999999; private const CODE_FAIL = 999999;
static function HEAD($url, $timeout = 10000, $retries = 1, $headers = false, $proxy = false) /**
* head 请求
* @param string $url 链接地址
* @param int $timeout 超时时间(MS)
* @param int $retries 重试次数
* @param array $headers 请求头
* @param string $proxy 代理地址
* @return array Response
*/
public static function head(string $url, int $timeout = 10000, int $retries = 1, array $headers = [], string $proxy = ''): array
{ {
return self::CURL($url, $timeout, $retries, $headers, false, $proxy, 'HEAD'); return self::curl($url, $timeout, $retries, $headers, false, $proxy, 'HEAD');
} }
static function GET($url, $params, $timeout = 10000, $retries = 1, $headers = false, $proxy = false, $curl_opts = array())
/**
*
* @param string $url
* @param array $params
* @param int $timeout
* @param int $retries
* @param array $headers
* @param string $proxy
* @param array $curl_opts
* @return array
*/
public static function get(string $url,array $params = [], int $timeout = 10000,int $retries = 1, array $headers = [], string $proxy = '',array $curl_opts = []): array
{ {
$url = $url ."?". http_build_query($params); $url = $url ."?". http_build_query($params);
return self::CURL($url, $timeout, $retries, $headers, [], $proxy, 'GET', $curl_opts); return self::curl($url, $timeout, $retries, $headers, [], $proxy, 'GET', $curl_opts);
} }
static function PUT($url, $post, $timeout = 10000, $retries = 1, $headers = false, $proxy = false) /**
* 发起 curl put 请求
* @param string $url url 地址
* @param mixed $post POST 内容 参见 https://www.php.net/manual/en/function.curl-setopt.php CURLOPT_POSTFIELDS
* @param int $timeout 超时时间(MS)
* @param int $retries 重试次数
* @param array $headers 请求头
* @param string $proxy 代理地址
* @return array Response
*/
public static function put(string $url, $post,int $timeout = 10000,int $retries = 1,array $headers = [],string $proxy = ''): array
{ {
return self::CURL($url, $timeout, $retries, $headers, $post, $proxy, 'PUT'); return self::curl($url, $timeout, $retries, $headers, $post, $proxy, 'PUT');
} }
static function POST($url, $post, $timeout = 10000, $retries = 1, $headers = false, $proxy = false, $curl_opts = array()) /**
* 发起 curl post 请求
* @param string $url url 地址
* @param mixed $post POST 内容 参见 https://www.php.net/manual/en/function.curl-setopt.php CURLOPT_POSTFIELDS
* @param int $timeout 超时时间(MS)
* @param int $retries 重试次数
* @param array $headers 请求头
* @param string $proxy 代理地址
* @param array $curl_opts curl 参数
* @return array Response
*/
public static function post(string $url, $post,int $timeout = 10000,int $retries = 1,array $headers = [], string $proxy = '',array $curl_opts = []): array
{ {
return self::CURL($url, $timeout, $retries, $headers, $post, $proxy, 'POST', $curl_opts); return self::curl($url, $timeout, $retries, $headers, $post, $proxy, 'POST', $curl_opts);
} }
static function DELETE($url, $timeout = 10000, $retries = 1, $headers = false, $proxy = false) /**
* 发起 curl delete 请求
* @param string $url url 地址
* @param int $timeout 超时时间(MS)
* @param int $retries 重试次数
* @param array $headers 请求头
* @param string $proxy 代理地址
* @return array Response
*/
public static function delete(string $url, int $timeout = 10000, int $retries = 1, array $headers = [], string $proxy = ''): array
{ {
return self::CURL($url, $timeout, $retries, $headers, false, $proxy, 'DELETE'); return self::curl($url, $timeout, $retries, $headers, false, $proxy, 'DELETE');
} }
static function CURL($url, $timeout, $retries, $headers, $post = false, $proxy = false, $method = 'GET', $curl_opts = array())
/**
* 发起 curl 请求
* @param string $url url 地址
* @param int $timeout 超时时间(MS)
* @param int $retries 重试次数
* @param array $headers 请求头
* @param mixed $post POST 内容 参见 https://www.php.net/manual/en/function.curl-setopt.php CURLOPT_POSTFIELDS
* @param string $proxy 代理地址
* @param string $method 请求方法
* @param array $curl_opts curl 参数
* @return array Response
*/
public static function curl(string $url, int $timeout, int $retries, array $headers, $post, string $proxy = '', string $method = 'GET', array $curl_opts = []): array
{ {
$ch = self::CH($url, $timeout, $headers, $post, $proxy, $method, $curl_opts); $ch = self::ch($url, $timeout, $headers, $post, $proxy, $method, $curl_opts);
$response = self::defaultResponse(); $response = self::defaultResponse();
...@@ -115,17 +182,17 @@ class HttpUtil ...@@ -115,17 +182,17 @@ class HttpUtil
} }
/** /**
* * 生产 curl句柄
* @param $url * @param string $url
* @param $timeout * @param int $timeout
* @param false $headers * @param array $headers
* @param false $post * @param mixed $post
* @param false $proxy * @param string $proxy
* @param string $method * @param string $method
* @param array $curl_opts * @param array $curl_opts
* @return false|mixed|resource * @return false|mixed|resource
*/ */
static function CH($url, $timeout, $headers = false, $post = false, $proxy = false, $method='GET', $curl_opts = array()) private static function ch(string $url,int $timeout,array $headers = [], $post, string $proxy = '', string $method = 'GET', array $curl_opts = [])
{ {
$ch = curl_init($url); $ch = curl_init($url);
...@@ -143,11 +210,11 @@ class HttpUtil ...@@ -143,11 +210,11 @@ class HttpUtil
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $timeout); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $timeout);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
if ($headers !== false) if (! empty($headers))
{ {
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
} }
if ($proxy !== false) if ($proxy)
{ {
curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_PROXY, $proxy);
} }
...@@ -182,16 +249,36 @@ class HttpUtil ...@@ -182,16 +249,36 @@ class HttpUtil
} }
return $ch; return $ch;
} }
static function MULTI_POST($urls, $posts, $timeouts , $headers, $proxies, $curl_opts)
/**
* 并发 curl
* @param array $urls 链接数组
* @param array $timeouts 超时时间数组(MS)
* @param array $posts POST数组 内容 参见 https://www.php.net/manual/en/function.curl-setopt.php CURLOPT_POSTFIELDS
* @param array $headers header 数组
* @param array $proxies 代理地址数组
* @param array $curl_opts curl opts 数组
* @return array
*/
public static function concurrencyPost(array $urls = [], array $posts = [], array $timeouts = [], array $headers = [],array $proxies = [], array $curl_opts = []): array
{ {
$methods = []; $methods = [];
foreach ($urls as $k => $url) { foreach ($urls as $k => $url) {
$methods[$k] = 'POST'; $methods[$k] = 'POST';
} }
return self::MULTI_CURL($urls, $methods, $posts, $timeouts , $headers, $proxies, $curl_opts); return self::concurrencyCurl($urls, $methods, $posts, $timeouts , $headers, $proxies, $curl_opts);
} }
static function MULTI_GET($urls =[],$params = [], $timeouts = [],$headers = [], $proxies = [], $curl_opts = []) /**
* 并发 curl
* @param array $urls 链接数组
* @param array $timeouts 超时时间数组(MS)
* @param array $headers header 数组
* @param array $proxies 代理地址数组
* @param array $curl_opts curl opts 数组
* @return array
*/
public static function concurrencyGet(array $urls = [],$params = [],array $timeouts = [], array $headers = [], array $proxies = [], array $curl_opts = []): array
{ {
$methods = $posts = []; $methods = $posts = [];
foreach ($urls as $k => $url) { foreach ($urls as $k => $url) {
...@@ -200,22 +287,21 @@ class HttpUtil ...@@ -200,22 +287,21 @@ class HttpUtil
$posts[$k] = false; $posts[$k] = false;
} }
return self::MULTI_CURL($urls, $methods, $posts, $timeouts , $headers, $proxies, $curl_opts); return self::concurrencyCurl($urls, $methods, $posts, $timeouts , $headers, $proxies, $curl_opts);
} }
/** /**
* * 并发 curl
* @param array $urls 链接 * @param array $urls 链接数组
* @param array $methods 请求方法 (GET POST ...) * @param array $methods 请求方法数组 (GET POST ...)
* @param array $posts POST 内容 参见 https://www.php.net/manual/en/function.curl-setopt.php CURLOPT_POSTFIELDS * @param array $posts POST数组 内容 参见 https://www.php.net/manual/en/function.curl-setopt.php CURLOPT_POSTFIELDS
* @param array $timeouts * @param array $timeouts 超时时间数组(MS)
* @param array $headers * @param array $headers header 数组
* // * @param int $retry * @param array $proxies 代理地址数组
* @param array $proxies * @param array $curl_opts curl opts 数组
* @param array $curl_opts
* @return array * @return array
*/ */
static function MULTI_CURL($urls = [], $methods = [], $posts = [], $timeouts = [], $headers = [], $proxies = [], $curl_opts = []) public static function concurrencyCurl(array $urls = [], array $methods = [], array $posts = [], array $timeouts = [], array $headers = [], array $proxies = [], array $curl_opts = []): array
{ {
//step one 初始化一个批处理handle //step one 初始化一个批处理handle
$mh = curl_multi_init(); $mh = curl_multi_init();
...@@ -223,7 +309,7 @@ class HttpUtil ...@@ -223,7 +309,7 @@ class HttpUtil
//step two 往批处理handle 添加curl_init来的子handle //step two 往批处理handle 添加curl_init来的子handle
foreach ($urls as $i => $url) foreach ($urls as $i => $url)
{ {
$ch = self::CH($url, $timeouts[$i], $headers[$i], $posts[$i], $proxies[$i], $methods[$i], $curl_opts); $ch = self::CH((string)$url, (int)$timeouts[$i], (array)$headers[$i], $posts[$i], (string)$proxies[$i], (string)$methods[$i], (array)$curl_opts[$i]);
$conn[$i] = $ch; $conn[$i] = $ch;
curl_multi_add_handle($mh, $conn[$i]); curl_multi_add_handle($mh, $conn[$i]);
...@@ -264,10 +350,17 @@ class HttpUtil ...@@ -264,10 +350,17 @@ class HttpUtil
/* /*
* 监控打点,模块名默认为第三方服务url,指标为请求返回的HTTP_code与总响应时间 * 监控打点,模块名默认为第三方服务url,指标为请求返回的HTTP_code与总响应时间
*/ */
private static function addMon($url, $http_code, $request_time) { private static function addMon(string $url,int $http_code,float $request_time) {
MonUtil::proxyMon($url, $http_code, '', $request_time); MonUtil::proxyMon($url, $http_code, '', $request_time);
} }
/**
* 添加log
* @param $method
* @param $urls
* @param $params
* @param $response
*/
private static function addLog($method, $urls, $params, $response) private static function addLog($method, $urls, $params, $response)
{ {
//过滤无意义的日志 //过滤无意义的日志
...@@ -303,29 +396,38 @@ class HttpUtil ...@@ -303,29 +396,38 @@ class HttpUtil
/** /**
* 过滤resource类型字段 * 过滤resource类型字段
* @param array $arr * @param mixed $params array or string resource
* @return array * @return array
*/ */
private static function change($arr) private static function change($params)
{ {
foreach ($arr as $k => $v) { if (is_array($params)) {
if (is_array($v)) { foreach ($params as $k => $v) {
$arr[$k] = self::change($v); if (is_array($v)) {
} else { $params[$k] = self::change($v);
if (strpos(gettype($v), 'resource') !== false) { } else {
$arr[$k] = gettype($v); if (strpos(gettype($v), 'resource') !== false) {
$params[$k] = gettype($v);
}
} }
} }
} }
return $arr; else {
if (strpos(gettype($params), 'resource') !== false) {
$params = gettype($params);
}
}
return $params;
} }
/** /**
* 生成返回结果
* @param string $response_content 请求返回结果 * @param string $response_content 请求返回结果
* @param resource $ch_handle cURL resource * @param resource $ch_handle cURL resource
* @return array * @return array
*/ */
private static function createResponse(string $response_content, $ch_handle): array private static function createResponse(string $response_content, $ch_handle): array
{ {
return [ return [
'code' => curl_errno($ch_handle) === 0 ? self::CODE_SUCCESS : self::CODE_FAIL, 'code' => curl_errno($ch_handle) === 0 ? self::CODE_SUCCESS : self::CODE_FAIL,
......
...@@ -10,7 +10,7 @@ use Api\PhpUtils\Redis\RedisUtil; ...@@ -10,7 +10,7 @@ use Api\PhpUtils\Redis\RedisUtil;
class FrequencyLockUtil class FrequencyLockUtil
{ {
const MIN_FREQUENCY_SECONDS = 30; // 频率锁默认最小间隔秒数 const MIN_FREQUENCY_SECONDS = 3; // 频率锁默认最小间隔秒数
const MIN_FREQUENCY_TIMES = 1; // 频率锁默认最小间隔秒数内最大访问次数 const MIN_FREQUENCY_TIMES = 1; // 频率锁默认最小间隔秒数内最大访问次数
const PREFIX_FREQUENCY_LOCK = 'flk:'; const PREFIX_FREQUENCY_LOCK = 'flk:';
......
...@@ -32,7 +32,7 @@ private static $installed = array ( ...@@ -32,7 +32,7 @@ private static $installed = array (
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '4f8e8782a402f2ef95b6b5b9b21c23da94816828', 'reference' => 'e7fa0b7dd9584f3f9c8b489b4351a6b4858f62ea',
'name' => 'yidian/yaf_demo', 'name' => 'yidian/yaf_demo',
), ),
'versions' => 'versions' =>
...@@ -45,7 +45,7 @@ private static $installed = array ( ...@@ -45,7 +45,7 @@ private static $installed = array (
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => 'f7b44c008d561d3785797073d0eb875fb2f16756', 'reference' => '03c3e30e32f69eb439eb9e116adc0da98538c11b',
), ),
'api/php_utils' => 'api/php_utils' =>
array ( array (
...@@ -55,7 +55,7 @@ private static $installed = array ( ...@@ -55,7 +55,7 @@ private static $installed = array (
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => 'e4bc1258fafead42eb6ac7b84ae743f08d557a99', 'reference' => '3651661da73b73fd8c5a02db0667f3937f4875f8',
), ),
'bacon/bacon-qr-code' => 'bacon/bacon-qr-code' =>
array ( array (
...@@ -196,11 +196,10 @@ private static $installed = array ( ...@@ -196,11 +196,10 @@ private static $installed = array (
), ),
'psr/log' => 'psr/log' =>
array ( array (
'pretty_version' => 'dev-master', 'pretty_version' => '1.1.4',
'version' => 'dev-master', 'version' => '1.1.4.0',
'aliases' => 'aliases' =>
array ( array (
0 => '1.1.x-dev',
), ),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
), ),
...@@ -299,7 +298,7 @@ private static $installed = array ( ...@@ -299,7 +298,7 @@ private static $installed = array (
array ( array (
0 => '1.23.x-dev', 0 => '1.23.x-dev',
), ),
'reference' => 'eca0bf41ed421bed1b57c4958bab16aa86b757d0', 'reference' => '19d03c391c6abb6791f5f757fb36e551bffeaa68',
), ),
'symfony/property-access' => 'symfony/property-access' =>
array ( array (
...@@ -335,7 +334,7 @@ private static $installed = array ( ...@@ -335,7 +334,7 @@ private static $installed = array (
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '4f8e8782a402f2ef95b6b5b9b21c23da94816828', 'reference' => 'e7fa0b7dd9584f3f9c8b489b4351a6b4858f62ea',
), ),
), ),
); );
......
...@@ -102,6 +102,7 @@ return array( ...@@ -102,6 +102,7 @@ return array(
'App\\Models\\goods\\mysql\\GoodsSnapshot' => $baseDir . '/application/models/goods/mysql/GoodsSnapshot.php', 'App\\Models\\goods\\mysql\\GoodsSnapshot' => $baseDir . '/application/models/goods/mysql/GoodsSnapshot.php',
'App\\Models\\goods\\mysql\\GoodsSpu' => $baseDir . '/application/models/goods/mysql/GoodsSpu.php', 'App\\Models\\goods\\mysql\\GoodsSpu' => $baseDir . '/application/models/goods/mysql/GoodsSpu.php',
'App\\Models\\goods\\mysql\\InventoryOperationRecord' => $baseDir . '/application/models/goods/mysql/InventoryOperationRecord.php', 'App\\Models\\goods\\mysql\\InventoryOperationRecord' => $baseDir . '/application/models/goods/mysql/InventoryOperationRecord.php',
'App\\Models\\goods\\mysql\\LifeAccountShopNum' => $baseDir . '/application/models/goods/mysql/LifeAccountShopNum.php',
'App\\Models\\goods\\mysql\\PaySuccessGoodsCallbackRecord' => $baseDir . '/application/models/goods/mysql/PaySuccessGoodsCallbackRecord.php', 'App\\Models\\goods\\mysql\\PaySuccessGoodsCallbackRecord' => $baseDir . '/application/models/goods/mysql/PaySuccessGoodsCallbackRecord.php',
'App\\Models\\goods\\mysql\\Shop' => $baseDir . '/application/models/goods/mysql/Shop.php', 'App\\Models\\goods\\mysql\\Shop' => $baseDir . '/application/models/goods/mysql/Shop.php',
'App\\Models\\goods\\mysql\\Tcc' => $baseDir . '/application/models/goods/mysql/Tcc.php', 'App\\Models\\goods\\mysql\\Tcc' => $baseDir . '/application/models/goods/mysql/Tcc.php',
......
...@@ -331,6 +331,7 @@ class ComposerStaticInit90e85a2e64f8339192f3e91b8700b9f2 ...@@ -331,6 +331,7 @@ class ComposerStaticInit90e85a2e64f8339192f3e91b8700b9f2
'App\\Models\\goods\\mysql\\GoodsSnapshot' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSnapshot.php', 'App\\Models\\goods\\mysql\\GoodsSnapshot' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSnapshot.php',
'App\\Models\\goods\\mysql\\GoodsSpu' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSpu.php', 'App\\Models\\goods\\mysql\\GoodsSpu' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSpu.php',
'App\\Models\\goods\\mysql\\InventoryOperationRecord' => __DIR__ . '/../..' . '/application/models/goods/mysql/InventoryOperationRecord.php', 'App\\Models\\goods\\mysql\\InventoryOperationRecord' => __DIR__ . '/../..' . '/application/models/goods/mysql/InventoryOperationRecord.php',
'App\\Models\\goods\\mysql\\LifeAccountShopNum' => __DIR__ . '/../..' . '/application/models/goods/mysql/LifeAccountShopNum.php',
'App\\Models\\goods\\mysql\\PaySuccessGoodsCallbackRecord' => __DIR__ . '/../..' . '/application/models/goods/mysql/PaySuccessGoodsCallbackRecord.php', 'App\\Models\\goods\\mysql\\PaySuccessGoodsCallbackRecord' => __DIR__ . '/../..' . '/application/models/goods/mysql/PaySuccessGoodsCallbackRecord.php',
'App\\Models\\goods\\mysql\\Shop' => __DIR__ . '/../..' . '/application/models/goods/mysql/Shop.php', 'App\\Models\\goods\\mysql\\Shop' => __DIR__ . '/../..' . '/application/models/goods/mysql/Shop.php',
'App\\Models\\goods\\mysql\\Tcc' => __DIR__ . '/../..' . '/application/models/goods/mysql/Tcc.php', 'App\\Models\\goods\\mysql\\Tcc' => __DIR__ . '/../..' . '/application/models/goods/mysql/Tcc.php',
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_services.git", "url": "https://git.yidian-inc.com:8021/bp/php_services.git",
"reference": "f7b44c008d561d3785797073d0eb875fb2f16756" "reference": "03c3e30e32f69eb439eb9e116adc0da98538c11b"
}, },
"require": { "require": {
"api/php_utils": "dev-master", "api/php_utils": "dev-master",
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"perftools/php-profiler": "^0.18.0", "perftools/php-profiler": "^0.18.0",
"php": "7.2.*" "php": "7.2.*"
}, },
"time": "2021-07-14T09:06:17+00:00", "time": "2021-07-17T15:33:26+00:00",
"default-branch": true, "default-branch": true,
"type": "library", "type": "library",
"installation-source": "source", "installation-source": "source",
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_utils.git", "url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "e4bc1258fafead42eb6ac7b84ae743f08d557a99" "reference": "3651661da73b73fd8c5a02db0667f3937f4875f8"
}, },
"require": { "require": {
"elasticsearch/elasticsearch": "~7.0", "elasticsearch/elasticsearch": "~7.0",
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
"mongodb/mongodb": "1.4.3", "mongodb/mongodb": "1.4.3",
"php": "7.2.*" "php": "7.2.*"
}, },
"time": "2021-07-14T08:30:41+00:00", "time": "2021-07-14T14:21:31+00:00",
"default-branch": true, "default-branch": true,
"type": "library", "type": "library",
"installation-source": "source", "installation-source": "source",
...@@ -950,8 +950,8 @@ ...@@ -950,8 +950,8 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "dev-master", "version": "1.1.4",
"version_normalized": "dev-master", "version_normalized": "1.1.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
...@@ -967,7 +967,6 @@ ...@@ -967,7 +967,6 @@
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
"time": "2021-05-03T11:20:27+00:00", "time": "2021-05-03T11:20:27+00:00",
"default-branch": true,
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
...@@ -1685,18 +1684,18 @@ ...@@ -1685,18 +1684,18 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php80.git", "url": "https://github.com/symfony/polyfill-php80.git",
"reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" "reference": "19d03c391c6abb6791f5f757fb36e551bffeaa68"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/19d03c391c6abb6791f5f757fb36e551bffeaa68",
"reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", "reference": "19d03c391c6abb6791f5f757fb36e551bffeaa68",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.1"
}, },
"time": "2021-02-19T12:13:01+00:00", "time": "2021-07-13T14:34:27+00:00",
"default-branch": true, "default-branch": true,
"type": "library", "type": "library",
"extra": { "extra": {
...@@ -1747,7 +1746,7 @@ ...@@ -1747,7 +1746,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-php80/tree/main"
}, },
"funding": [ "funding": [
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '4f8e8782a402f2ef95b6b5b9b21c23da94816828', 'reference' => 'e7fa0b7dd9584f3f9c8b489b4351a6b4858f62ea',
'name' => 'yidian/yaf_demo', 'name' => 'yidian/yaf_demo',
), ),
'versions' => 'versions' =>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => 'f7b44c008d561d3785797073d0eb875fb2f16756', 'reference' => '03c3e30e32f69eb439eb9e116adc0da98538c11b',
), ),
'api/php_utils' => 'api/php_utils' =>
array ( array (
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => 'e4bc1258fafead42eb6ac7b84ae743f08d557a99', 'reference' => '3651661da73b73fd8c5a02db0667f3937f4875f8',
), ),
'bacon/bacon-qr-code' => 'bacon/bacon-qr-code' =>
array ( array (
...@@ -170,11 +170,10 @@ ...@@ -170,11 +170,10 @@
), ),
'psr/log' => 'psr/log' =>
array ( array (
'pretty_version' => 'dev-master', 'pretty_version' => '1.1.4',
'version' => 'dev-master', 'version' => '1.1.4.0',
'aliases' => 'aliases' =>
array ( array (
0 => '1.1.x-dev',
), ),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
), ),
...@@ -273,7 +272,7 @@ ...@@ -273,7 +272,7 @@
array ( array (
0 => '1.23.x-dev', 0 => '1.23.x-dev',
), ),
'reference' => 'eca0bf41ed421bed1b57c4958bab16aa86b757d0', 'reference' => '19d03c391c6abb6791f5f757fb36e551bffeaa68',
), ),
'symfony/property-access' => 'symfony/property-access' =>
array ( array (
...@@ -309,7 +308,7 @@ ...@@ -309,7 +308,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '4f8e8782a402f2ef95b6b5b9b21c23da94816828', 'reference' => 'e7fa0b7dd9584f3f9c8b489b4351a6b4858f62ea',
), ),
), ),
); );
...@@ -16,7 +16,7 @@ This component provides features added to PHP 8.0 core: ...@@ -16,7 +16,7 @@ This component provides features added to PHP 8.0 core:
- [`get_resource_id`](https://php.net/get_resource_id) - [`get_resource_id`](https://php.net/get_resource_id)
More information can be found in the More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). [main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
License License
======= =======
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment