新增腾讯im。

This commit is contained in:
2023-03-09 16:01:03 +08:00
parent e1a015e960
commit 0850d6e3f3
19 changed files with 1265 additions and 46 deletions
+51
View File
@@ -0,0 +1,51 @@
<?php
namespace Extend\TencentIm;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use GuzzleHttp\Exception\GuzzleException;
/**
* 账户资料
*/
class Profile extends Base
{
private string $version = 'v4';
/**
* 设置账户资料
* @param string $user_id 用户id
* @param array $arg
* 内置字段:https://cloud.tencent.com/document/product/269/1500#.E6.A0.87.E9.85.8D.E8.B5.84.E6.96.99.E5.AD.97.E6.AE.B5
* 自定义字段:控制台->应用配置>功能配置->新增
* Tag_Profile_Custom_Hname:医院名称
* Tag_Profile_Custom_Title:医生职称
* @return array
* @throws GuzzleException
*/
public function setProfile(string $user_id,array $arg): array
{
try {
$profileItem = [];
foreach ($arg as $key => $value){
$profileItem[] = [
'Tag' => $key,
'Value' => $value
];
}
$options = [
"json"=> [
"From_Account" => $user_id,
"ProfileItem" => $profileItem,
]
];
$path = $this->config['base_url'] . $this->version . "/profile/portrait_set?" . $this->buildRequestParams();
return $this->postRequest($path,$options);
}catch (\Exception $e) {
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
}
}
}