ReInquiryTask.php
1.5 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
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2024/9/30
* Time: 14:12
*/
namespace App\Models\Inquiry;
use App\Models\Base;
use Illuminate\Database\Eloquent\Model;
/**
* 广告转询盘任务
* Class ReInquiryTask
* @package App\Models\Inquiry
*/
class ReInquiryTask extends Base
{
/**
* @var string
*/
protected $table = 'gl_re_inquiry_task';
/**
* 任务状态, 1:开启(默认), 0:关闭
*/
const STATUS_OPEN = 1;
const STATUS_CLOSE = 0;
/**
* 创建询盘任务
* @param $id
* @param $title
* @param $industry
* @param $ad_id
* @param $ad_url
* @param $ad_img
* @param $num
* @param int $status
* @return ReInquiryTask
*/
public static function createTask($id, $title, $industry, $ad_id, $ad_url, $ad_img, $num, $status = self::STATUS_OPEN)
{
$self = self::where(['id' => $id])->first();
if (empty($self))
$self = new self();
$self->title = $title;
$self->industry = $industry;
$self->ad_id = $ad_id;
$self->ad_url = $ad_url;
$self->ad_img = $ad_img;
$self->num = $num;
$self->status = $status;
$self->save();
return $self;
}
public function setTarget($id, $target){
$self = self::where(['id' => $id])->first();
if (empty($self)) {
}
}
/**
* @param $value
* @return mixed
*/
public function getTargetAttribute($value)
{
return json_decode($value, true);
}
}