ReInquiryText.php
1.1 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
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2024/9/30
* Time: 14:23
*/
namespace App\Models\Inquiry;
use Illuminate\Database\Eloquent\Model;
/**
* 询盘内置文案
* Class ReInquiryText
* @package App\Models\Inquiry
*/
class ReInquiryText extends Model
{
/**
* @var string
*/
protected $table = 'gl_re_inquiry_text';
/**
* 文案状态, 1:开启(默认), 2:禁用
*/
const STATUS_USABLE = 1;
const STATUS_DISABLE = 2;
/**
* 创建询盘内置文案
* @param $id
* @param $title
* @param $content
* @param int $status
* @return ReInquiryText
*/
public static function createText($id, $title, $content, $status = self::STATUS_USABLE)
{
$self = self::where(['id' => $id])->first();
if (empty($self)) {
$self = new self();
// 同步 询盘文案,以ID为唯一值
$self->id = $id;
}
$self->title = $title;
$self->content = $content;
$self->status = $status;
$self->save();
return $self;
}
}