/data/www/CMS/Modules/Api/Http/Controllers/it168/ArticleapiController.php
if (count($keywordids) != count($keywordnames)) {
$count = count($keywordids) > count($keywordnames) ? count($keywordnames) : count($keywordids);
}
for ($i = 0; $i < $count; $i++) {
if ($result != '')
$result .= ',';
$result .= ('<a href="http://www.it168.com/hotwords/' . $keywordids[$i] . '_1.shtml">' . $keywordnames[$i] . '</a>');
}
return $result;
}
/**
* 获取频道列表中单文章右侧图片html
* @param $article 文章数组
* @return string 返回html
* author Fox
*/
public static function getDsHtml($article)
{
$result = '<div class="left_imgcon1_2"><div class="left_imgcon1_2_1"><a href="' . $article['_score']['it168_url'] . '" target="_blank"><img src="' . $article['_source']['it168_avatar'].'_s240x180' . '" onload="if(this.height>150) this.height=150;" onerror="this.src=\'/detailinclude/channelfile/onerror.png\'"></a></div></div>';
return $result;
}
public static function getRecommend($params){
$result = '';
if (!(array_key_exists('ArticleId', $params) && array_key_exists('ChannelId', $params))) {
return $result;
}
$articleId = $params['ArticleId'];
$articleId = strlen(intval($articleId)) == strlen($articleId) ? intval($articleId):$articleId;
$channelId = $params['ChannelId'].'i';
$pageIndex = $params['PageIndex'];
$isnew = array_key_exists('isnew', $params);
//判断文章ID 和频道ID不能为空
if (!(\Extend\Libs\Util::varExists($articleId) && \Extend\Libs\Util::varExists($channelId))) {
echo '';
exit;
Arguments
8
"Undefined index: it168_avatar"
"/data/www/CMS/Modules/Api/Http/Controllers/it168/ArticleapiController.php"
982
array:1 [
"article" => array:6 [
"_index" => "cms-v1"
"_type" => "cms_new"
"_id" => "67e36766f7ca6423f759c78b"
"_score" => null
"_source" => array:9 [
"keywords" => array:1 [
0 => "厂商供稿"
]
"it168_channelid" => "29i"
"authorname" => "网络"
"keywordids" => array:1 [
0 => 692788
]
"it168_url" => "http://software.it168.com/a2025/0326/6881/000006881658.shtml"
"id" => 6881658
"it168_publishtime" => "2025-03-26T02:40:26Z"
"abstract" => "随着新一轮科技革命和产业变革深入发展,人工智能已成为驱动新质生产力的重要引擎。在此背景下,作为AI服务器内部及跨设备互联的“神经中枢”,AI高速互联传输线缆的技术突破直接决定算力效能与数据中心的运行效率,而传统单通道10G/25G线缆已难以满足AI大模型对112G/224G超高速传输的刚性需求。"
"title" => "连接AI算力 安澜万锦发力AI服务器高速互联传输线缆"
]
"sort" => array:1 [
0 => 1742956826000
]
]
]
/data/www/CMS/Modules/Api/Http/Controllers/it168/ArticleapiController.php
}
$str = '';
foreach ($data as $k=>$v){
$str .= $v['_source']['id'].',';
}
$str = trim($str,',');
$res = file_get_contents('http://comment-lan.it168.com/api/countcomment?d='.$str);
$res = json_decode($res,true);
foreach ($data as $item) {
$itemhtml = str_replace('{0}', $item['_source']['it168_url'], $itemtemp);
$itemhtml = str_replace('{1}', $item['_source']['id'], $itemhtml);
$itemhtml = str_replace('{2}', $typeid, $itemhtml);
$itemhtml = str_replace('{3}', $item['_source']['title'], $itemhtml);
$itemhtml = str_replace('{4}', $item['_source']['authorname'], $itemhtml);
$itemhtml = str_replace('{5}', date('Y-m-d',totime($item['_source']['it168_publishtime'])), $itemhtml);
$itemhtml = str_replace('{6}', self::getKeyWordHtml($item['_source']['keywordids'], $item['_source']['keywords']), $itemhtml);
$itemhtml = str_replace('{7}', $item['_source']['abstract'], $itemhtml);
$itemhtml = str_replace('{8}', self::getDsHtml($item), $itemhtml);
$itemhtml = str_replace('~', '{', $itemhtml);
$itemhtml = str_replace('^', '}', $itemhtml);
$itemhtml = str_replace('{11}', isset($res[$item['_source']['id']])?$res[$item['_source']['id']]:0, $itemhtml);
$itemshtml .= $itemhtml;
}
//endregion
//region 获取tabnum
$str2 = self::getTabNum($typeid);
//endregion
$str3 = self::getPage($typeid, 0, $brandidstr, $keyword, $tagnames, $selectchannelids);
$duoshuojson = self::getDuoShuoThreadsHtml($data);
$result = "$itemshtml<div id=\"pageTab$str2\"></div><script type=\"text/javascript\">$(\"#pageTab$str2\").pagefoot({pagesize: 20,count: $totalrowcount,css: \"page1\",previous: \"上一页\",next: \"下一页\",paging: function (page) { $str3 }});</script> ";
return $result;
}
/**
* 获取tabnum 页面使用
* @param int $typeid 文章类型
Arguments
array:6 [
"_index" => "cms-v1"
"_type" => "cms_new"
"_id" => "67e36766f7ca6423f759c78b"
"_score" => null
"_source" => array:9 [
"keywords" => array:1 [
0 => "厂商供稿"
]
"it168_channelid" => "29i"
"authorname" => "网络"
"keywordids" => array:1 [
0 => 692788
]
"it168_url" => "http://software.it168.com/a2025/0326/6881/000006881658.shtml"
"id" => 6881658
"it168_publishtime" => "2025-03-26T02:40:26Z"
"abstract" => "随着新一轮科技革命和产业变革深入发展,人工智能已成为驱动新质生产力的重要引擎。在此背景下,作为AI服务器内部及跨设备互联的“神经中枢”,AI高速互联传输线缆的技术突破直接决定算力效能与数据中心的运行效率,而传统单通道10G/25G线缆已难以满足AI大模型对112G/224G超高速传输的刚性需求。"
"title" => "连接AI算力 安澜万锦发力AI服务器高速互联传输线缆"
]
"sort" => array:1 [
0 => 1742956826000
]
]
/data/www/CMS/Modules/Api/Http/Controllers/it168/ArticleapiController.php
$pagesize = 20;
if ($isz) {
//获取全站资讯
$data = self::getChannelListBaseZ($selecechannelids, $typeidstr, $notchannelids, $nottypeids, $ipagenum, $totalrowcount, $pagesize);
} else {
//获取普通文章列表
$data = self::getChannelListBase($selecechannelids, $typeid, $brandidstr, $ipagenum, $keyword, $tagnames, $totalrowcount, $pagesize,false, $typeidstrs,$typeidstr);
}
if (count($data) == 0) {
$result = '-1;