@ -2695,17 +2695,21 @@ class Information extends CI_Controller
$ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article'));
$data['meta_news_createdate'] = $this->get_publish_date_in_6_month($information);
$data['ads_by_google'] = $ads_by_google;
$data['author'] = ''; //获取作者信息
$data['author_name '] = ''; //获取作者信息
$author = $this->Operator_model->get_author_nikename($information->ic_author);
$author_url = '';
$author_info = $this->get_author_info('japanhighlights.com', $author->OPI_Code);
$data['author_info'] = $author_info;
if (!empty($author)) {
$data['author'] = $author->OPI_FirstName;
$data['author_name '] = $author->OPI_FirstName;
$data['OPI_Code'] = $author->OPI_Code;
$author_url = $this->get_author_url('www.japanhighlights.com', $author->OPI_Code);
} else {
$author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等
if (!empty($author_web)) {
$data['author'] = $author_web->a_name;
$data['author_name '] = $author_web->a_name;
}
}
$data['breadcrumb_data'] = $breadcrumb_data;
@ -2714,7 +2718,7 @@ class Information extends CI_Controller
// 结构化标签: Article
$article_structured_data_content = $this->load->view(
$template_path . '-structured-data-article',
array('information' => $information, 'author_name' => $data['author'], 'author_url' => $author_url),
array('information' => $information, 'author_name' => $data['author_name '], 'author_url' => $author_url),
true
);
$template = str_replace('<!-- @STRUCTURED - DATA - ARTICLE - BLOCK@ --> ', $article_structured_data_content, $template);
@ -6143,7 +6147,7 @@ class Information extends CI_Controller
return true;
}
public function get_author_url($domain_name, $OPI_Code)
public function get_author_url($domain_name, $OPI_Code)
{
$OPI_CodeUrls = [
'zzy' => 'https://' . $domain_name .'/aboutus/team/ruru-zhou',
@ -6189,4 +6193,84 @@ class Information extends CI_Controller
return '';
}
}
// 获取作者信息,包括头像、领域、主页
private function get_author_info($domain_name, $OPI_Code)
{
// 定义URL模板
$baseUrl = 'https://www.' . $domain_name . '/aboutus/team/';
$urlSuffix = ($domain_name == 'chinahighlights.com') ? '.htm' : '';
// 共享的URL结构
$OPI_CodeUrls = [
'zzy' => $baseUrl . 'ruru-zhou' . $urlSuffix,
'HWT' => $baseUrl . 'mike-he' . $urlSuffix,
'CA' => $baseUrl . 'carol-wang' . $urlSuffix,
'SI' => $baseUrl . 'simon-huang' . $urlSuffix,
'TJQ' => $baseUrl . 'cindy-tang' . $urlSuffix,
'CLA' => $baseUrl . 'claire-wang' . $urlSuffix,
'Albee' => $baseUrl . 'albee-ning' . $urlSuffix,
'KM' => $baseUrl . 'kimi-huang' . $urlSuffix,
'RY' => $baseUrl . 'rita-yu' . $urlSuffix,
'QMY' => $baseUrl . 'chris-quan' . $urlSuffix,
'CY' => $baseUrl . 'cynthia-li' . $urlSuffix,
'Vicky' => $baseUrl . 'vicky-leng' . $urlSuffix,
'LXW' => $baseUrl . 'carper-li' . $urlSuffix,
];
// 共享的头像和专长映射
$expertiseMap = [
'zzy' => [
'expertise' => 'Japan Content Expert',
'avatar' => 'https://images.'. $domain_name . '/allpicture/2024/03/bc1583b921a24cc3be739e57d290f582_cut_300x300_608.JPG'
],
'HWT' => [
'expertise' => 'Thailand Content Expert',
'avatar' => 'https://images.'. $domain_name . '/allpicture/2024/03/5dc9f81961c24725895205d65123b8e7_cut_300x300_608.JPG'
],
'TJQ' => [
'expertise' => 'Thailand Content Expert',
'avatar' => 'https://images.'. $domain_name . '/allpicture/2024/03/513a1f2af9e54157932fbe157a8862d3_cut_300x300_608.JPG'
],
'RY' => [
'expertise' => 'Vietnam Content Expert',
'avatar' => 'https://images.'. $domain_name . '/allpicture/2024/03/8895dc76301e47a094c0c86048a2c39a_cut_300x300_608.JPG'
],
'QMY' => [
'expertise' => 'China Content Expert',
'avatar' => 'https://images.'. $domain_name . '/allpicture/2024/03/8097b02a5f2c4486824ffecc045a4125_cut_300x300_608.JPG'
],
'CY' => [
'expertise' => 'Japan Content Expert',
'avatar' => 'https://images.'. $domain_name . '/allpicture/2024/03/65499011c0714e0aa1271bc300d9399d_cut_300x300_608.JPG'
],
'Vicky' => [
'expertise' => 'Japan Content Expert',
'avatar' => 'https://images.'. $domain_name . '/allpicture/2024/03/a2d6ac5a7ccb4c06a3d8f1bbf939bdf5_cut_300x300_608.JPG'
],
'LXW' => [
'expertise' => 'Japan Content Expert',
'avatar' => 'https://images.'. $domain_name . '/allpicture/2024/03/b002b9e61b464e24956fea8f17e2ef37_cut_300x300_608.JPG',
],
];
// 构建作者数据
$authorData = [];
foreach ($OPI_CodeUrls as $key => $url) {
if (isset($expertiseMap[$key])) {
$authorData[$key] = [
'url' => $url,
'avatar' => $expertiseMap[$key]['avatar'],
'expertise' => $expertiseMap[$key]['expertise'],
'name' => $expertiseMap[$key]['name']
];
}
}
// 合并重复项
$authorData['2'] = $authorData['zzy'];
$authorData['zzyGH'] = $authorData['zzy'];
return isset($authorData[$OPI_Code]) ? $authorData[$OPI_Code] : ['url' => '', 'avatar' => '', 'expertise' => '', 'name' => ''];
}
}