51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?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);
|
||
}
|
||
}
|
||
} |