作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

... ... @@ -83,10 +83,12 @@ class HtmlCollect extends Command
//采集html页面,下载资源到本地并替换
try {
$html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);
if ($html == '0') {
if ($html == '0' || strpos($html,'404 Not Found') !== false) {
$collect_info->status = CollectTask::STATUS_FAIL;
$collect_info->save();
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: no html' . PHP_EOL;
$error = $html == '0' ? 'no html' : '404 not found';
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $error . PHP_EOL;
sleep(2);
return true;
}
... ...
... ... @@ -85,10 +85,12 @@ class HtmlLanguageCollect extends Command
//采集html页面,下载资源到本地并替换
try {
$html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);
if ($html == '0') {
if ($html == '0' || strpos($html,'404 Not Found') !== false) {
$collect_info->status = CollectTask::STATUS_FAIL;
$collect_info->save();
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: no html' . PHP_EOL;
$error = $html == '0' ? 'no html' : '404 not found';
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $error . PHP_EOL;
sleep(2);
return true;
}
... ...
... ... @@ -85,10 +85,12 @@ class HtmlLanguageSpecialCollect extends Command
//采集html页面,下载资源到本地并替换
try {
$html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);
if ($html == '0') {
if ($html == '0' || strpos($html,'404 Not Found') !== false) {
$collect_info->status = CollectTask::STATUS_FAIL;
$collect_info->save();
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: no html' . PHP_EOL;
$error = $html == '0' ? 'no html' : '404 not found';
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $error . PHP_EOL;
sleep(2);
return true;
}
... ...
... ... @@ -51,12 +51,16 @@ class ProjectAssociationController extends BaseController
$this->response('success');
}
/**
* 获取aicc用户列表 并返回绑定的数据
* @return array|void
*/
public function check()
{
$project_id = (int)request()->input('project_id', 0);
$status = request()->input('status');
// 重载redis缓存
$cache = request()->input('cache');
$cache = request()->input('cache');
if (isset($status)) {
$status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED;
}
... ... @@ -87,17 +91,19 @@ class ProjectAssociationController extends BaseController
}
} catch (\Exception $exception) {
DB::rollBack();
$this->response('数据错误,请重试!', Code::SERVER_ERROR);
// 数据错误,请重试
$this->response('error', Code::SERVER_ERROR);
}
if (is_null($isRes)) {
$this->response('请开启AICC绑定!', Code::USER_ERROR, []);
// 请开启AICC绑定
$this->response('success', Code::SERVER_ERROR);
}
$redis_key = 'aicc_friend_lists_' . (int)env('AICC_WECHAT_USER_ID');
$result = isset($cache) ? false : redis_get($redis_key);
if (empty($result)) {
$url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL');
$result = curlGet($url);
redis_set($redis_key, json_encode($result));
redis_set($redis_key, json_encode($result), 60);
} else {
$result = json_decode($result, true);
}
... ...