[ "From_Account" => $user_id, "AddFriendItem" => [ [ "To_Account" => $friend_user_id, "AddSource" => "AddSource_Type_Applets", // 加好友来源字段 ] ], "ForceAddFlags" => 1, // 管理员强制加好友标记:1表示强制加好友,0表示常规加好友方式 ] ]; $path = $this->config['base_url'] . $this->version . "/profile/portrait_set?" . $this->buildRequestParams(); $result = $this->postRequest($path,$options); if (isset($result['Fail_Account'])){ // 返回处理失败的用户列表,仅当存在失败用户时才返回该字段 throw new BusinessException("添加好友异常,未返回结果:" . json_encode($result['ResultItem'],JSON_UNESCAPED_UNICODE)); } return $result; }catch (\Exception $e) { throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR); } } }