用户修改信息后 给腾讯同步昵称和头像

This commit is contained in:
2025-08-20 16:07:20 +08:00
parent 5b61c68811
commit 7c8d5432ba
3 changed files with 39 additions and 1 deletions

View File

@@ -726,6 +726,35 @@ class Tencent extends Model
return ['code' => 0, 'msg' => $reslut['ErrorCode'], 'data' => null];
}
}
//修改用户信息
public function modify_user_info($member_id, $member_name = '', $member_face_url = '')
{
$config = get_system_config();
$tencentyun_im_appid = $config['tencentyun_im_appid'];
$im_admin = 'administrator';
$admin_sig = $this->tencent_user_sig_info($im_admin);
$rand = rand(111111111,9999999999);
$postUrl = 'https://console.tim.qq.com/v4/profile/portrait_set?sdkappid='.$tencentyun_im_appid.'&identifier='.$im_admin.'&usersig='.$admin_sig.'&random='.$rand.'&contenttype=json';
$curlPost['From_Account'] = $member_id;
$curlPost['ProfileItem'] = [
[
'Tag' => 'Tag_Profile_IM_Nick',
'Value' => $member_name
],
[
'Tag' => 'Tag_Profile_IM_Image',
'Value' => $member_face_url
]
];
$curlPost = json_encode($curlPost);
$reslut = $this->tencent_post_url($postUrl, $curlPost);
if($reslut['ActionStatus'] == 'OK'){
return ['code' => 1, 'msg' => '操作成功', 'data' => null];
}else{
return ['code' => 0, 'msg' => $reslut['ErrorCode'], 'data' => null];
}
}
//====新写的↓=====上面的 能用则用=============================================================================================================