ReInquiryDetail.php
2.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2024/9/30
* Time: 14:56
*/
namespace App\Models\Inquiry;
use Illuminate\Database\Eloquent\Model;
/**
* 询盘转发详情
* Class ReInquiryDetail
* @package App\Models\Inquiry
*/
class ReInquiryDetail extends Model
{
/**
* @var string
*/
protected $table = 'gl_re_inquiry_detail';
/**
* 任务状态, 0:初始化,1:待处理,2:处理成功,3:抛弃数据,9:处理失败
*/
const STATUS_INIT = 0;
const STATUS_PEND = 1;
const STATUS_SUCCESS = 2;
const STATUS_FORGO = 3;
const STATUS_FAIL = 9;
/**
* 状态映射
* @return array
*/
public static function statusMap()
{
return [
self::STATUS_INIT => '初始化',
self::STATUS_PEND => '待处理',
self::STATUS_SUCCESS => '处理成功',
self::STATUS_FORGO => '抛弃数据',
self::STATUS_FAIL => '处理失败',
];
}
/**
* 创建询盘转发详情待处理任务
* @param $task_id
* @param $form_id
* @param $re_website
* @param $country
* @param $ip
* @param $name
* @param $email
* @param $phone
* @param $message
* @param $text_id
* @param $device_port
* @param $user_agent
* @param $referrer
* @param $urls
* @param $is_v6
* @param $start_at
* @param int $status
* @return ReInquiryDetail
*/
public static function createInquiry($task_id, $form_id, $re_website, $country, $ip, $name, $email, $phone, $message, $text_id, $device_port,
$user_agent, $referrer, $urls, $is_v6, $start_at, $status = self::STATUS_INIT)
{
$self = new self();
$self->task_id = $task_id;
$self->form_id = $form_id;
$self->re_website = $re_website;
$self->country = $country;
$self->ip = $ip;
$self->name = $name;
$self->email = $email;
$self->phone = $phone;
$self->message = $message;
$self->text_id = $text_id;
$self->device_port = $device_port;
$self->user_agent = $user_agent;
$self->referrer = $referrer;
$self->urls = json_encode($urls);
$self->is_v6 = $is_v6;
$self->num = count($urls) + 1;
$self->start_at = $start_at;
$self->status = $status;
$self->save();
return $self;
}
/**
* 转发日志详情
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function detailLog()
{
return $this->hasMany(ReInquiryDetailLog::class, 'detail_id', 'id');
}
}