It has to be said that many people in China are not accustomed to using email, and some do not even have a Gravatar avatar. Therefore, the theme has been optimized to some extent for the situation in China. If a QQ email address is used, the QQ avatar will be called; otherwise, the Gravatar avatar will continue to be called. This is convenient for both QQ users and Gravatar users. This method will not slow down webpage loading, and can be said to be a relatively good solution.

First, we found the interface for obtaining a QQ avatar: https://q.qlogo.cn/g?b=qq&nk=52958812&s=100. However, we cannot directly obtain the commenter's QQ number, so we need to obtain the commenter's email address:
get_comment($parent_id)->comment_author_email);
Once we have the email address, we determine whether it is a QQ email address:
if(strpos($qqmail, '@qq.com'))
If it is a QQ email address, the QQ avatar is called:
$avatar_source = 'q.qlogo.cn';
$img = 'g?b=qq&nk=' . preg_replace('/@qq.com/', '', $qqmail) . '&s=100';
Otherwise, the Gravatar avatar is still called:
$avatar_source = 'cn.gravatar.com';
$img = 'avatar/$1?s=$2';
And with that, the problem is happily solved.
The complete code is as follows:
// Gravatar 头像
function get_avatar_javst($avatar) {
$protocol = is_ssl() ? 'https' : 'http';
$qqmail = trim(get_comment($parent_id)->comment_author_email);
if (strpos($qqmail, '@qq.com')) {
$avatar_source = 'q.qlogo.cn';
$img = 'g?b=qq&nk=' . preg_replace('/@qq.com/', '', $qqmail) . '&s=100';
} else {
$avatar_source = 'cn.gravatar.com';
$img = 'avatar/$1?s=$2';
}
$avatar = preg_replace('/.*\/avatar\/(.*)\?s=([\d]+)&.*/', '<img class="avatar avatar-$2" src="' . $protocol . '://' . $avatar_source . '/' . $img . '" width="$2" height="$2" />', $avatar);
return $avatar;
}
add_filter('get_avatar', 'get_avatar_javst');