CreateKeywordLogic.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
53
54
55
56
57
58
59
60
<?php
/**
* @remark :
* @name :CreateKeywordLogic.php
* @author :lyh
* @method :post
* @time :2023/12/19 9:45
*/
namespace App\Http\Logic\Aside\Optimize;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Com\CreateKeyword;
class CreateKeywordLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new CreateKeyword();
$this->param = $this->requestAll;
}
/**
* @remark :保存关键字
* @name :saveCreateKeyword
* @author :lyh
* @method :post
* @time :2023/12/19 9:47
*/
public function saveKeyword(){
$data = $this->handleParam($this->param);
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->model->edit($data,['id'=>$this->param['id']]);
}else{
$this->model->add($data);
}
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
/**
* @remark :请求参数处理
* @name :handleParam
* @author :lyh
* @method :post
* @time :2023/12/19 10:03
*/
public function handleParam($param){
$data = [
'type'=>$param['type'],
'name'=>$param['name']
];
return $this->success($data);
}
}