Commit cc7a1b5b authored by xieyishang's avatar xieyishang

Merge branch 'dev' of http://rungit.jxdsy.cn:10000/sugar/land_army into dev

parents 27500fbc 420c335e
......@@ -563,3 +563,52 @@ if (!function_exists('get_banner')) {
return $banner;
}
}
function sendCurl($url, $curlPost = '', $header = 0)
{
$ch = curl_init(); //初始化curl
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url); //设置URL
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //设置为返回模式
if ($header) {
curl_setopt($ch, CURLOPT_HEADER, 1); //获取头文件信息
} else {
curl_setopt($ch, CURLOPT_HEADER, 0); //不获取头文件信息
}
if (!empty($curlPost)) {
curl_setopt($ch, CURLOPT_POST, 1); //设置POST
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); //POST参数
}
$output = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
return $output;
}
function postCurl($url, $curlPost = '', $header = 0)
{
$ch = curl_init(); //初始化curl
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url); //设置URL
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //设置为返回模式
if ($header) {
curl_setopt($ch, CURLOPT_HEADER, 1); //获取头文件信息
} else {
curl_setopt($ch, CURLOPT_HEADER, 0); //不获取头文件信息
}
if (!empty($curlPost)) {
curl_setopt($ch, CURLOPT_POST, 1); //设置POST
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); //POST参数
}
$output = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
return $output;
}
......@@ -298,4 +298,5 @@ return [
//API接口地址
'api_url' => 'https://api.fastadmin.net',
],
'LJApi_ip'=>"http://testluma.com",
];
......@@ -8,6 +8,7 @@ use app\admin\model\CourseArticleModel;
use app\admin\model\AdresourceModel;
use app\common\model\Config as ConfigModel;
use app\common\model\AdModel;
use app\common\model\CourseVideoModel;
use think\Db;
......@@ -41,6 +42,13 @@ class Index extends Frontend
$CourseArticles[$key]['content'] = mb_substr($val['content'], 0, 45) . '...';
}
}
$CourseArticleList = CourseArticleModel::where(['class_id' =>['in',$dynamic_class_ids],'index_type'=>1])->order('orderby asc')->limit(6)->select();
foreach ($CourseArticleList as $ke => $va){
$CourseArticleList[$ke]['title'] = mb_substr_content($va['title'],25);
$CourseArticleList[$ke]['day'] = date('d',$va['createtime']);
$CourseArticleList[$ke]['month'] = date('Y-m',$va['createtime']);
}
}
//教学公告
......@@ -60,6 +68,19 @@ class Index extends Frontend
//教学运行
$teachrun_id = 3;
$teachrunclass = CourseClassModel::where(['pid' =>$teachrun_id])->field('id,image_url,title')->select();
foreach ($teachrunclass as $key => $val){
if($val['id'] == 45){//在线课堂
$TeachRunArticles = CourseVideoModel::where(['class_id' =>$val['id']])->order('createtime desc')->limit(5)->select();
}else{
$TeachRunArticles = CourseArticleModel::where(['class_id' =>$val['id']])->order('createtime desc')->limit(5)->select();
}
foreach ($TeachRunArticles as $k => $v){
$TeachRunArticles[$k]['title'] = mb_substr_content($v['title'],25);
$TeachRunArticles[$k]['day'] = date('d',$v['createtime']);
$TeachRunArticles[$k]['month'] = date('Y-m',$v['createtime']);
}
$teachrunclass[$key]['TeachArticles'] = $TeachRunArticles;
}
//课程资源
$course_id = 4;
$courseclass = CourseClassModel::where(['pid' =>$course_id])->field('id,image_url,title')->select();
......@@ -88,6 +109,7 @@ class Index extends Frontend
$this->view->assign("dynamic_id", $dynamic_id);
$this->view->assign("indexbanner", $indexbanner);
$this->view->assign("CourseArticles", $CourseArticles);
$this->view->assign("CourseArticleList", $CourseArticleList);
$this->view->assign("powerbanner", $powerbanner);
$this->view->assign("teachclass", $teachclass);
$this->view->assign("teachrunclass", $teachrunclass);
......
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