Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
land_army
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
land_army
Commits
7751973f
Commit
7751973f
authored
Jun 08, 2022
by
wuxiaoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
互动平台
parent
7751a3c8
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
259 additions
and
70 deletions
+259
-70
application/common/model/ReleaseArticleModel.php
application/common/model/ReleaseArticleModel.php
+30
-0
application/common/model/ReleaseReplyModel.php
application/common/model/ReleaseReplyModel.php
+22
-0
application/index/controller/Index.php
application/index/controller/Index.php
+1
-3
application/index/controller/Interactive.php
application/index/controller/Interactive.php
+110
-3
application/index/view/common/headnavs.html
application/index/view/common/headnavs.html
+3
-1
application/index/view/index/index.html
application/index/view/index/index.html
+1
-1
application/index/view/index/interactdiscuss.html
application/index/view/index/interactdiscuss.html
+92
-62
No files found.
application/common/model/ReleaseArticleModel.php
0 → 100644
View file @
7751973f
<?php
namespace
app\common\model
;
use
think\Model
;
class
ReleaseArticleModel
Extends
Model
{
// 表名
protected
$name
=
'release_article'
;
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
false
;
// 追加属性
protected
$append
=
[
];
public
static
function
queryReleaseArticle
(
$where
,
$field
=
"*"
,
$page
=
1
,
$pageSize
=
10
,
$order
=
'createtime desc'
){
$list
=
self
::
where
(
$where
)
->
field
(
$field
)
->
order
(
$order
)
->
limit
(
$pageSize
)
->
page
(
$page
)
->
select
();
foreach
(
$list
as
$key
=>
$val
){
$list
[
$key
][
'content'
]
=
mb_substr_content
(
$val
[
'content'
],
550
);
}
return
$list
;
}
}
application/common/model/ReleaseReplyModel.php
0 → 100644
View file @
7751973f
<?php
namespace
app\common\model
;
use
think\Model
;
class
ReleaseReplyModel
Extends
Model
{
// 表名
protected
$name
=
'release_reply'
;
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
false
;
// 追加属性
protected
$append
=
[
];
}
application/index/controller/Index.php
View file @
7751973f
...
@@ -12,6 +12,7 @@ use app\common\model\AdModel;
...
@@ -12,6 +12,7 @@ use app\common\model\AdModel;
use
app\common\model\CourseVideoModel
;
use
app\common\model\CourseVideoModel
;
use
think\Db
;
use
think\Db
;
use
think\Hook
;
use
think\Hook
;
use
think\Session
;
class
Index
extends
Backend
class
Index
extends
Backend
...
@@ -32,9 +33,6 @@ class Index extends Backend
...
@@ -32,9 +33,6 @@ class Index extends Backend
$result
=
$this
->
auth
->
adminlogin
(
$username
,
86400
);
$result
=
$this
->
auth
->
adminlogin
(
$username
,
86400
);
if
(
$result
===
true
)
{
if
(
$result
===
true
)
{
Hook
::
listen
(
"admin_login_after"
,
$this
->
request
);
Hook
::
listen
(
"admin_login_after"
,
$this
->
request
);
}
else
{
$msg
=
$this
->
auth
->
getError
();
$msg
=
$msg
?
$msg
:
__
(
'用户名或密码不正确'
);
}
}
}
}
}
}
...
...
application/index/controller/Interactive.php
View file @
7751973f
...
@@ -9,6 +9,11 @@ use app\common\controller\Frontend;
...
@@ -9,6 +9,11 @@ use app\common\controller\Frontend;
use
app\common\model\AdModel
;
use
app\common\model\AdModel
;
use
app\common\model\CourseArticleModel
;
use
app\common\model\CourseArticleModel
;
use
app\common\model\CourseClassModel
;
use
app\common\model\CourseClassModel
;
use
app\common\model\ReleaseArticleModel
;
use
app\common\model\ReleaseReplyModel
;
use
think\Db
;
use
think\Hook
;
use
think\Session
;
/**互动平台
/**互动平台
* Class Interactive
* Class Interactive
...
@@ -18,6 +23,7 @@ class Interactive extends Backend
...
@@ -18,6 +23,7 @@ class Interactive extends Backend
protected
$noNeedLogin
=
'*'
;
protected
$noNeedLogin
=
'*'
;
protected
$noNeedRight
=
'*'
;
protected
$noNeedRight
=
'*'
;
protected
$layout
=
''
;
protected
$layout
=
''
;
protected
$pagesize
=
10
;
public
function
index
(){
public
function
index
(){
...
@@ -44,11 +50,112 @@ class Interactive extends Backend
...
@@ -44,11 +50,112 @@ class Interactive extends Backend
}
}
/**互动讨论区
*/
public
function
interactdiscuss
()
public
function
interactdiscuss
()
{
{
# code...
$keywords
=
$this
->
request
->
param
(
"keywords"
);
$listdata
=
[
1
,
2
,
3
,
4
,
5
];
$where
[
'is_delete'
]
=
0
;
$this
->
view
->
assign
(
"listdata"
,
$listdata
);
if
(
!
empty
(
$keywords
)){
$where
[
'content'
]
=
[
'like'
,
"%
$keywords
%"
];
}
$list
=
ReleaseArticleModel
::
where
(
$where
)
->
field
(
'*,FROM_UNIXTIME(createtime,"%Y-%m-%d %h:%i:%s") as createtime_text'
)
->
order
(
'createtime desc'
)
->
paginate
(
$this
->
pagesize
,
false
,[
'query'
=>
$this
->
request
->
param
()]);
foreach
(
$list
as
$key
=>
$val
){
$list
[
$key
][
'content'
]
=
mb_substr_content
(
$val
[
'content'
],
550
);
$list
[
$key
][
'adminuser'
]
=
Db
::
name
(
"admin"
)
->
where
([
'id'
=>
$val
[
'admin_id'
]])
->
field
(
"username,nickname,avatar,type"
)
->
find
();
$list
[
$key
][
'countTeacherReply'
]
=
ReleaseReplyModel
::
alias
(
"r"
)
->
join
(
"admin a"
,
"r.admin_id= a.id"
,
"LEFT"
)
->
where
([
'r.is_delete'
=>
0
,
'r.release_id'
=>
$val
[
'id'
],
'a.type'
=>
2
])
->
count
();
$list
[
$key
][
'countStudentReply'
]
=
ReleaseReplyModel
::
alias
(
"r"
)
->
join
(
"admin a"
,
"r.admin_id= a.id"
,
"LEFT"
)
->
where
([
'r.is_delete'
=>
0
,
'r.release_id'
=>
$val
[
'id'
],
'a.type'
=>
1
])
->
count
();
$list
[
$key
][
'countAllReply'
]
=
ReleaseReplyModel
::
where
([
'is_delete'
=>
0
,
'release_id'
=>
$val
[
'id'
]])
->
count
();
}
$this
->
view
->
assign
(
"list"
,
$list
);
$page
=
$list
->
render
();
$total
=
$list
->
total
();
$this
->
view
->
assign
(
"total"
,
$total
);
$this
->
view
->
assign
(
"page"
,
$page
);
$this
->
view
->
assign
(
"offset"
,
(
$list
->
currentPage
()
-
1
)
*
$list
->
listRows
()
+
1
);
$currenttotal
=
$list
->
currentPage
()
*
$list
->
listRows
();
if
(
$currenttotal
>
$list
->
total
())
{
$currenttotal
=
$list
->
total
();
}
$this
->
view
->
assign
(
"currenttotal"
,
$currenttotal
);
$this
->
view
->
assign
(
"keywords"
,
$keywords
);
return
$this
->
view
->
fetch
(
"index/interactdiscuss"
);
return
$this
->
view
->
fetch
(
"index/interactdiscuss"
);
}
}
/*
* 添加留言板
*/
public
function
ajaxAddReleaseArticle
(){
$content
=
$this
->
request
->
param
(
"content"
);
if
(
empty
(
$content
)){
$this
->
error
(
"请输入留言内容!"
);
}
if
(
$this
->
auth
->
isLogin
())
{
ReleaseArticleModel
::
create
([
'admin_id'
=>
$this
->
auth
->
id
,
'content'
=>
$content
,
'createtime'
=>
time
()]);
$this
->
success
(
"留言成功!"
);
}
else
{
$this
->
error
(
__
(
'Please login first'
),
url
(
'index/login'
));
}
}
/**
* 添加留言评论
*/
public
function
ajaxAddReleaseReply
(){
$content
=
$this
->
request
->
param
(
"content"
);
$release_id
=
$this
->
request
->
param
(
"release_id"
);
if
(
empty
(
$content
)){
$this
->
error
(
"请输入留言内容!"
);
}
if
(
empty
(
$release_id
)){
$this
->
error
(
"请选择留言内容进行评论!"
);
}
if
(
$this
->
auth
->
isLogin
())
{
ReleaseReplyModel
::
create
([
'release_id'
=>
$release_id
,
'admin_id'
=>
$this
->
auth
->
id
,
'content'
=>
$content
,
'createtime'
=>
time
()]);
$this
->
success
(
"留言成功!"
);
}
else
{
$this
->
error
(
__
(
'Please login first'
),
url
(
'index/login'
));
}
}
/**
* 分页加载评论列表
*/
public
function
loadingReleaseReply
(){
$release_id
=
$this
->
request
->
param
(
"release_id"
);
$page
=
$this
->
request
->
param
(
"page"
,
1
);
$type
=
$this
->
request
->
param
(
"type"
,
0
);
//教师2,学生1 全部0
$map
[
'r.is_delete'
]
=
0
;
$map
[
'r.release_id'
]
=
$release_id
;
if
(
in_array
(
$type
,[
1
,
2
])){
$map
[
'a.type'
]
=
$type
;
}
$list
=
ReleaseReplyModel
::
alias
(
"r"
)
->
join
(
"admin a"
,
"r.admin_id= a.id"
,
"LEFT"
)
->
where
(
$map
)
->
field
(
'r.*,FROM_UNIXTIME(r.createtime,"%Y-%m-%d %h:%i:%s") as createtime_text,a.username,a.nickname,a.avatar,a.type'
)
->
order
(
'r.createtime desc'
)
->
limit
(
$this
->
pagesize
)
->
page
(
$page
)
->
select
();
/*$list =ReleaseReplyModel::where($where)->field('*,FROM_UNIXTIME(createtime,"%Y-%m-%d %h:%i:%s") as createtime_text')
->order('createtime desc')
->limit($this->pagesize)
->page($page)
->select();*/
$list
=
collection
(
$list
)
->
toArray
();
$result
=
array
(
"rows"
=>
$list
);
return
json
(
$result
);
}
}
}
\ No newline at end of file
application/index/view/common/headnavs.html
View file @
7751973f
...
@@ -13,10 +13,12 @@
...
@@ -13,10 +13,12 @@
<!-- <li class="navitems"><a class="alink" href="/index.php/index/index/tsztindex">特色专题</a></li> -->
<!-- <li class="navitems"><a class="alink" href="/index.php/index/index/tsztindex">特色专题</a></li> -->
<!-- <li class="navitems"><a class="alink" href="javascript:;">教学团队</a></li> -->
<!-- <li class="navitems"><a class="alink" href="javascript:;">教学团队</a></li> -->
</ul>
</ul>
{if $admin==null}
<div
class=
"navrights"
>
<div
class=
"navrights"
>
<a
class=
"linklogin"
href=
"
javascript:;
"
>
登录
</a>
<a
class=
"linklogin"
href=
"
/yCVjiDHwKq.php/index/login
"
>
登录
</a>
<!-- <a class="langtaggle" href="javascript:;">EN 丨 CN</a> -->
<!-- <a class="langtaggle" href="javascript:;">EN 丨 CN</a> -->
</div>
</div>
{/if}
</div>
</div>
</div>
</div>
<!-- basenav end -->
<!-- basenav end -->
\ No newline at end of file
application/index/view/index/index.html
View file @
7751973f
...
@@ -336,7 +336,7 @@
...
@@ -336,7 +336,7 @@
</div>
</div>
</div>
</div>
<div
class=
"hdtlzq"
>
<div
class=
"hdtlzq"
>
<a
href=
"/index.php/index/interactive/in
dex
"
><img
class=
"hudongtlzq"
src=
"{$hd_banner.photo ?? ''}"
<a
href=
"/index.php/index/interactive/in
teractdiscuss
"
><img
class=
"hudongtlzq"
src=
"{$hd_banner.photo ?? ''}"
alt=
""
></a>
alt=
""
></a>
</div>
</div>
</div>
</div>
...
...
application/index/view/index/interactdiscuss.html
View file @
7751973f
This diff is collapsed.
Click to expand it.
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