Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projecttwo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangtao
projecttwo
Commits
928bfbe8
Commit
928bfbe8
authored
Jun 22, 2025
by
wangzhengwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
学习资料
parent
1da2424d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
166 additions
and
4 deletions
+166
-4
README.md
README.md
+56
-1
Search.php
app/api/controller/Search.php
+5
-0
Study.php
app/api/controller/study/Study.php
+57
-0
StudyInformationValidate.php
app/api/validate/StudyInformationValidate.php
+1
-0
Course.php
app/model/Course.php
+8
-3
StudyInformation.php
app/model/StudyInformation.php
+39
-0
No files found.
README.md
View file @
928bfbe8
凡骄网络科技
# 文档预览系统
\ No newline at end of file
这是一个简单的文档预览系统,支持PDF和Word文档的在线预览。
## 功能特性
*
PDF文档在线预览(使用PDF.js)
*
Word文档在线预览(使用Google Docs Viewer)
*
拖拽上传文件
*
响应式设计,适合各种设备
*
简洁现代的用户界面
## 安装与使用
### 系统要求
*
支持PHP 7.0+的Web服务器(Apache/Nginx)
*
启用mod_rewrite模块(Apache)
*
启用文件上传功能
### 安装步骤
1.
将所有文件上传到Web服务器目录
2.
确保
`uploads`
目录可写(权限设为755或777)
3.
确保PHP文件上传配置正确(php.ini中的upload_max_filesize和post_max_size)
### 配置说明
系统主要包含以下文件:
*
`cs.html`
- 主页面,包含文档预览功能
*
`upload_word.php`
- 处理Word文档上传的PHP脚本
*
`.htaccess`
- Apache服务器配置文件
*
`uploads/`
- 上传文件存储目录(会自动创建)
## 使用方法
1.
访问
`cs.html`
页面
2.
选择要预览的文档类型(PDF或Word)
3.
点击上传区域或拖拽文件到上传区域
4.
等待文件上传并预览
## 注意事项
*
PDF预览完全在客户端进行,无需服务器端处理
*
Word预览需要上传文件到服务器,然后使用Google Docs Viewer进行预览
*
由于Google Docs Viewer安全限制,预览的文件URL必须是公开可访问的
*
在实际应用中,可能需要考虑文件访问权限、存储限制等问题
## 技术实现
*
前端:HTML5、CSS3、JavaScript
*
PDF预览:PDF.js库
*
Word预览:Google Docs Viewer
*
后端:PHP
*
服务器:Apache(带mod_rewrite)
\ No newline at end of file
app/api/controller/Search.php
View file @
928bfbe8
...
@@ -240,4 +240,9 @@ class Search extends BaseController
...
@@ -240,4 +240,9 @@ class Search extends BaseController
Cache
::
tag
(
'search_plus'
)
->
clear
();
Cache
::
tag
(
'search_plus'
)
->
clear
();
return
$this
->
returnMsg
(
'缓存清除成功'
,
1
);
return
$this
->
returnMsg
(
'缓存清除成功'
,
1
);
}
}
public
function
addSearchKey
()
{
}
}
}
\ No newline at end of file
app/api/controller/study/Study.php
0 → 100644
View file @
928bfbe8
<?php
namespace
app\api\controller\study
;
use
app\api\validate\StudyInformationValidate
;
use
app\BaseController
;
use
app\model\Project
as
ProjectModel
;
use
app\model\StudyCategory
;
use
app\model\StudyInformation
;
use
think\Request
;
class
Study
extends
BaseController
{
public
function
getStudyList
(
Request
$request
)
{
$vo
=
(
new
StudyInformationValidate
())
->
goCheck
([
'category_id'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$data
=
$request
->
param
();
$page
=
$request
->
param
(
'page/d'
,
1
);
$pageSize
=
$request
->
param
(
'pageSize/d'
,
10
);
$list
=
(
new
StudyInformation
())
->
studyList
(
$data
[
'category_id'
],
$page
,
$pageSize
);
return
$this
->
returnMsg
(
'success'
,
1
,
$list
);
}
public
function
getStudyDetail
(
Request
$request
)
{
$vo
=
(
new
StudyInformationValidate
())
->
goCheck
([
'study_information_id'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$data
=
$request
->
param
();
$data
=
(
new
StudyInformation
())
->
studyDetail
(
$data
[
'study_information_id'
]);
return
$this
->
returnMsg
(
'success'
,
1
,
$data
);
}
public
function
getStudyCategoryList
(
Request
$request
)
{
$vo
=
(
new
StudyInformationValidate
())
->
goCheck
([
'pid'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$data
=
$request
->
param
();
$list
=
(
new
StudyCategory
())
->
getStudyCategoryList
(
$data
[
'pid'
]);
return
$this
->
returnMsg
(
'success'
,
1
,
$list
);
}
}
\ No newline at end of file
app/api/validate/StudyInformationValidate.php
View file @
928bfbe8
...
@@ -15,6 +15,7 @@ class StudyInformationValidate extends BaseValidate
...
@@ -15,6 +15,7 @@ class StudyInformationValidate extends BaseValidate
'content'
=>
'requireCallback:contentcheck'
,
'content'
=>
'requireCallback:contentcheck'
,
'updateField'
=>
'require|in:is_sell'
,
'updateField'
=>
'require|in:is_sell'
,
'updateValue'
=>
'require'
,
'updateValue'
=>
'require'
,
'pid'
=>
'require'
,
];
];
protected
$message
=
[
protected
$message
=
[
...
...
app/model/Course.php
View file @
928bfbe8
...
@@ -135,13 +135,18 @@ class Course extends Model
...
@@ -135,13 +135,18 @@ class Course extends Model
if
(
$searchKeyWords
)
{
if
(
$searchKeyWords
)
{
$query
->
where
(
'title'
,
'like'
,
'%'
.
$searchKeyWords
.
'%'
);
$query
->
where
(
'title'
,
'like'
,
'%'
.
$searchKeyWords
.
'%'
);
}
}
$list
=
$query
->
field
(
'id,thumb,title,createtime,description,price,content,teacher_id,tag_ids'
)
return
$query
->
field
(
'id,thumb,title,createtime,description,price,content'
)
->
with
([
'getTeacher'
=>
[
'thumb'
],
'thumb'
])
->
with
([
'thumb'
])
->
paginate
([
->
paginate
([
'page'
=>
$page
,
'page'
=>
$page
,
'list_rows'
=>
$pageSize
'list_rows'
=>
$pageSize
]);
]);
if
(
$list
->
isEmpty
())
{
return
$list
;
}
$list
=
UtilService
::
listWithTags
(
$list
,
CourseTag
::
class
,
'tag_ids'
);
return
$list
;
}
}
//获取课程详情
//获取课程详情
...
...
app/model/StudyInformation.php
View file @
928bfbe8
...
@@ -83,4 +83,43 @@ class StudyInformation extends Model
...
@@ -83,4 +83,43 @@ class StudyInformation extends Model
->
where
(
'isdel'
,
0
);
->
where
(
'isdel'
,
0
);
}
}
public
static
function
studyList
(
$category_id
,
$page
,
$pageSize
)
{
$where
=
[
'is_sell'
=>
1
,
'status'
=>
2
];
$query
=
self
::
where
(
$where
);
$query
->
with
([
'getuserdata'
,
'filepath'
]);
if
(
$category_id
!=
0
)
{
$query
->
where
(
'cate_id'
,
$category_id
);
}
$query
->
where
([
'is_sell'
=>
1
,
'status'
=>
2
]);
$query
->
field
(
'id,user_id,title,type,thumb,updatetime,createtime,file_id'
);
$list
=
$query
->
paginate
([
'page'
=>
$page
,
'list_rows'
=>
$pageSize
]);
return
$list
;
}
public
function
studyDetail
(
$id
)
{
$where
=
[
'is_sell'
=>
1
,
'status'
=>
2
];
$query
=
self
::
where
(
$where
);
$query
->
with
([
'getuserdata'
,
'filepath'
]);
if
(
$id
!=
0
)
{
$query
->
where
(
'id'
,
$id
);
}
$query
->
where
([
'is_sell'
=>
1
,
'status'
=>
2
]);
$query
->
field
(
'id,user_id,title,type,thumb,updatetime,createtime,file_id'
);
return
$query
->
find
();
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment