InquiryFilterConfig.php
1.3 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
<?php
namespace App\Models\Project;
use App\Models\Base;
use Illuminate\Support\Facades\Cache;
/**
* 询盘过滤配置
* Class InquiryFilterConfig
* @package App\Models\Project
* @author zbj
* @date 2024/1/19
*/
class InquiryFilterConfig extends Base
{
//设置关联表名
protected $table = 'gl_project_inquiry_filter_config';
protected $casts = [
'filter_countries' => 'array',
'filter_contents' => 'array',
'filter_referers' => 'array',
'filter_emails' => 'array',
'filter_mobiles' => 'array',
'filter_names' => 'array',
'black_ips' => 'array',
];
/**
* @param $project_id
* @return string
* @author zbj
* @date 2024/1/20
*/
public static function cacheKey($project_id): string
{
return 'project_inquiry_filter_config_info' . $project_id;
}
/**
* @param $project_id
* @return mixed
* @author zbj
* @date 2024/1/20
*/
public static function getCacheInfoByProjectId($project_id){
$info = Cache::get(self::cacheKey($project_id));
if (!$info) {
$info = self::where('project_id', $project_id)->first();
Cache::put(self::cacheKey($project_id), $info, 2 * 3600);
}
return $info;
}
}