ReInquiryDetailLog.php
1.6 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2024/10/08
* Time: 14:10
*/
namespace App\Models\Inquiry;
use Illuminate\Database\Eloquent\Model;
/**
* 转发详情日志
* Class ReInquiryDetailLog
* @package App\Models\Inquiry
*/
class ReInquiryDetailLog extends Model
{
/**
* @var string
*/
protected $table = 'gl_re_inquiry_detail_log';
/**
* 任务状态, 0:初始化,1:待处理,2:处理成功,9:处理失败
*/
const STATUS_INIT = 0;
const STATUS_PEND = 1;
const STATUS_SUCCESS = 2;
const STATUS_FAIL = 9;
/**
* 执行类型, 1:访问, 2:询盘
*/
const TYPE_VISIT = 1;
const TYPE_INQUIRY = 2;
/**
* 状态映射
* @return array
*/
public static function statusMap()
{
return [
self::STATUS_INIT => '初始化',
self::STATUS_PEND => '待处理',
self::STATUS_SUCCESS => '处理成功',
self::STATUS_FAIL => '处理失败',
];
}
/**
* 创建转发详情日志
* @param $detail_id
* @param $type
* @param $pre
* @param $url
* @param $start_at
* @return ReInquiryDetailLog
*/
public static function createInquiryLog($detail_id, $type, $pre, $url, $start_at)
{
$self = self::where(compact('detail_id', 'type', 'pre'))->first();
if ($self)
return $self;
$self = new self();
$self->detail_id = $detail_id;
$self->type = $type;
$self->pre = $pre;
$self->url = $url;
$self->start_at = $start_at;
$self->save();
return $self;
}
}