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
cc7a1b5b
Commit
cc7a1b5b
authored
May 26, 2022
by
xieyishang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://rungit.jxdsy.cn:10000/sugar/land_army
into dev
parents
27500fbc
420c335e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
0 deletions
+72
-0
application/common.php
application/common.php
+49
-0
application/config.php
application/config.php
+1
-0
application/index/controller/Index.php
application/index/controller/Index.php
+22
-0
No files found.
application/common.php
View file @
cc7a1b5b
...
...
@@ -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
;
}
application/config.php
View file @
cc7a1b5b
...
...
@@ -298,4 +298,5 @@ return [
//API接口地址
'api_url'
=>
'https://api.fastadmin.net'
,
],
'LJApi_ip'
=>
"http://testluma.com"
,
];
application/index/controller/Index.php
View file @
cc7a1b5b
...
...
@@ -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
);
...
...
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