AggregateKeywordLogic.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* @remark :
* @name :AggregateKeywordLogic.php
* @author :lyh
* @method :post
* @time :2025/3/17 16:10
*/
namespace App\Http\Logic\Aside\Project;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Product\Keyword;
use App\Models\Project\AggregateKeyword;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class AggregateKeywordLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new AggregateKeyword();
}
/**
* @remark :保存关键词
* @name :saveKeyword
* @author :lyh
* @method :post
* @time :2025/3/17 16:11
*/
public function saveKeyword(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$id = $this->model->addReturnId($this->param);
//保存到客户关键词
$keywords = explode("\n", $this->param['keywords']);
if(!empty($keywords)){
ProjectServer::useProject($this->param['project_id']);
$keywordModel = new Keyword();
$keywordModel->saveBKeyword($this->param['project_id'],$keywords);
DB::disconnect('custom_mysql');
}
}
return $this->success(['id'=>$id]);
}
}