Request   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pushExtendFieldsItem() 0 7 2
A pushCopyAgentItem() 0 7 2
1
<?php
2
/**
3
 * This file is part of the mucts.com.
4
 *
5
 * This source file is subject to the MIT license that is bundled
6
 * with this source code in the file LICENSE.
7
 *
8
 * @version 1.0
9
 * @author herry<[email protected]>
10
 * @copyright © 2020  MuCTS.com All Rights Reserved.
11
 */
12
13
namespace MuCTS\Sobot\Tickets\SaveAgentTicket;
14
15
16
/**
17
 * Class Request
18
 * /**
19
 * Class Request
20
 * 创建工单(坐席)
21
 *
22
 * 备注:
23
 * 1、此处所传工单自定义字段,必须是所传工单分类id关联工单模板中的自定义字段。
24
 * 2、分类关联模板中的自定义字段通过“查询工单分类关联的工单模板信息“接口获取。
25
 * 3、工单分类ID需要调用“查询数据字典”中工单分类获取具体值。
26
 * 4、如需上传附件,需要调用“附件上传(坐席)”进行。
27
 *
28
 * @property-write string $companyid 企业ID
29
 * @property-write string $ticket_title 工单标题
30
 * @property-write string $userid 客户ID
31
 * @property-write string $ticket_content 工单问题描述
32
 * @property-write int $ticket_from 工单来源,1 PC客户留言,2 H5客户留言,3 微信公众号客户留言,4 APP客户留言,12 邮件留言,13语音留言,16微信小程序客户留言,17企业微信客户留言
33
 * @property-write string $deal_groupid 受理技能组ID
34
 * @property-write string $deal_group_name 受理技能组名称
35
 * @property-write string $deal_agentid 受理坐席ID
36
 * @property-write string $deal_agent_name 受理坐席名称
37
 * @property-write string $create_agentid 创建坐席ID
38
 * @property-write string $create_agent_name 创建坐席名称
39
 * @property-write string $recordid 记录ID,呼叫记录ID或会话记录ID
40
 * @property-write int $ticket_status 工单状态,0尚未受理,1受理中,2等待回复,3已解决,99已关闭,98已删除
41
 * @property-write int $ticket_level 工单优先级,0低,1中,2高,3紧急
42
 * @property-write string $ticket_typeid 工单分类ID,叶子节点的分类ID
43
 * @property-write string $file_str 附件路径,多个附件,附件之间采用英文分号";"隔开
44
 * @property-write array $copy_agent 抄送坐席,格式:[["agent_name"=>"坐席名称","agent_mail"=>"坐席邮箱"]]
45
 * @property-write array $extend_fields 工单自定义字段信息,格式:[["fieldid"=>"自定义字段ID","field_value"=>"自定义字段值"]]
46
 *
47
 * @method Request companyid(string $companyid) 企业ID
48
 * @method Request ticketTitle(string $ticketTitle) 工单标题
49
 * @method Request userid(string $userid) 客户ID
50
 * @method Request ticketContent(string $ticketContent) 工单问题描述
51
 * @method Request ticketFrom(string $ticketFrom) 工单来源, 1 PC客户留言,2 H5客户留言,3 微信公众号客户留言,4 APP客户留言,12 邮件留言,13语音留言,16微信小程序客户留言,17企业微信客户留言
52
 * @method Request dealGroupid(string $dealGroupid) 受理技能组ID
53
 * @method Request dealGroupName(string $dealGroupName) 受理技能组名称
54
 * @method Request dealAgentid(string $dealAgentid) 受理坐席ID
55
 * @method Request dealAgentName(string $dealAgentName) 受理坐席名称
56
 * @method Request createAgentid(string $createAgentid) 创建坐席ID
57
 * @method Request createAgentName(string $createAgentName) 创建坐席名称
58
 * @method Request recordid(string $recordid) 记录ID, 呼叫记录ID或会话记录ID
59
 * @method Request ticketStatus(int $ticketStatus) 工单状态, 0尚未受理,1受理中,2等待回复,3已解决,99已关闭,98已删除
60
 * @method Request ticketLevel(int $ticketLevel) 工单优先级, 0低,1中,2高,3紧急
61
 * @method Request ticketTypeid(string $ticketTypeid) 工单分类ID, 叶子节点的分类ID
62
 * @method Request fileStr(string $fileStr) 附件路径, 多个附件,附件之间采用英文分号";"隔开
63
 * @method Request copyAgent(array $copyAgent) 抄送坐席,格式:[["agent_name" => "坐席名称", "agent_mail" => "坐席邮箱"]]
64
 * @method Request extendFields(array $extendFields) 工单自定义字段信息,格式:[["fieldid" => "自定义字段ID", "field_value" => "自定义字段值"]]
65
 * @package MuCTS\Sobot\Tickets\Request
66
 */
67
class Request extends \MuCTS\Sobot\Contracts\Request
68
{
69
    /**
70
     * 追加工单自定义字段信息
71
     *
72
     * @param string $fieldid
73
     * @param string $fieldValue
74
     * @return $this
75
     */
76
    public function pushExtendFieldsItem(string $fieldid, string $fieldValue)
77
    {
78
        if (!array_key_exists('extend_fields', $this->param)) {
79
            $this->param['extend_fields'] = [];
80
        }
81
        $this->param['extend_fields'][] = ['fieldid' => $fieldid, 'field_value' => $fieldValue];
82
        return $this;
83
    }
84
85
    /**
86
     * 追加抄送坐席项
87
     *
88
     * @param string $agentName
89
     * @param string $agentMail
90
     * @return $this
91
     */
92
    public function pushCopyAgentItem(string $agentName, string $agentMail)
93
    {
94
        if (!array_key_exists('copy_agent', $this->param)) {
95
            $this->param['copy_agent'] = [];
96
        }
97
        $this->param['copy_agent'][] = ['agent_name' => $agentName, 'agent_mail' => $agentMail];
98
        return $this;
99
    }
100
}