作者 张关杰

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

... ... @@ -33,10 +33,11 @@ class UpdateController extends BaseController
* @method :post
* @time :2023/8/19 9:25
*/
public function updateSeoTdk(){
public function updateSeoTdk()
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
], [
'project_id.required' => 'project_id不能为空',
]);
ProjectUpdateTdk::add_task($this->param['project_id']);
... ... @@ -48,14 +49,50 @@ class UpdateController extends BaseController
* @author Akun
* @date 2023/11/24 11:33
*/
public function dataCollect(){
public function dataCollect()
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
'type' => 'required',
], [
'project_id.required' => 'project_id不能为空',
'type.required' => '采集类型不能为空',
]);
UpdateLog::updateLog($this->param['project_id']);
$this->response('任务添加成功');
$collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get();
if ($collect_un->count() > 0) {
$this->fail('项目正在采集中');
}
$project = ProjectServer::useProject($this->param['project_id']);
if(!$project){
$this->fail('项目不存在');
}
if ($project->is_upgrade != 1) {
$this->fail('非升级无法进行采集操作');
}
try {
DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
} catch (\Exception $e) {
errorLog('重新采集升级项目数据', $this->param, $e);
$this->fail('采集任务添加失败');
}
//关闭数据库
DB::disconnect('custom_mysql');
$update = ['collect_status' => 0];
if ($this->param['type'] == 2) {
$update['status'] = 0;
}
UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update);
$this->response('采集任务添加成功');
}
}
... ...
... ... @@ -55,6 +55,8 @@ class ProjectAssociationController extends BaseController
{
$project_id = (int)request()->input('project_id', 0);
$status = request()->input('status');
// 重载redis缓存
$cache = request()->input('cache');
if (isset($status)) {
$status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED;
}
... ... @@ -90,8 +92,16 @@ class ProjectAssociationController extends BaseController
if (is_null($isRes)) {
$this->response('请开启AICC绑定!', Code::USER_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));
} else {
$result = json_decode($result, true);
}
$result['info'] = [
'friend_id' => $isRes->friend_id ?? 0,
'nickname' => $isRes->nickname ?? '',
... ...
... ... @@ -111,9 +111,6 @@ class DomainInfoLogic extends BaseLogic
/**
* 删除域名
* @return array
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
*/
public function delDomain(){
$ids = $this->param['id'];
... ...