Request   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A pushExtendFieldsItem() 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\SaveUserTicket;
14
15
/**
16
 * Class Request
17
 * 创建工单(客户)
18
 *
19
 * 1)调用此接口,系统会根据提交的参数按此优先级“客户ID > 对接ID > 客户邮箱 > 客户手机号”查找客户,如果匹配成功,用该客户作为工单关联客户,否则新建客户后关联。
20
 * 备注:
21
 * 1、此处所传工单自定义字段,必须是所传工单分类id关联工单模板中的自定义字段。
22
 * 2、分类关联模板中的自定义字段通过“查询工单分类关联的工单模板信息“接口获取。
23
 * 3、工单分类ID需要调用“查询数据字典”中工单分类获取具体值。
24
 * 4、如需上传附件,需要调用“附件上传(客户)”进行。
25
 *
26
 * @property-write string $companyid 企业ID
27
 * @property-write string $partnerid 对接ID
28
 * @property-write string $ticket_title 工单标题
29
 * @property-write string $userid 客户ID
30
 * @property-write string $ticket_content 工单问题描述
31
 * @property-write string $user_emails 客户邮箱
32
 * @property-write string $user_tels 客户电话
33
 * @property-write string $ticket_typeid 工单分类ID,叶子节点的分类ID
34
 * @property-write int $ticket_from 工单来源,1 PC客户留言,2 H5客户留言,3 微信公众号客户留言,4 APP客户留言,12 邮件留言,13语音留言,16微信小程序客户留言,17企业微信客户留言
35
 * @property-write string $file_str 附件路径,多个附件,附件之间采用英文分号";"隔开
36
 * @property-write array $extend_fields 工单自定义字段信息,格式:[["fieldid"=>"自定义字段ID","field_value"=>"自定义字段值"]]
37
 *
38
 * @method Request companyid(string $companyid) 企业ID
39
 * @method Request ticketTitle(string $ticketTitle) 工单标题
40
 * @method Request userid(string $userid) 客户ID
41
 * @method Request partnerid(string $partnerid) 对接ID
42
 * @method Request ticketContent(string $ticketContent) 工单问题描述
43
 * @method Request userEmails(string $userEmails) 客户邮箱
44
 * @method Request userTels(string $userTels) 客户电话
45
 * @method Request ticketTypeid(string $ticketTypeid) 工单分类ID, 叶子节点的分类ID
46
 * @method Request ticketFrom(string $ticketFrom) 工单来源, 1 PC客户留言,2 H5客户留言,3 微信公众号客户留言,4 APP客户留言,12 邮件留言,13语音留言,16微信小程序客户留言,17企业微信客户留言
47
 * @method Request fileStr(string $fileStr) 附件路径, 多个附件,附件之间采用英文分号";"隔开
48
 * @method Request extendFields(array $extendFields) 工单自定义字段信息,格式:[["fieldid" => "自定义字段ID", "field_value" => "自定义字段值"]]
49
 * @package MuCTS\Sobot\Tickets\SaveUserTicket
50
 */
51
class Request extends \MuCTS\Sobot\Contracts\Request
52
{
53
    /**
54
     * 追加工单自定义字段信息
55
     *
56
     * @param string $fieldid
57
     * @param string $fieldValue
58
     * @return $this
59
     */
60
    public function pushExtendFieldsItem(string $fieldid, string $fieldValue)
61
    {
62
        if (!array_key_exists('extend_fields', $this->param)) {
63
            $this->param['extend_fields'] = [];
64
        }
65
        $this->param['extend_fields'][] = ['fieldid' => $fieldid, 'field_value' => $fieldValue];
66
        return $this;
67
    }
68
}