Passed
Push — master ( d9652e...414fd1 )
by Yao
05:27 queued 03:54
created

ResponseCnEnum::getStartTypeCn()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 2 Features 0
Metric Value
eloc 6
c 3
b 2
f 0
dl 0
loc 10
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
4
namespace MuCTS\Sobot\Contracts;
5
/**
6
 * Trait ResponseCnEnum
7
 * @mixin Response
8
 * @package MuCTS\Sobot\Contracts
9
 */
10
trait ResponseCnEnum
11
{
12
    /**
13
     * 工单发起人类型
14
     *
15
     * @return string|null
16
     * @author herry.yao <[email protected]>
17
     * @version 1.2.2
18
     * @date 2020-08-06
19
     */
20
    public function getStartTypeCn()
21
    {
22
        /** @var int $startType */
23
        $startType = $this->start_type;
24
        if (is_null($startType)) return null;
0 ignored issues
show
introduced by
The condition is_null($startType) is always false.
Loading history...
25
        $startTypeCn = [
26
            0 => '坐席',
27
            1 => '客戶'
28
        ];
29
        return $startTypeCn[$startType] ?? '未知';
30
    }
31
32
    /**
33
     * 工单状态
34
     *
35
     * @return string|null
36
     * @author herry.yao <[email protected]>
37
     * @version 1.2.2
38
     * @date 2020-08-06
39
     */
40
    public function getTicketStatusCn()
41
    {
42
        /** @var int $ticketStatus */
43
        $ticketStatus = $this->ticket_status;
44
        if (is_null($ticketStatus)) return null;
0 ignored issues
show
introduced by
The condition is_null($ticketStatus) is always false.
Loading history...
45
        $ticketStatusCn = [
46
            0 => '尚未受理',
47
            1 => '受理中',
48
            2 => '等待回复',
49
            3 => '已解决',
50
            99 => '已关闭',
51
            98 => '已删除',
52
        ];
53
        return $ticketStatusCn[$ticketStatus] ?? '未知';
54
    }
55
56
    /**
57
     * 工单优先级
58
     *
59
     * @return string|null
60
     * @author herry.yao <[email protected]>
61
     * @version 1.2.2
62
     * @date 2020-08-06
63
     */
64
    public function getTicketLevelCn()
65
    {
66
        /** @var int $ticketLevel */
67
        $ticketLevel = $this->ticket_level;
68
        if (is_null($ticketLevel)) return null;
0 ignored issues
show
introduced by
The condition is_null($ticketLevel) is always false.
Loading history...
69
        $ticketLevelCn = [
70
            0 => '低',
71
            1 => '中',
72
            2 => '高',
73
            3 => '紧急'
74
        ];
75
        return $ticketLevelCn[$ticketLevel] ?? '未知';
76
    }
77
78
    /**
79
     * 工单来源
80
     *
81
     * @return string|null
82
     * @author herry.yao <[email protected]>
83
     * @version 1.2.2
84
     * @date 2020-08-06
85
     */
86
    public function getTicketFromCn()
87
    {
88
        /** @var int $ticketFrom */
89
        $ticketFrom = $this->ticket_from;
90
        if (is_null($ticketFrom)) return null;
0 ignored issues
show
introduced by
The condition is_null($ticketFrom) is always false.
Loading history...
91
        $ticketFromCn = [
92
            0 => '工单中心',
93
            1 => 'PC客户留言',
94
            2 => 'H5客户留言',
95
            3 => '微信公众号客户留言',
96
            4 => 'APP客户留言',
97
            6 => 'PC-在线工作台',
98
            7 => '客户中心',
99
            8 => '呼叫中心',
100
            9 => '微信公众号-在线工作台',
101
            10 => 'H5-在线工作台',
102
            11 => 'APP-在线工作台',
103
            12 => '邮件留言',
104
            13 => '语音留言',
105
            14 => '微信小程序-在线工作台',
106
            15 => '企业微信-在线工作台',
107
            16 => '微信小程序客户留言',
108
            17 => '企业微信客户留言',
109
        ];
110
        return $ticketFromCn[$ticketFrom] ?? '未知';
111
    }
112
113
    /**
114
     * 回复类型
115
     *
116
     * @return string|null
117
     * @author herry.yao <[email protected]>
118
     * @version 1.2.2
119
     * @date 2020-08-07
120
     */
121
    public function getReplyTypeCn()
122
    {
123
        /** @var int $replyType */
124
        $replyType = $this->reply_type;
125
        if (is_null($replyType)) return null;
0 ignored issues
show
introduced by
The condition is_null($replyType) is always false.
Loading history...
126
        $replyTypeCn = [
127
            0 => '所有人可见',
128
            1 => '仅坐席可见'
129
        ];
130
        return $replyTypeCn[$replyType] ?? '未知';
131
    }
132
133
    /**
134
     * 自定义字段类型
135
     *
136
     * @return string|null
137
     * @author herry.yao <[email protected]>
138
     * @version 1.2.2
139
     * @date 2020-08-07
140
     */
141
    protected function getFieldTypeCn()
142
    {
143
        /** @var int $fieldType */
144
        $fieldType = $this->field_type;
145
        if (is_null($fieldType)) return null;
0 ignored issues
show
introduced by
The condition is_null($fieldType) is always false.
Loading history...
146
        $fieldTypeCn = [
147
            1 => '单行文本',
148
            2 => '多行文本',
149
            3 => '日期',
150
            4 => '时间',
151
            5 => '数值',
152
            6 => '下拉列表',
153
            7 => '复选框',
154
            8 => '单选框'
155
        ];
156
        return $fieldTypeCn[$fieldType] ?? '未知';
157
    }
158
159
    /**
160
     * 操作记录来源
161
     *
162
     * @return string|null
163
     * @author herry.yao <[email protected]>
164
     * @version 1.2.2
165
     * @date 2020-08-07
166
     */
167
    public function getLogFromCn()
168
    {
169
        /** @var int $logFrom */
170
        $logFrom = $this->log_from;
171
        if (is_null($logFrom)) return null;
0 ignored issues
show
introduced by
The condition is_null($logFrom) is always false.
Loading history...
172
        $logFromCn = [
173
            1 => '页面操作',
174
            2 => '流转触发器',
175
            3 => '定时触发器'
176
        ];
177
        return $logFromCn[$logFrom] ?? '未知';
178
    }
179
180
    /**
181
     * 发送者类型
182
     * @return string|null
183
     */
184
    public function getSenderTypeCn()
185
    {
186
        /** @var int $senderType */
187
        $senderType = $this->sender_type;
188
        if (is_null($senderType)) return null;
0 ignored issues
show
introduced by
The condition is_null($senderType) is always false.
Loading history...
189
        $senderTypeCn = [
190
            0 => '用户',
191
            1 => '机器人',
192
            2 => '客服'
193
        ];
194
        return $senderTypeCn[$senderType] ?? '未知';
195
    }
196
197
    /**
198
     * 接收者类型
199
     * @return string|null
200
     */
201
    public function getReceiverTypeCn()
202
    {
203
        /** @var int $receiverType */
204
        $receiverType = $this->receiver_type;
205
        if (is_null($receiverType)) return null;
0 ignored issues
show
introduced by
The condition is_null($receiverType) is always false.
Loading history...
206
        $receiverTypeCn = [
207
            0 => '用户',
208
            1 => '机器人',
209
            2 => '客服'
210
        ];
211
        return $receiverTypeCn[$receiverType] ?? '未知';
212
    }
213
214
    /**
215
     * 消息类型:0-文本,1-图片,2-音频,3-富文本
216
     *
217
     * @return string|null
218
     */
219
    public function getMsgTypeCn()
220
    {
221
        /** @var int $msgType */
222
        $msgType = $this->msg_type;
223
        if (is_null($msgType)) return null;
0 ignored issues
show
introduced by
The condition is_null($msgType) is always false.
Loading history...
224
        $msgTypeCn = [
225
            0 => '文本',
226
            1 => '图片',
227
            2 => '音频',
228
            3 => '富文本'
229
        ];
230
        return $msgTypeCn[$msgType] ?? '未知';
231
    }
232
233
    /**
234
     * 坐席状态
235
     * @return string|null
236
     */
237
    public function getAgentStatusCn()
238
    {
239
        /** @var int $agentStatus */
240
        $agentStatus = $this->agent_status;
241
        if (is_null($agentStatus)) return null;
0 ignored issues
show
introduced by
The condition is_null($agentStatus) is always false.
Loading history...
242
        $agentStatusCn = [
243
            0 => '未激活',
244
            1 => '启用中',
245
            2 => '平台管控',
246
            9 => '停用',
247
            -1 => '删除'
248
        ];
249
        return $agentStatusCn[$agentStatus] ?? '未知';
250
    }
251
}