作者 李宇航

合并分支 'master-lyh-edit' 到 'master'

gx



查看合并请求 !610
... ... @@ -257,4 +257,25 @@ class BaseController extends Controller
}
return 0;
}
/**
* @remark :批量通知C端
* @name :sendHttpC
* @author :lyh
* @method :post
* @time :2024/6/6 10:26
*/
public function sendHttpC($url = []){
//其他服务器:请求对应C端接口
$c_url = $this->user['domain'].'api/update_page/';
$param = [
'project_id' => $this->user['project_id'],
'type' => 1,
'route' => 3,
'url' => $url,
'language'=> [],
'is_sitemap' => 0
];
return http_post($c_url, json_encode($param));
}
}
... ...
... ... @@ -218,8 +218,17 @@ class KeywordController extends BaseController
'title.max' => '批量操作不能超过500条数据'
]);
$keywordModel = new Keyword();
foreach ($this->param['title'] as $v){
$keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>$v]);
$rs = $keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>['in',$this->param['title']]]);
if($rs === false){
$this->fail('编辑失败,请联系管理员');
}
if($this->param['is_video_keyword'] == 1){
$url = [];
$keywordList = $keywordModel->list(['title'=>['in',$this->param['title']]],'id',['id','route','is_video_keyword']);
foreach ($keywordList as $v){
$url[] = $v['route'];
}
$this->sendHttpC($url);
}
$this->response('success');
}
... ...
... ... @@ -186,4 +186,25 @@ class BaseLogic extends Logic
}
return $this->success();
}
/**
* @remark :批量通知C端
* @name :sendHttpC
* @author :lyh
* @method :post
* @time :2024/6/6 10:26
*/
public function sendHttpC($url = []){
//其他服务器:请求对应C端接口
$c_url = $this->user['domain'].'api/update_page/';
$param = [
'project_id' => $this->user['project_id'],
'type' => 1,
'route' => 3,
'url' => $url,
'language'=> [],
'is_sitemap' => 0
];
return http_post($c_url, json_encode($param));
}
}
... ...
... ... @@ -61,9 +61,15 @@ class KeywordLogic extends BaseLogic
if($info !== false){
$this->fail('当前title已存在');
}
//TODO::不能修改路由
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $this->param['id'], $this->user['project_id']);
$this->param['route'] = $route;
//todo::通知C端生成
if(isset($this->param['is_video_keyword']) && ($this->param['is_video_keyword'] == 1)){
$info = $this->model->read(['id'=>$this->param['id']],['id','is_video_keyword','video']);
if(($info['is_video_keyword'] != $this->param['is_video_keyword']) && ($info['video'] != null || $info['video'] != '')){
$this->sendHttpC([$route]);
}
}
$this->model->edit($this->param,['id'=>$this->param['id']]);
$data = ['id'=>$this->param['id']];
}else{
... ... @@ -125,10 +131,11 @@ class KeywordLogic extends BaseLogic
}
/**
* 批量添加关键词任务, 异步处理
* @return array
* @throws BsideGlobalException
* @throws \App\Exceptions\AsideGlobalException
* @remark :批量添加关键词任务, 异步处理
* @name :batchAdd
* @author :lyh
* @method :post
* @time :2024/6/6 10:27
*/
public function batchAdd(){
try {
... ...