InquiryRelayDetailLog.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
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2024/10/08
* Time: 14:10
*/
namespace App\Models\Inquiry;
use App\Models\Base;
/**
* 转发详情日志
* Class ReInquiryDetailLog
* @package App\Models\Inquiry
*/
class InquiryRelayDetailLog extends Base
{
/**
* @var string
*/
protected $table = 'gl_inquiry_relay_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
*/
public static function createInquiryLog($detail_id, $type, $pre, $url, $start_at)
{
$self = self::where(compact('detail_id', 'type', 'pre'))->first();
if (!$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();
}
}
}