www.lightcourse.com/app/home/controller/Link.php

83 lines
2.8 KiB
PHP

<?php
namespace app\home\controller;
use think\facade\View;
use think\facade\Lang;
/**
* ============================================================================
* 联课教育商城系统
* ============================================================================
* 版权所有 2022 刻羽互动科技有限公司,并保留所有权利。
* 网站地址: http://www.o1h.cn
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
* 不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* 控制器
*/
class Link extends BaseMall {
public function initialize() {
parent::initialize(); // TODO: Change the autogenerated stub
Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/link.lang.php');
}
public function index() {
//把加密的用户id写入cookie
$uid = input('uid');
cookie('uid', $uid);
//友情连接内容
$link_model = model('link');
$link_list = $link_model->getLinkList();
/**
* 整理图片链接
*/
if (is_array($link_list)) {
foreach ($link_list as $k => $v) {
if (!empty($v['link_pic'])) {
$link_list[$k]['link_pic'] = ds_get_pic( DIR_ADMIN . '/link' , $v['link_pic']);
}
}
}
$article_model = model('article');
$condition = array();
$condition[]=array('article_show','=','1');
$condition[]=array('ac_id','=','9');
$article_list = $article_model->getAllArticle($condition, 10);
foreach ($article_list as &$val) {
$val['article_date'] = date('Y-m-d H:i:s',$val['article_time']);
preg_match_all('/[\x{4e00}-\x{9fff}]+/u', $val['article_content'], $matches);
$str = join('', $matches[0]);
$val['article'] = mb_substr($str,0,200);
}
View::assign('article',$article_list);
View::assign('link_list', $link_list);
View::assign('link', 'index');
return View::fetch($this->template_dir . 'link');
}
//学员详情
public function show()
{
$article_id = input('article_id');
$article_model = model('article');
$article = $article_model->getOneArticle(['article_id' => $article_id]);
$article['article_date'] = date('Y-m-d H:i:s',$article['article_time']);
View::assign('article',$article);
return View::fetch($this->template_dir . 'link_show');
}
}
?>