onix-systems-php / hyperf-support
此包的最新版本(v1.0.18)没有可用的许可信息。
Hyperf Web应用的支持模块
v1.0.18
2024-07-23 07:28 UTC
Requires
- php: >=8.1
- friendsofhyperf/helpers: ^3.1
- hyperf/di: *
- hyperf/framework: ^3.1
- hyperf/guzzle: ^3.1
- onix-systems-php/hyperf-actions-log: ^1.2
- onix-systems-php/hyperf-core: *
- onix-systems-php/hyperf-file-upload: ^1.2
- zircote/swagger-php: ^4.9
Requires (Dev)
- phpunit/phpunit: ^10.0
- symfony/var-dumper: ^7.0
This package is auto-updated.
Last update: 2024-09-23 07:52:21 UTC
README
Hyperf-support是一个用于流畅管理Slack、Trello和其他系统内票据和评论的包。由onix-systems-php制作。
安装
composer require onix-systems-php/hyperf-support
发布配置
php bin/hyperf.php vendor:publish onix-systems-php/hyperf-support
配置
配置app
domain
- 应用程序URL,例如(https://github.com)。name
- 应用程序名称。team_name
- 支持团队的名称。user_model_class
- 用户模型路径。然后在模型类中实现OnixSystemsPHP\HyperfSupport\Contract\SupportUserInterface
接口。
配置integrations.trello
key
- API密钥。(您可以在https://trello.com/power-ups/admin中找到它)token
- 授权令牌。webhook_url
-app.domain
+/v1/support/webhooks/trello
。board_name
- Trello看板名称。members
- 对于每种票据类型,指定应该附加到Trello卡片上的成员。lists
- 指定票据每种状态与Trello上相应列表的映射。custom_fields
- 确定哪些自定义字段应该出现在Trello卡片上。trigger_lists
- 指定Trello上的触发列表。这些列表确定是否在票据移动到这些列表之一时通知用户。is_private_discussion
- 此选项必须是true
或false
。如果是true
,Trello上票据下的讨论将是私密的,除了Trello之外任何人都可以看到。keys_to_source
- 指定your_api_username
=>your_source
。
配置integrations.slack
token
- 机器人授权密钥。channel_id
- Slack频道ID。- 不要忘记启用您的Slack机器人的订阅,并指定请求URL:
app.domain
+/v1/support/webhooks/trello
。 app_icon
- 您应用程序的图标URL。例如trello_icon
- Trello图标URL。(可选)members
- 对于每种票据类型,指定应该在Slack票据上提及的成员。不要使用'@'。custom_fields
- 确定哪些自定义字段应该显示在Slack票据上。is_private_discussion
- 此选项必须是true
或false
。如果是true
,Slack上票据下的讨论将是私密的,除了Slack之外任何人都可以看到。keys_to_source
- 指定your_slack_channel_id
=>your_source
。
配置routes
require_once './vendor/onix-systems-php/hyperf-support/publish/routes.php';
基本用法
创建简单票据
尝试通过POST
方法将此JSON
发送到/v1/support/tickets
。
{ "source": "default", "title": "Lorem ipsum.", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "custom_fields": { "type": "Tweak", "level": 3, "priority": "Medium", "status": "New" }, "page_url": "https://google.com" }
您应该得到类似以下的对象
{ "id": 1, "title": "Lorem ipsum.", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "source": "default", "custom_fields": { "type": "Tweak", "level": 3, "status": "New", "priority": "Medium" }, "created_by": 6, "modified_by": null, "deleted_by": null, "completed_at": null, "trello_id": "660bc45ce19c204556caf1f5", "trello_short_link": "qTHPdFoL", "slack_id": "1712047194.779679", "page_url": null, "created_at": "2024-04-02 08:39:54", "updated_at": "2024-04-02 08:40:36", "deleted_at": null, "files": [] }
最后,它应该出现在Slack和Trello上。
创建带文件的票据
逻辑与创建简单票据相同,但您需要传递包含文件ID的数组
{ ... "files": [1, 2, 3] }
最后,票据应该出现在Slack和Trello上,并附加了文件。
在Trello上更新票据。
每次当票据移动到Trello上的“完成”列表时,如果ticket.done_status
是“完成”,则票据将被标记为“已完成”。