Commit eacb556f authored by 夏彬's avatar 夏彬

修改推荐课程的自定义标签修改支持直播课程

parent 49e89f2b
......@@ -6,8 +6,12 @@
* Time: 11:46 AM
*/
use internalApi\xue\CourseList;
require(__DIR__ . '/../extend/internalApi/autoload.php');
require(__DIR__ . '/../config/config_ibanshou.php');
\internalApi\base\Client::config($config['wxh.internal']['client']);
$num = isset($_GET['num']) ? $_GET['num'] : 3;
echo json_encode(internalApi\bbs\Tcptuan::getGoods($num));
\ No newline at end of file
echo print_r(CourseList::getRecommendList(1));
\ No newline at end of file
......@@ -5,20 +5,20 @@ use internalApi\xue\CourseList;
function user_ibanshou($num)
{
require __DIR__.'/../extend/internalApi/autoload.php';
require __DIR__.'/../config/config_ibanshou.php';
require __DIR__ . '/../extend/internalApi/autoload.php';
require __DIR__ . '/../config/config_ibanshou.php';
\internalApi\base\Client::config($config['wxh.internal']['client']);
$thread = Thread::getHotThreads($num);
$list = CourseList::getRecommendList($num);
$str = '<div clas=\"recommend-info\">';
foreach ($list as $val) {
//自适应 http, https
$val['url'] = str_replace('http://', '//', $val['url']);
if($val['homework'] == 4 and $val['liveStatus'] == 0){
$str .= <<<EOD
//自适应 http, https
$val['url'] = str_replace('http://', '//', $val['url']);
if ($val['homework'] == 4) {
if ($val['liveStatus'] == 0) {
$str .= <<<EOD
<div class="tuan-list">
<a href="{$val['url']}">
<img src="{$val['preview_pic']}-ym.preview\">
......@@ -30,8 +30,10 @@ function user_ibanshou($num)
</a>
</div>
EOD;
}else if($val['homework'] == 4 and $val['liveStatus'] == 1){
$str .= <<<EOD
} else {
$str .= <<<EOD
<div class="tuan-list">
<a href="{$val['url']}">
<img src="{$val['preview_pic']}-ym.preview\">
......@@ -43,7 +45,8 @@ EOD;
</a>
</div>
EOD;
}else{
}
} else {
$str .= <<<EOD
<div class=\"news-item portal-course\">
<a href=\"{$val['url']}\" class=\"content pb-none\">
......@@ -64,11 +67,11 @@ EOD;
}
foreach ($thread as $val) {
//自适应 http, https
$val['image'] = $val['image'] ? str_replace('http://', '//', $val['image']): '/skin/default/images/notimg.gif';
//自适应 http, https
$val['image'] = $val['image'] ? str_replace('http://', '//', $val['image']) : '/skin/default/images/notimg.gif';
$val['url'] = str_replace('http://', '//', $val['url']);
$str .= <<<EOD
$str .= <<<EOD
<div class=\"news-item has-pic one-picture\">
<a href=\"{$val['url']}\" class=\"content pb-none\" style=\"min-height: 80px;\">
<div class=\"tit\">{$val['subject']}</div>
......@@ -88,17 +91,21 @@ EOD;
echo $str . '</div>';
}
function user_ago($tm,$rcs = 0) {
$cur_tm = time(); $dif = $cur_tm-$tm;
$pds = array('秒','分钟','小时','天','周','个月','年');
$lngh = array(1,60,3600,86400,604800,2630880,31570560);
for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]);
function user_ago($tm, $rcs = 0)
{
$cur_tm = time();
$dif = $cur_tm - $tm;
$pds = array('秒', '分钟', '小时', '天', '周', '个月', '年');
$lngh = array(1, 60, 3600, 86400, 604800, 2630880, 31570560);
for ($v = sizeof($lngh) - 1; ($v >= 0) && (($no = $dif / $lngh[$v]) <= 1); $v--) ;
if ($v < 0) $v = 0;
$_tm = $cur_tm - ($dif % $lngh[$v]);
$no = floor($no);
//if($no <> 1) $pds[$v] .='s'; //+s
$x=sprintf("%d %s",$no,$pds[$v]);
if(($rcs == 1)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= time_ago($_tm);
return $x."前";
$x = sprintf("%d %s", $no, $pds[$v]);
if (($rcs == 1) && ($v >= 1) && (($cur_tm - $_tm) > 0)) $x .= time_ago($_tm);
return $x . "前";
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment