文库是指网上的开放供网友在线分享文档的平台,能够提供原创系统性知识的网站。现在的文库网站具有很大的营销能力,同时具有很大的广告能力。
我们的文库网站支持doc、docx 、ppt、 pptx、 pdf等主流文档格式。
下面源码分电脑端和手机端
列表功能模块
namespace app\index\controller;
use think\facade\View;
use think\facade\Db;
use app\index\model\Cat_tree as CatTree;
class Doclist extends Common
{
public function index()
{
return View::fetch();
}
public function report()
{
print_r(111);
}
public function Type()
{
//获取到id
$id = input('id','');
// 接收路由v参数
$v1 = input('v');
// 接收路由d参数
$d = input('d');
// 查被点击的单条
$cateid = Db::name('category')->where('id', $id)->find();
$title = $cateid['type'];
// 导航第二级
$parent = Db::name('category') ->where('id',$cateid['parent_id'])->find();
// 导航第一级
$Parent = Db::name('category') ->where('id',$parent['parent_id'])->find();
// id查被点击的父级下的全部
$category = Db::name('category')->where('parent_id', $id)->select();
//父级id查出父级下的全部子类
$CateGory = Db::name('category')->where('parent_id', $cateid['parent_id'])->select();
// 优秀作者
$User = Db::name('user')->order('upload_data', 'desc')->find();
// 优秀作者的文章
$Article = Db::name('article')->where('uid', $User['uid'])->order('download', 'desc')->limit(3)->select();
// 其他作者
$ThinkUser = Db::name('user')->order('upload_data', 'desc')->limit(4)->select();
unset($ThinkUser[0]);
// 相关推荐(下载量最多)
$ThinkArticle = Db::name('article')->order('download', 'desc')->limit(5)->select();
// 热门标签
$Hot = Db::name('category')->where('recom',1)->select();
$Catesonid = CatTree::get_AllCate($cateid['id']);
$Catesonid = rtrim($Catesonid,',');
$where[] = ['cateid','in',$Catesonid];
$cc = [];
if($v1 == 1){
$cc = ['vip_only'=>1];
}elseif($v1 == 2){
$cc = ['vip_free'=>1];
}elseif($v1 == 3){
$cc = ['ShareType'=>1];
}
if($d == 1){
$Newarticle = Db::name('article')->where($where)->where($cc)->order('download','desc')->limit(15)->paginate();
}elseif($d == 2){
$Newarticle = Db::name('article')->where($where)->where($cc)->order('update_time','desc')->limit(15)->paginate();
}elseif($d == 3){
$Newarticle = Db::name('article')->where($where)->where($cc)->order('hits','desc')->limit(15)->paginate();
}else{
// 文档
$Newarticle = Db::name('article')->where($where)->where($cc)->limit(15)->paginate();
}
手机部分的分类
//手机分类二级
public function m_cate(){
$first = input('first');
$m_twocate = Db::name('category')->where('parent_id',$first)->select();
if(!empty($m_twocate)){
return json(['code'=>1,'data'=>$m_twocate]);
}
}
//手机分类三级
public function m_cate_three(){
$second = input('second');
$m_threecate = Db::name('category')->where('parent_id',$second)->select();
if(!empty($m_threecate)){
return json(['code'=>22,'data'=>$m_threecate]);
}
}
列表展开
<?php
namespace app\index\controller;
use think\facade\Db;
use think\Request;
use think\facade\View;
use app\index\model\Cat_tree as CatTree;
use app\index\model\Doc as DocModel;
use app\index\model\Img as ImgModel;
class Doc extends Common
{
public function __construct()
{
parent::__construct();
if(empty(session('user')['uid'])){
return View::fetch('login/notlogin');
}
}
// 列表页
public function index(){
return View::fetch();
}
//详情页
public function detail(){
// $title_list = (new CodeModel())->getCode('https://www.grcc.vip/article-4267.html');
$id = request()->param('id');
//面包削的查询
$title_list = (new DocModel())->titleList($id);
//文档信息
$doc_detail = (new DocModel())->docDetail($id);
//作者信息查询
$author = (new DocModel())->authorInformation($doc_detail['uid']);
//关注判断
$follow = Db::name('user_follow')->where('fans_uid',session('user')['uid'])->where('friend_uid',$author['uid'])->find();
//作者文档展示
$author_doc = (new DocModel())->authorDoc($doc_detail['uid']);
$aaa = Db::name('article')->where('id',$id)->find();
//导航标题
$title = $aaa['title'];
//相关推荐
$related = (new DocModel())->relatedList($doc_detail['cateid']);
//文档图片展示
$show_doc = (new DocModel())->showDoc($id);
$show_doc = html_entity_decode($show_doc['data'],ENT_QUOTES, 'UTF-8');
//剩余页码的查询
$numpages = (new DocModel())->numPages($id);
//查询是否收藏
$is_collect = (new DocModel())->isCollect($id);
View::assign([
'title' =>$title,
'title_list'=>$title_list,
'doc_detail'=>$doc_detail,
'author'=>$author,
'author_doc'=>$author_doc,
'related'=>$related,
'show_doc'=>$show_doc,
'numpages'=>$numpages,
'is_collect'=>$is_collect,
'follow' => $follow,
]);
return View::fetch();
}
心若无痕988: 这个文库源码多少钱
qq_43061713: 怎么下载这个源码
小新的蜡笔01: 是我们公司开发的文库案例喔,感兴趣的可以联系我们详细了解
xiaoyao666888: 这是什么文库?