Commit 521c85e5 authored by 汪波's avatar 汪波

Merge remote-tracking branch 'origin/test' into test

parents c3196443 27327f4a
...@@ -5,20 +5,49 @@ use internalApi\xue\CourseList; ...@@ -5,20 +5,49 @@ use internalApi\xue\CourseList;
function user_ibanshou($num) function user_ibanshou($num)
{ {
require __DIR__.'/../extend/internalApi/autoload.php'; require __DIR__ . '/../extend/internalApi/autoload.php';
require __DIR__.'/../config/config_ibanshou.php'; require __DIR__ . '/../config/config_ibanshou.php';
\internalApi\base\Client::config($config['wxh.internal']['client']); \internalApi\base\Client::config($config['wxh.internal']['client']);
$thread = Thread::getHotThreads($num); $thread = Thread::getHotThreads($num);
$list = CourseList::getRecommendList($num); $list = CourseList::getRecommendList($num);
$str = '<div clas=\"recommend-info\">'; $str = '<div clas=\"recommend-info\">';
foreach ($list as $val) { foreach ($list as $val) {
//自适应 http, https //自适应 http, https
$val['url'] = str_replace('http://', '//', $val['url']); $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\">
<h3>{$val['name']}</h3>
<p class="clearfix">
<span class="price">{$val['liveReservationNum']}<b>人已预约</b></span>
<span class="go-buy-btn">预约报名<i class="iconfont icon-xiangyou1"></i></span>
</p>
</a>
</div>
EOD;
$str .= <<<EOD } else {
$str .= <<<EOD
<div class="tuan-list">
<a href="{$val['url']}">
<img src="{$val['preview_pic']}-ym.preview\">
<h3>{$val['name']}</h3>
<p class="clearfix">
<span class="price">{$val['liveWatchNum']}<b>人观看中</b></span>
<span class="go-buy-btn">正在直播<i class="iconfont icon-xiangyou1"></i></span>
</p>
</a>
</div>
EOD;
}
} else {
$str .= <<<EOD
<div class=\"news-item portal-course\"> <div class=\"news-item portal-course\">
<a href=\"{$val['url']}\" class=\"content pb-none\"> <a href=\"{$val['url']}\" class=\"content pb-none\">
<div class=\"tit\">{$val['name']}</div> <div class=\"tit\">{$val['name']}</div>
...@@ -33,14 +62,16 @@ function user_ibanshou($num) ...@@ -33,14 +62,16 @@ function user_ibanshou($num)
</div> </div>
</div> </div>
EOD; EOD;
}
} }
foreach ($thread as $val) { foreach ($thread as $val) {
//自适应 http, https //自适应 http, https
$val['image'] = $val['image'] ? str_replace('http://', '//', $val['image']): '/skin/default/images/notimg.gif'; $val['image'] = $val['image'] ? str_replace('http://', '//', $val['image']) : '/skin/default/images/notimg.gif';
$val['url'] = str_replace('http://', '//', $val['url']); $val['url'] = str_replace('http://', '//', $val['url']);
$str .= <<<EOD $str .= <<<EOD
<div class=\"news-item has-pic one-picture\"> <div class=\"news-item has-pic one-picture\">
<a href=\"{$val['url']}\" class=\"content pb-none\" style=\"min-height: 80px;\"> <a href=\"{$val['url']}\" class=\"content pb-none\" style=\"min-height: 80px;\">
<div class=\"tit\">{$val['subject']}</div> <div class=\"tit\">{$val['subject']}</div>
...@@ -60,17 +91,21 @@ EOD; ...@@ -60,17 +91,21 @@ EOD;
echo $str . '</div>'; echo $str . '</div>';
} }
function user_ago($tm,$rcs = 0) { function user_ago($tm, $rcs = 0)
$cur_tm = time(); $dif = $cur_tm-$tm; {
$pds = array('秒','分钟','小时','天','周','个月','年'); $cur_tm = time();
$lngh = array(1,60,3600,86400,604800,2630880,31570560); $dif = $cur_tm - $tm;
for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]); $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); $no = floor($no);
//if($no <> 1) $pds[$v] .='s'; //+s //if($no <> 1) $pds[$v] .='s'; //+s
$x=sprintf("%d %s",$no,$pds[$v]); $x = sprintf("%d %s", $no, $pds[$v]);
if(($rcs == 1)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= time_ago($_tm); if (($rcs == 1) && ($v >= 1) && (($cur_tm - $_tm) > 0)) $x .= time_ago($_tm);
return $x."前"; return $x . "前";
} }
?> ?>
\ No newline at end of file
<?php
require("../../class/connect.php");
$iscas = getcvar('mlcas');
?>
<?php if (!$iscas) { ?>
$(function(){
console.log($(".books").attr('href'));
$(".books").attr("href", "/e/member/login");
console.log($(".books").attr('href'));
});
<?php } ?>
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