正在显示
4 个修改的文件
包含
65 行增加
和
7 行删除
| @@ -257,4 +257,25 @@ class BaseController extends Controller | @@ -257,4 +257,25 @@ class BaseController extends Controller | ||
| 257 | } | 257 | } |
| 258 | return 0; | 258 | return 0; |
| 259 | } | 259 | } |
| 260 | + | ||
| 261 | + /** | ||
| 262 | + * @remark :批量通知C端 | ||
| 263 | + * @name :sendHttpC | ||
| 264 | + * @author :lyh | ||
| 265 | + * @method :post | ||
| 266 | + * @time :2024/6/6 10:26 | ||
| 267 | + */ | ||
| 268 | + public function sendHttpC($url = []){ | ||
| 269 | + //其他服务器:请求对应C端接口 | ||
| 270 | + $c_url = $this->user['domain'].'api/update_page/'; | ||
| 271 | + $param = [ | ||
| 272 | + 'project_id' => $this->user['project_id'], | ||
| 273 | + 'type' => 1, | ||
| 274 | + 'route' => 3, | ||
| 275 | + 'url' => $url, | ||
| 276 | + 'language'=> [], | ||
| 277 | + 'is_sitemap' => 0 | ||
| 278 | + ]; | ||
| 279 | + return http_post($c_url, json_encode($param)); | ||
| 280 | + } | ||
| 260 | } | 281 | } |
| @@ -218,8 +218,17 @@ class KeywordController extends BaseController | @@ -218,8 +218,17 @@ class KeywordController extends BaseController | ||
| 218 | 'title.max' => '批量操作不能超过500条数据' | 218 | 'title.max' => '批量操作不能超过500条数据' |
| 219 | ]); | 219 | ]); |
| 220 | $keywordModel = new Keyword(); | 220 | $keywordModel = new Keyword(); |
| 221 | - foreach ($this->param['title'] as $v){ | ||
| 222 | - $keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>$v]); | 221 | + $rs = $keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>['in',$this->param['title']]]); |
| 222 | + if($rs === false){ | ||
| 223 | + $this->fail('编辑失败,请联系管理员'); | ||
| 224 | + } | ||
| 225 | + if($this->param['is_video_keyword'] == 1){ | ||
| 226 | + $url = []; | ||
| 227 | + $keywordList = $keywordModel->list(['title'=>['in',$this->param['title']]],'id',['id','route','is_video_keyword']); | ||
| 228 | + foreach ($keywordList as $v){ | ||
| 229 | + $url[] = $v['route']; | ||
| 230 | + } | ||
| 231 | + $this->sendHttpC($url); | ||
| 223 | } | 232 | } |
| 224 | $this->response('success'); | 233 | $this->response('success'); |
| 225 | } | 234 | } |
| @@ -186,4 +186,25 @@ class BaseLogic extends Logic | @@ -186,4 +186,25 @@ class BaseLogic extends Logic | ||
| 186 | } | 186 | } |
| 187 | return $this->success(); | 187 | return $this->success(); |
| 188 | } | 188 | } |
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * @remark :批量通知C端 | ||
| 192 | + * @name :sendHttpC | ||
| 193 | + * @author :lyh | ||
| 194 | + * @method :post | ||
| 195 | + * @time :2024/6/6 10:26 | ||
| 196 | + */ | ||
| 197 | + public function sendHttpC($url = []){ | ||
| 198 | + //其他服务器:请求对应C端接口 | ||
| 199 | + $c_url = $this->user['domain'].'api/update_page/'; | ||
| 200 | + $param = [ | ||
| 201 | + 'project_id' => $this->user['project_id'], | ||
| 202 | + 'type' => 1, | ||
| 203 | + 'route' => 3, | ||
| 204 | + 'url' => $url, | ||
| 205 | + 'language'=> [], | ||
| 206 | + 'is_sitemap' => 0 | ||
| 207 | + ]; | ||
| 208 | + return http_post($c_url, json_encode($param)); | ||
| 209 | + } | ||
| 189 | } | 210 | } |
| @@ -61,9 +61,15 @@ class KeywordLogic extends BaseLogic | @@ -61,9 +61,15 @@ class KeywordLogic extends BaseLogic | ||
| 61 | if($info !== false){ | 61 | if($info !== false){ |
| 62 | $this->fail('当前title已存在'); | 62 | $this->fail('当前title已存在'); |
| 63 | } | 63 | } |
| 64 | - //TODO::不能修改路由 | ||
| 65 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $this->param['id'], $this->user['project_id']); | 64 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $this->param['id'], $this->user['project_id']); |
| 66 | $this->param['route'] = $route; | 65 | $this->param['route'] = $route; |
| 66 | + //todo::通知C端生成 | ||
| 67 | + if(isset($this->param['is_video_keyword']) && ($this->param['is_video_keyword'] == 1)){ | ||
| 68 | + $info = $this->model->read(['id'=>$this->param['id']],['id','is_video_keyword','video']); | ||
| 69 | + if(($info['is_video_keyword'] != $this->param['is_video_keyword']) && ($info['video'] != null || $info['video'] != '')){ | ||
| 70 | + $this->sendHttpC([$route]); | ||
| 71 | + } | ||
| 72 | + } | ||
| 67 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 73 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 68 | $data = ['id'=>$this->param['id']]; | 74 | $data = ['id'=>$this->param['id']]; |
| 69 | }else{ | 75 | }else{ |
| @@ -125,10 +131,11 @@ class KeywordLogic extends BaseLogic | @@ -125,10 +131,11 @@ class KeywordLogic extends BaseLogic | ||
| 125 | } | 131 | } |
| 126 | 132 | ||
| 127 | /** | 133 | /** |
| 128 | - * 批量添加关键词任务, 异步处理 | ||
| 129 | - * @return array | ||
| 130 | - * @throws BsideGlobalException | ||
| 131 | - * @throws \App\Exceptions\AsideGlobalException | 134 | + * @remark :批量添加关键词任务, 异步处理 |
| 135 | + * @name :batchAdd | ||
| 136 | + * @author :lyh | ||
| 137 | + * @method :post | ||
| 138 | + * @time :2024/6/6 10:27 | ||
| 132 | */ | 139 | */ |
| 133 | public function batchAdd(){ | 140 | public function batchAdd(){ |
| 134 | try { | 141 | try { |
-
请 注册 或 登录 后发表评论