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
f0a8aa53
Commit
f0a8aa53
authored
May 13, 2025
by
wangtao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加课程列表,上传接口
parent
9df090fa
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
1334 additions
and
23 deletions
+1334
-23
Advert.php
app/admin/controller/Advert.php
+103
-0
AdvertCate.php
app/admin/controller/AdvertCate.php
+101
-0
Index.php
app/admin/controller/Index.php
+3
-3
User.php
app/admin/controller/User.php
+74
-0
Course.php
app/admin/controller/course/Course.php
+13
-2
CourseClass.php
app/admin/controller/course/CourseClass.php
+7
-0
CourseClassCategory.php
app/admin/controller/course/CourseClassCategory.php
+10
-6
CourseWork.php
app/admin/controller/course/CourseWork.php
+6
-0
Setting.php
app/admin/controller/system/Setting.php
+9
-0
AdvertValidate.php
app/admin/validate/AdvertValidate.php
+26
-0
edit.html
app/admin/view/advert/edit.html
+99
-0
index.html
app/admin/view/advert/index.html
+167
-0
edit.html
app/admin/view/advert_cate/edit.html
+53
-0
index.html
app/admin/view/advert_cate/index.html
+153
-0
index.html
app/admin/view/article/index.html
+2
-0
index.html
app/admin/view/system/manager/index.html
+15
-1
detail.html
app/admin/view/user/detail.html
+111
-0
index.html
app/admin/view/user/index.html
+179
-0
common.php
app/common.php
+3
-3
event.php
app/event.php
+3
-1
Jobtask.php
app/job/Jobtask.php
+118
-0
ShCourseWork.php
app/model/ShCourseWork.php
+0
-1
Advert.php
app/model/project/Advert.php
+4
-0
User.php
app/model/project/User.php
+49
-3
course.php
app/subscribe/course.php
+23
-0
queue.php
config/queue.php
+1
-1
buildItems.js
public/static/admin/module/buildItems/buildItems.js
+2
-2
No files found.
app/admin/controller/Advert.php
0 → 100644
View file @
f0a8aa53
<?php
namespace
app\admin\controller
;
use
app\admin\validate\AdvertValidate
;
use
think\App
;
use
app\model\project\Advert
as
AdvertModel
;
use
app\model\project\AdvertCate
;
class
Advert
extends
AdminBase
{
protected
$advert
;
public
function
__construct
(
App
$app
)
{
parent
::
__construct
(
$app
);
$this
->
advert
=
new
AdvertModel
();
}
//广告列表
public
function
index
(
string
$do
=
''
)
{
$limit
=
10
;
if
(
$do
==
'json'
)
{
$post
=
input
();
$post
[
'limit'
]
=
isset
(
$post
[
'limit'
])
?
$post
[
'limit'
]
:
$limit
;
$map
[]
=
[
'is_del'
,
'='
,
0
];
if
(
isset
(
$post
[
'kw'
])
&&
!
empty
(
$post
[
'kw'
]))
{
$map
[]
=
[
'name'
,
'like'
,
'%'
.
$post
[
'kw'
]
.
'%'
];
}
if
(
isset
(
$post
[
'p_id'
])
&&
!
empty
(
$post
[
'p_id'
]))
{
$map
[]
=
[
'p_id'
,
'='
,
$post
[
'p_id'
]];
}
$list
=
$this
->
advert
->
with
([
'coverImg'
])
->
append
([
'advcatename'
])
->
where
(
$map
)
->
paginate
(
$post
[
'limit'
]);
return
$this
->
returnMsg
(
$list
);
}
$categorydata
=
AdvertCate
::
select
()
->
toArray
();
$this
->
assign
(
'categorydata'
,
$categorydata
);
$this
->
assign
(
'limit'
,
$limit
);
$this
->
assign
(
'get'
,
input
());
return
$this
->
fetch
(
''
,
''
,
false
);
}
//快速编辑
public
function
editup
()
{
$post
=
input
();
$result
=
$this
->
advert
->
update
([
$post
[
'af'
]
=>
$post
[
'av'
]],
[[
'id'
,
'='
,
$post
[
'id'
]]]);
if
(
$result
)
{
return
$this
->
returnMsg
(
'修改成功'
,
1
);
}
else
{
return
$this
->
returnMsg
(
'修改失败'
);
}
}
//编辑新增广告
public
function
edit
()
{
$post
=
input
();
if
(
$this
->
request
->
isPost
())
{
$check
=
(
new
AdvertValidate
())
->
goCheck
();
if
(
$check
!==
true
)
{
return
$check
;
}
try
{
if
(
$post
[
'id'
]
>
0
)
{
$msg
=
'更新成功'
;
$this
->
advert
->
update
(
$post
,
[
'id'
=>
$post
[
'id'
]]);
}
else
{
$post
[
'create_time'
]
=
time
();
unset
(
$post
[
'id'
]);
$msg
=
'添加成功'
;
$this
->
advert
->
save
(
$post
);
}
}
catch
(
\Exception
$e
)
{
return
$this
->
returnMsg
(
$e
->
getMessage
(),
0
);
}
return
$this
->
returnMsg
(
$msg
,
1
);
}
$data
=
$this
->
advert
->
find
(
$post
[
'id'
]);
$categorydata
=
AdvertCate
::
select
()
->
toArray
();
$this
->
assign
(
'categorydata'
,
$categorydata
);
$this
->
assign
(
'data'
,
$data
);
return
$this
->
fetch
(
''
,
''
,
false
);
}
public
function
del
()
{
$post
=
input
();
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
if
(
$this
->
advert
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
return
$this
->
returnMsg
(
"删除成功"
,
1
);
}
else
{
return
$this
->
returnMsg
(
"删除失败"
);
}
}
}
\ No newline at end of file
app/admin/controller/AdvertCate.php
0 → 100644
View file @
f0a8aa53
<?php
namespace
app\admin\controller
;
use
think\App
;
use
app\model\project\AdvertCate
as
AdvertCateModel
;
use
think\facade\Validate
;
class
AdvertCate
extends
AdminBase
{
protected
$advertcate
;
public
function
__construct
(
App
$app
)
{
parent
::
__construct
(
$app
);
$this
->
advertcate
=
new
AdvertCateModel
();
}
//广告列表
public
function
index
(
string
$do
=
''
)
{
$limit
=
10
;
if
(
$do
==
'json'
)
{
$post
=
input
();
$post
[
'limit'
]
=
isset
(
$post
[
'limit'
])
?
$post
[
'limit'
]
:
$limit
;
$map
[]
=
[
'is_del'
,
'='
,
0
];
if
(
isset
(
$post
[
'kw'
])
&&
!
empty
(
$post
[
'kw'
]))
{
$map
[]
=
[
'name'
,
'like'
,
'%'
.
$post
[
'kw'
]
.
'%'
];
}
$list
=
$this
->
advertcate
->
where
(
$map
)
->
paginate
(
$post
[
'limit'
]);
return
$this
->
returnMsg
(
$list
);
}
$this
->
assign
(
'limit'
,
$limit
);
return
$this
->
fetch
(
''
,
''
,
false
);
}
//快速编辑
public
function
editup
()
{
$post
=
input
();
$result
=
$this
->
advertcate
->
update
([
$post
[
'af'
]
=>
$post
[
'av'
]],
[[
'id'
,
'='
,
$post
[
'id'
]]]);
if
(
$result
)
{
return
$this
->
returnMsg
(
'修改成功'
,
1
);
}
else
{
return
$this
->
returnMsg
(
'修改失败'
);
}
}
//编辑新增广告
public
function
edit
()
{
$post
=
input
();
if
(
$this
->
request
->
isPost
())
{
$validate
=
Validate
::
rule
([
'name'
=>
'require'
])
->
message
([
'name.require'
=>
'名称不能为空'
,
]);
if
(
!
$validate
->
check
(
$post
))
{
return
$this
->
returnMsg
(
$validate
->
getError
(),
0
);
}
try
{
if
(
$post
[
'id'
]
>
0
)
{
$msg
=
'更新成功'
;
$this
->
advertcate
->
update
(
$post
,
[
'id'
=>
$post
[
'id'
]]);
}
else
{
$post
[
'create_time'
]
=
time
();
unset
(
$post
[
'id'
]);
$msg
=
'添加成功'
;
$this
->
advertcate
->
save
(
$post
);
}
}
catch
(
\Exception
$e
)
{
return
$this
->
returnMsg
(
$e
->
getMessage
(),
0
);
}
return
$this
->
returnMsg
(
$msg
,
1
);
}
$data
=
$this
->
advertcate
->
find
(
$post
[
'id'
]);
$this
->
assign
(
'data'
,
$data
);
return
$this
->
fetch
(
''
,
''
,
false
);
}
public
function
del
()
{
$post
=
input
();
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
if
(
$this
->
advertcate
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
return
$this
->
returnMsg
(
"删除成功"
,
1
);
}
else
{
return
$this
->
returnMsg
(
"删除失败"
);
}
}
}
\ No newline at end of file
app/admin/controller/Index.php
View file @
f0a8aa53
...
@@ -9,10 +9,11 @@
...
@@ -9,10 +9,11 @@
*/
*/
namespace
app\admin\controller
;
namespace
app\admin\controller
;
use
app\job\Jobtask
;
use
app\model\system\SystemDict
as
Dict
;
use
app\model\system\SystemDict
as
Dict
;
use
app\model\system\SystemMenus
as
Menus
;
use
app\model\system\SystemMenus
as
Menus
;
use
app\model\system\SystemCategory
as
Category
;
use
app\model\system\SystemCategory
as
Category
;
use
think\facade\Queue
;
/**
/**
...
@@ -40,8 +41,7 @@ class Index extends AdminBase
...
@@ -40,8 +41,7 @@ class Index extends AdminBase
*/
*/
public
function
main
()
public
function
main
()
{
{
// Queue::push(Jobtask::class, '','coursetask'); // 推送到队列的任务类及其数据参数
if
(
$this
->
request
->
isPost
()){
if
(
$this
->
request
->
isPost
()){
return
$this
->
returnMsg
(
'登录成功!'
,
1
);
return
$this
->
returnMsg
(
'登录成功!'
,
1
);
}
}
...
...
app/admin/controller/User.php
0 → 100644
View file @
f0a8aa53
<?php
namespace
app\admin\controller
;
use
think\App
;
use
app\model\project\User
as
UserModel
;
class
User
extends
AdminBase
{
protected
$user
;
public
function
__construct
(
App
$app
)
{
parent
::
__construct
(
$app
);
$this
->
user
=
new
UserModel
();
}
//会员列表
public
function
index
(
string
$do
=
''
)
{
$limit
=
10
;
if
(
$do
==
'json'
)
{
$post
=
input
();
$post
[
'limit'
]
=
isset
(
$post
[
'limit'
])
?
$post
[
'limit'
]
:
$limit
;
$map
[]
=
[
'is_del'
,
'='
,
0
];
if
(
isset
(
$post
[
'kw'
])
&&
!
empty
(
$post
[
'kw'
]))
{
$map
[]
=
[
'username|mobile|realname'
,
'like'
,
'%'
.
$post
[
'kw'
]
.
'%'
];
}
$list
=
$this
->
user
->
where
(
$map
)
->
append
([
'headericourl'
,
'sexdata'
,
'roletxt'
])
->
paginate
(
$post
[
'limit'
]);
return
$this
->
returnMsg
(
$list
);
}
$this
->
assign
(
'limit'
,
$limit
);
$this
->
assign
(
'get'
,
input
());
return
$this
->
fetch
(
''
,
''
,
false
);
}
//快速编辑
public
function
editup
()
{
$post
=
input
();
$result
=
$this
->
user
->
update
([
$post
[
'af'
]
=>
$post
[
'av'
]],
[[
'id'
,
'='
,
$post
[
'id'
]]]);
if
(
$result
)
{
return
$this
->
returnMsg
(
'修改成功'
,
1
);
}
else
{
return
$this
->
returnMsg
(
'修改失败'
);
}
}
//会员详情
public
function
detail
()
{
$post
=
input
();
$info
=
$this
->
user
->
where
(
'id'
,
$post
[
'id'
])
->
find
();
$this
->
assign
(
'info'
,
$info
);
return
$this
->
fetch
(
''
,
''
,
false
);
}
public
function
del
()
{
$post
=
input
();
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
if
(
$this
->
user
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
return
$this
->
returnMsg
(
"删除成功"
,
1
);
}
else
{
return
$this
->
returnMsg
(
"删除失败"
);
}
}
}
\ No newline at end of file
app/admin/controller/course/Course.php
View file @
f0a8aa53
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
namespace
app\admin\controller\course
;
namespace
app\admin\controller\course
;
use
app\admin\controller\AdminBase
;
use
app\admin\controller\AdminBase
;
use
app\job\Jobtask
;
use
app\model\ShCourse
as
ShCourseModel
;
use
app\model\ShCourse
as
ShCourseModel
;
use
think\App
;
use
think\App
;
use
think\facade\Db
;
use
think\facade\Db
;
...
@@ -36,6 +37,7 @@ class Course extends AdminBase
...
@@ -36,6 +37,7 @@ class Course extends AdminBase
// 课程列表
// 课程列表
public
function
index
(
string
$do
=
''
)
public
function
index
(
string
$do
=
''
)
{
{
$limit
=
10
;
$limit
=
10
;
if
(
$do
==
'json'
)
{
if
(
$do
==
'json'
)
{
...
@@ -74,6 +76,12 @@ class Course extends AdminBase
...
@@ -74,6 +76,12 @@ class Course extends AdminBase
$post
=
input
();
$post
=
input
();
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
if
(
$this
->
course
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
if
(
$this
->
course
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
$course_id_arr
=
$this
->
course
->
where
(
"id IN("
.
$ids
.
")"
)
->
column
(
'id'
);
$course_id_arr
=
array_unique
(
$course_id_arr
);
foreach
(
$course_id_arr
as
$course_id
)
{
event
(
'Course'
,
[
'course_id'
=>
$course_id
,
'tasktype'
=>
'course'
,
'action'
=>
'shcourseupdate'
]);
}
return
$this
->
returnMsg
(
"删除成功"
,
1
);
return
$this
->
returnMsg
(
"删除成功"
,
1
);
}
else
{
}
else
{
return
$this
->
returnMsg
(
"删除失败"
);
return
$this
->
returnMsg
(
"删除失败"
);
...
@@ -101,8 +109,11 @@ class Course extends AdminBase
...
@@ -101,8 +109,11 @@ class Course extends AdminBase
$result
=
$this
->
course
->
where
(
'id'
,
$post
[
'id'
])
->
update
(
$updatedata
);
$result
=
$this
->
course
->
where
(
'id'
,
$post
[
'id'
])
->
update
(
$updatedata
);
if
(
$result
)
{
if
(
$result
)
{
return
$this
->
returnMsg
(
"操作成功"
,
1
);
if
(
$post
[
'shstatus'
]
==
1
)
{
}
else
{
event
(
'Course'
,
[
'id'
=>
$post
[
'id'
],
'tasktype'
=>
'course'
,
'action'
=>
'shstatus'
]);
}
return
$this
->
returnMsg
(
"操作成功"
,
1
);
}
else
{
return
$this
->
returnMsg
(
"操作失败"
);
return
$this
->
returnMsg
(
"操作失败"
);
}
}
...
...
app/admin/controller/course/CourseClass.php
View file @
f0a8aa53
...
@@ -91,6 +91,13 @@ class CourseClass extends AdminBase
...
@@ -91,6 +91,13 @@ class CourseClass extends AdminBase
$post
=
input
();
$post
=
input
();
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
if
(
$this
->
courseclass
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
if
(
$this
->
courseclass
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
$course_id_arr
=
$this
->
courseclass
->
where
(
"id IN("
.
$ids
.
")"
)
->
column
(
'course_id'
);
$course_id_arr
=
array_unique
(
$course_id_arr
);
foreach
(
$course_id_arr
as
$course_id
)
{
event
(
'Course'
,
[
'course_id'
=>
$course_id
,
'tasktype'
=>
'course'
,
'action'
=>
'shcourseupdate'
]);
}
return
$this
->
returnMsg
(
"删除成功"
,
1
);
return
$this
->
returnMsg
(
"删除成功"
,
1
);
}
else
{
}
else
{
return
$this
->
returnMsg
(
"删除失败"
);
return
$this
->
returnMsg
(
"删除失败"
);
...
...
app/admin/controller/course/CourseClassCategory.php
View file @
f0a8aa53
...
@@ -12,8 +12,9 @@ namespace app\admin\controller\course;
...
@@ -12,8 +12,9 @@ namespace app\admin\controller\course;
use
app\admin\controller\AdminBase
;
use
app\admin\controller\AdminBase
;
use
app\model\ShCourse
;
use
app\model\ShCourse
;
use
app\model\ShCourseClassCategory
AS
ShCourseClassCategoryModel
;
use
app\model\ShCourseClassCategory
as
ShCourseClassCategoryModel
;
use
think\App
;
use
think\App
;
/**
/**
* 后台主控制器
* 后台主控制器
*/
*/
...
@@ -46,9 +47,9 @@ class CourseClassCategory extends AdminBase
...
@@ -46,9 +47,9 @@ class CourseClassCategory extends AdminBase
if
(
isset
(
$post
[
'kc'
])
&&
!
empty
(
$post
[
'kc'
]))
{
if
(
isset
(
$post
[
'kc'
])
&&
!
empty
(
$post
[
'kc'
]))
{
$kcmap
[]
=
[
'title'
,
'like'
,
'%'
.
$post
[
'kc'
]
.
'%'
];
$kcmap
[]
=
[
'title'
,
'like'
,
'%'
.
$post
[
'kc'
]
.
'%'
];
$kcid_arr
=
ShCourse
::
where
(
$kcmap
)
->
column
(
'id'
);
$kcid_arr
=
ShCourse
::
where
(
$kcmap
)
->
column
(
'id'
);
if
(
$kcid_arr
)
{
if
(
$kcid_arr
)
{
$map
[]
=
[
'course_id'
,
'in'
,
$kcid_arr
];
$map
[]
=
[
'course_id'
,
'in'
,
$kcid_arr
];
}
else
{
}
else
{
$map
[]
=
[
'course_id'
,
'in'
,
99999
];
$map
[]
=
[
'course_id'
,
'in'
,
99999
];
}
}
}
}
...
@@ -57,8 +58,7 @@ class CourseClassCategory extends AdminBase
...
@@ -57,8 +58,7 @@ class CourseClassCategory extends AdminBase
}
}
$list
=
$this
->
courseclasscategory
->
where
(
$map
)
->
append
([
'course_title'
,
'user_info'
])
->
order
(
'createtime desc'
)
->
paginate
(
$post
[
'limit'
]);
$list
=
$this
->
courseclasscategory
->
where
(
$map
)
->
append
([
'course_title'
,
'user_info'
])
->
order
(
'createtime desc'
)
->
paginate
(
$post
[
'limit'
]);
return
$this
->
returnMsg
(
$list
);
return
$this
->
returnMsg
(
$list
);
}
}
...
@@ -76,12 +76,16 @@ class CourseClassCategory extends AdminBase
...
@@ -76,12 +76,16 @@ class CourseClassCategory extends AdminBase
}
}
public
function
del
()
public
function
del
()
{
{
$post
=
input
();
$post
=
input
();
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
if
(
$this
->
courseclasscategory
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
if
(
$this
->
courseclasscategory
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
$course_id_arr
=
$this
->
courseclasscategory
->
where
(
"id IN("
.
$ids
.
")"
)
->
column
(
'course_id'
);
$course_id_arr
=
array_unique
(
$course_id_arr
);
foreach
(
$course_id_arr
as
$course_id
)
{
event
(
'Course'
,
[
'course_id'
=>
$course_id
,
'tasktype'
=>
'course'
,
'action'
=>
'shcourseupdate'
]);
}
return
$this
->
returnMsg
(
"删除成功"
,
1
);
return
$this
->
returnMsg
(
"删除成功"
,
1
);
}
else
{
}
else
{
return
$this
->
returnMsg
(
"删除失败"
);
return
$this
->
returnMsg
(
"删除失败"
);
...
...
app/admin/controller/course/CourseWork.php
View file @
f0a8aa53
...
@@ -93,6 +93,12 @@ class CourseWork extends AdminBase
...
@@ -93,6 +93,12 @@ class CourseWork extends AdminBase
$post
=
input
();
$post
=
input
();
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
$ids
=
is_array
(
$post
[
'id'
])
?
implode
(
','
,
$post
[
'id'
])
:
$post
[
'id'
];
if
(
$this
->
coursework
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
if
(
$this
->
coursework
->
where
(
"id IN("
.
$ids
.
")"
)
->
update
([
'is_del'
=>
1
]))
{
$course_id_arr
=
$this
->
coursework
->
where
(
"id IN("
.
$ids
.
")"
)
->
column
(
'course_id'
);
$course_id_arr
=
array_unique
(
$course_id_arr
);
foreach
(
$course_id_arr
as
$course_id
)
{
event
(
'Course'
,
[
'course_id'
=>
$course_id
,
'tasktype'
=>
'course'
,
'action'
=>
'shcourseupdate'
]);
}
return
$this
->
returnMsg
(
"删除成功"
,
1
);
return
$this
->
returnMsg
(
"删除成功"
,
1
);
}
else
{
}
else
{
return
$this
->
returnMsg
(
"删除失败"
);
return
$this
->
returnMsg
(
"删除失败"
);
...
...
app/admin/controller/system/Setting.php
View file @
f0a8aa53
...
@@ -41,15 +41,24 @@ class Setting extends AdminBase
...
@@ -41,15 +41,24 @@ class Setting extends AdminBase
$rs
=
(
new
S
())
->
listArray
(
$where
,
'name,title,value,type,options,private,relation,tips'
);
$rs
=
(
new
S
())
->
listArray
(
$where
,
'name,title,value,type,options,private,relation,tips'
);
foreach
(
$rs
as
&
$v
){
foreach
(
$rs
as
&
$v
){
if
(
$v
[
'type'
]
==
'images'
){
if
(
$v
[
'type'
]
==
'images'
){
$v
[
'value'
]
=
$v
[
'value'
]
?
json_decode
(
$v
[
'value'
])
:
[];
$v
[
'value'
]
=
$v
[
'value'
]
?
json_decode
(
$v
[
'value'
])
:
[];
$patharr
=
$v
[
'value'
]
?
get_upload_file
(
$v
[
'value'
],
'list'
)
:
[];
$v
[
'patharr'
]
=
$patharr
?
array_column
(
$patharr
,
'fileurl'
)
:
[];
}
elseif
(
$v
[
'type'
]
==
'upfile'
){
}
elseif
(
$v
[
'type'
]
==
'upfile'
){
$v
[
'filetype'
]
=
$v
[
'options'
];
$v
[
'options'
]
=
''
;
$v
[
'filetype'
]
=
$v
[
'options'
];
$v
[
'options'
]
=
''
;
}
elseif
(
in_array
(
$v
[
'type'
],[
'year'
,
'month'
,
'date'
,
'time'
,
'datetime'
])){
}
elseif
(
in_array
(
$v
[
'type'
],[
'year'
,
'month'
,
'date'
,
'time'
,
'datetime'
])){
$v
[
'range'
]
=
$v
[
'options'
];
$v
[
'options'
]
=
''
;
$v
[
'range'
]
=
$v
[
'options'
];
$v
[
'options'
]
=
''
;
}
elseif
(
$v
[
'private'
]){
}
elseif
(
$v
[
'private'
]){
$v
[
'value'
]
=
half_replace
(
$v
[
'value'
]);
$v
[
'value'
]
=
half_replace
(
$v
[
'value'
]);
}
elseif
(
$v
[
'type'
]
==
'image'
){
$v
[
'pathid'
]
=
$v
[
'value'
];
$v
[
'value'
]
=
get_upload_file
(
$v
[
'value'
]);
}
}
$v
[
'placeholder'
]
=
$v
[
'tips'
];
$v
[
'placeholder'
]
=
$v
[
'tips'
];
if
(
$v
[
'options'
])
$v
[
'options'
]
=
parse_attr
(
$v
[
'options'
]);
if
(
$v
[
'options'
])
$v
[
'options'
]
=
parse_attr
(
$v
[
'options'
]);
}
}
return
$this
->
returnMsg
(
$rs
,
1
);
return
$this
->
returnMsg
(
$rs
,
1
);
...
...
app/admin/validate/AdvertValidate.php
0 → 100644
View file @
f0a8aa53
<?php
namespace
app\admin\validate
;
use
think\Validate
;
use
app\model
;
use
app\api\validate\BaseValidate
;
class
AdvertValidate
extends
BaseValidate
{
protected
$rule
=
[
'name'
=>
'require'
,
'p_id'
=>
'require'
,
'cover_img_id'
=>
'require'
,
];
protected
$message
=
[
'name.require'
=>
'广告标题不能为空'
,
'p_id.require'
=>
'请选择广告位置'
,
'cover_img_id.require'
=>
'请上传图片'
,
];
}
\ No newline at end of file
app/admin/view/advert/edit.html
0 → 100644
View file @
f0a8aa53
{extend name="base/header" /}
{block name="body"}
<div
style=
"margin: 0px 10px"
>
<form
class=
"layui-form "
style=
"margin-top: 20px;"
id=
"fjfrom"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
选择广告位
</label>
<div
class=
"layui-input-block"
>
<select
name=
"p_id"
>
<option
value=
""
>
选择广告位
</option>
{foreach $categorydata as $key=>$vo }
<option
value=
"{$vo.id}"
{
eq
name=
"$data.p_id|default=''"
value=
"$vo.id"
}
selected
{/
eq
}
>
{$vo.name}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
标题
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"name"
placeholder=
"请输入标题"
autocomplete=
"off"
class=
"layui-input"
value=
"{$data.name|default=''}"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
链接类型
</label>
<div
class=
"layui-input-block"
>
<input
type=
"radio"
name=
"type"
value=
"2"
title=
"内链"
checked
{
eq
name=
"$data.p_id|default=''"
value=
"2"
}
checked
{/
eq
}
>
<input
type=
"radio"
name=
"type"
value=
"1"
title=
"外链"
{
eq
name=
"$data.type|default=''"
value=
"1"
}
checked
{/
eq
}
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
链接
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"url"
placeholder=
"请输入链接"
autocomplete=
"off"
class=
"layui-input"
value=
"{$data.url|default=''}"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
显示隐藏
</label>
<div
class=
"layui-input-block"
>
<input
type=
"radio"
name=
"is_show"
value=
"1"
title=
"显示"
checked
{
eq
name=
"$data.is_show|default=''"
value=
"1"
}
checked
{/
eq
}
>
<input
type=
"radio"
name=
"is_show"
value=
"0"
title=
"隐藏"
{
eq
name=
"$data.is_show|default=''"
value=
"0"
}
checked
{/
eq
}
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
广告图片
</label>
<div
class=
"layui-input-block"
id=
"cover_img_id"
>
</div>
</div>
<input
type=
"hidden"
name=
"id"
value=
"{$data.id|default=0}"
>
</form>
</div>
{/block}
{block name="script"}
<script
type=
"text/javascript"
>
layui
.
use
([
'buildItems'
,
'form'
,
'laydate'
,
'util'
],
function
()
{
var
form
=
layui
.
form
;
/*解析顶部分组选项*/
var
str
=
[{
"name"
:
"cover_img_id"
,
"title"
:
"上传图片"
,
"value"
:
"{$data.cover_img_id|default=''|get_upload_file}"
,
"pathid"
:
"{$data.cover_img_id|default=''}"
,
"type"
:
"imagewt"
}];
layui
.
buildItems
.
build
({
fjbid
:
'fjfrom'
,
bid
:
'cover_img_id'
,
url
:
''
,
map
:
layui
.
cache
.
maps
+
'system.upload/'
,
gid
:
1
,
data
:
str
});
layui
.
buildItems
.
init
();
form
.
render
();
});
var
callbackdata
=
function
()
{
var
data
=
$
(
".layui-form"
).
serialize
();
return
data
;
};
</script>
{/block}
\ No newline at end of file
app/admin/view/advert/index.html
0 → 100644
View file @
f0a8aa53
<div
class=
"layui-fluid"
>
<style>
.files_itemadv
{
width
:
30px
;
height
:
30px
;
line-height
:
30px
;
cursor
:
pointer
;
padding
:
1px
;
background
:
#fff
;
display
:
-webkit-box
;
-moz-box-align
:
center
;
-webkit-box-align
:
center
;
-moz-box-pack
:
center
;
-webkit-box-pack
:
center
;}
.files_itemadv
img
{
max-width
:
28px
;
max-height
:
28px
;
border
:
0
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
<form
class=
"layui-form render"
>
<input
type=
"hidden"
name=
"groupid"
id=
"advert-groupid"
value=
""
/>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
style=
"width:250px;"
><input
type=
"text"
name=
"kw"
placeholder=
"关键词"
autocomplete=
"off"
class=
"layui-input"
lay-affix=
"clear"
/></div>
<div
class=
"layui-inline"
style=
"width:150px;"
>
<select
name=
"p_id"
>
<option
value=
""
>
广告位置
</option>
{foreach $categorydata as $key=>$vo }
<option
value=
"{$vo.id}"
>
{$vo.name}
</option>
{/foreach}
</select>
</div>
<div
class=
"layui-inline"
>
<div
class=
"layui-btn-group"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"search-advert"
><i
class=
"layui-icon layui-icon-search"
></i>
搜索
</button>
<a
class=
"layui-btn"
lay-submit
lay-filter=
"search-advert-all"
onclick=
"$('#advert-groupid').val('')"
><i
class=
"layui-icon layui-icon-light"
></i>
全部
</a>
<a
class=
"layui-btn"
id=
"advert-add"
><i
class=
"layui-icon layui-icon-add-circle"
></i>
添加
</a>
</div>
</div>
</div>
</form>
</div>
<div
class=
"layui-card-body"
>
<div
class=
"layui-card-box"
>
<table
lay-filter=
"advert"
id=
"advert"
></table>
</div>
</div>
</div>
</div>
<!--JS部分-->
<script>
layui
.
use
([
'vinfo'
,
'buildItems'
],
function
(){
var
map_root
=
layui
.
cache
.
maps
;
var
app_root
=
map_root
+
'advert/'
;
var
layer
=
layui
.
layer
,
table
=
layui
.
table
,
form
=
layui
.
form
,
admin
=
layui
.
admin
;
/*初始渲染*/
/*==============左树结构END==============*/
/*渲染数据*/
var
kc
=
$
(
'input[name=kc]'
).
val
();
table
.
render
({
elem
:
'#advert'
,
page
:
true
,
limit
:{
$limit
},
height
:
'full-341'
,
url
:
app_root
+
"index?&do=json"
,
where
:{
kc
:
kc
},
cols
:
[[
{
type
:
'checkbox'
,
fixed
:
'left'
},
{
field
:
'id'
,
width
:
50
,
unresize
:
true
,
align
:
'center'
,
title
:
'ID'
,
sort
:
!
0
},
{
field
:
'fileurl'
,
width
:
50
,
align
:
'center'
,
title
:
'缩略图'
,
templet
:
'<div><div class="files_itemadv"><img src="{{d.coverImg.fileurl}}" lay-event="advert-event-image" /></div></div>'
},
{
field
:
'name'
,
align
:
'center'
,
title
:
'标题'
,
edit
:
'text'
},
{
field
:
'advcatename'
,
align
:
'center'
,
title
:
'广告位置'
},
{
field
:
'type'
,
align
:
'center'
,
title
:
'链接类型'
,
templet
:
'<div>{{# if(d.type === 1){ }}外链{{# } else { }}内链{{# } }}</div>'
},
{
field
:
'is_show'
,
align
:
'center'
,
title
:
'是否显示'
,
templet
:
function
(
d
){
return
'<input type="checkbox" name="is_show" lay-skin="switch" lay-text="是|否" lay-filter="advert-chang" value="'
+
d
.
is_show
+
'" data-json="'
+
encodeURIComponent
(
JSON
.
stringify
(
d
))
+
'"'
+
(
d
.
is_show
==
1
?
' checked'
:
''
)
+
'>'
;},
unresize
:
true
,},
{
field
:
'create_time'
,
width
:
150
,
align
:
'center'
,
title
:
'创建时间'
},
{
field
:
'sort'
,
width
:
50
,
align
:
'center'
,
title
:
'排序'
,
edit
:
'text'
},
{
fixed
:
'right'
,
width
:
130
,
align
:
'center'
,
toolbar
:
'<div><a lay-event="edit" class="layui-btn layui-btn-xs">编辑</a><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a></div>'
,
title
:
'操作'
}
]],
done
:
function
(){
admin
.
vShow
(
$
(
'[lay-table-id="advert"]'
));
}
});
// 状态 - 开关操作
form
.
on
(
'switch(advert-chang)'
,
function
(
obj
){
var
json
=
JSON
.
parse
(
decodeURIComponent
(
$
(
this
).
data
(
'json'
)));
var
av
=
obj
.
elem
.
checked
?
1
:
0
;
admin
.
req
(
app_root
+
"editup"
,{
id
:
json
.
id
,
av
:
av
,
af
:
obj
.
elem
.
name
},
function
(
res
){
layer
.
tips
(
res
.
msg
,
obj
.
othis
,{
time
:
1000
});
if
(
res
.
code
===
0
)
obj
.
elem
.
checked
=
parseInt
(
obj
.
value
);
},
'post'
,{
headersToken
:
true
});
});
/*快编监听*/
table
.
on
(
'edit(advert)'
,
function
(
obj
){
admin
.
req
(
app_root
+
"editup"
,{
id
:
obj
.
data
.
id
,
av
:
obj
.
value
,
af
:
obj
.
field
},
function
(
res
){
layer
.
msg
(
res
.
msg
,{
shade
:[
0.4
,
'#000'
],
time
:
500
});
},
'post'
,{
headersToken
:
true
});
});
/**/
/*工具条监听*/
table
.
on
(
'tool(advert)'
,
function
(
obj
){
var
data
=
obj
.
data
;
var
id
=
data
.
id
;
if
(
obj
.
event
===
'edit'
){
advertOpen
(
id
);
}
else
if
(
obj
.
event
===
'del'
){
del
(
id
);
}
else
if
(
obj
.
event
===
'advert-event-image'
){
var
src
=
$
(
this
).
attr
(
'src'
),
alt
=
$
(
this
).
attr
(
'alt'
);
layer
.
photos
({
photos
:{
data
:[{
alt
:
alt
,
src
:
src
}],
start
:
'0'
},
anim
:
5
,
shade
:[
0.4
,
'#000'
]});
}
});
/**/
/*删除*/
function
del
(
ids
){
layer
.
confirm
(
'确定要删除所选记录吗?'
,
function
(){
admin
.
req
(
app_root
+
"del"
,{
id
:
ids
},
function
(
res
){
layer
.
msg
(
res
.
msg
,{
shade
:[
0.4
,
'#000'
],
time
:
1500
},
function
(){
if
(
res
.
code
==
1
)
table
.
reloadData
(
'advert'
);
});
},
'post'
,{
headersToken
:
true
});
});
}
/**/
$
(
'#advert-add'
).
on
(
'click'
,
function
(){
advertOpen
();});
/**/
/*弹出窗*/
function
advertOpen
(
id
=
''
,
type
=
''
){
var
title
=
"添加广告"
;
if
(
id
>
0
){
title
=
'编辑广告'
;
}
layer
.
open
({
type
:
2
,
area
:
[
'900px'
,
'900px'
],
title
:
title
,
btn
:
[
'确定'
,
'关闭'
],
fixed
:
false
,
//不固定
content
:
'/admin/advert/edit?id='
+
id
+
'&type='
+
type
,
yes
:
function
(
index
,
layero
){
var
data
=
window
[
"layui-layer-iframe"
+
index
].
callbackdata
();
$
.
ajax
({
method
:
"post"
,
url
:
layui
.
cache
.
maps
+
'/advert/edit'
,
data
:
data
,
dataType
:
"json"
,
success
:
function
(
res
){
if
(
res
.
code
===
1
)
{
layer
.
msg
(
res
.
msg
,{
icon
:
1
,
shade
:[
0.4
,
'#000'
],
time
:
1500
},
function
(){
layer
.
close
(
index
);
table
.
reloadData
(
'advert'
);
});
}
else
{
layer
.
msg
(
res
.
msg
,{
icon
:
2
,
shade
:[
0.4
,
'#000'
],
time
:
1500
},
function
(){
});
}
// layer.closeAll();
}
});
},
});
}
/**/
});
</script>
\ No newline at end of file
app/admin/view/advert_cate/edit.html
0 → 100644
View file @
f0a8aa53
{extend name="base/header" /}
{block name="body"}
<div
style=
"margin: 0px 10px"
>
<form
class=
"layui-form "
style=
"margin-top: 20px;"
id=
"fjfrom"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
标题
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"name"
placeholder=
"请输入标题"
autocomplete=
"off"
class=
"layui-input"
value=
"{$data.name|default=''}"
>
</div>
</div>
<input
type=
"hidden"
name=
"id"
value=
"{$data.id|default=0}"
>
</form>
</div>
{/block}
{block name="script"}
<script
type=
"text/javascript"
>
layui
.
use
([
'buildItems'
,
'form'
,
'laydate'
,
'util'
],
function
()
{
var
form
=
layui
.
form
;
/*解析顶部分组选项*/
var
str
=
[{
"name"
:
"cover_img_id"
,
"title"
:
"上传图片"
,
"value"
:
"{$data.cover_img_id|default=''|get_upload_file}"
,
"pathid"
:
"{$data.cover_img_id|default=''}"
,
"type"
:
"imagewt"
}];
layui
.
buildItems
.
build
({
fjbid
:
'fjfrom'
,
bid
:
'cover_img_id'
,
url
:
''
,
map
:
layui
.
cache
.
maps
+
'system.upload/'
,
gid
:
1
,
data
:
str
});
layui
.
buildItems
.
init
();
form
.
render
();
});
var
callbackdata
=
function
()
{
var
data
=
$
(
".layui-form"
).
serialize
();
return
data
;
};
</script>
{/block}
\ No newline at end of file
app/admin/view/advert_cate/index.html
0 → 100644
View file @
f0a8aa53
<div
class=
"layui-fluid"
>
<style>
.files_itemadv
{
width
:
30px
;
height
:
30px
;
line-height
:
30px
;
cursor
:
pointer
;
padding
:
1px
;
background
:
#fff
;
display
:
-webkit-box
;
-moz-box-align
:
center
;
-webkit-box-align
:
center
;
-moz-box-pack
:
center
;
-webkit-box-pack
:
center
;}
.files_itemadv
img
{
max-width
:
28px
;
max-height
:
28px
;
border
:
0
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
<form
class=
"layui-form render"
>
<input
type=
"hidden"
name=
"groupid"
id=
"advertcate-groupid"
value=
""
/>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
style=
"width:250px;"
><input
type=
"text"
name=
"kw"
placeholder=
"关键词"
autocomplete=
"off"
class=
"layui-input"
lay-affix=
"clear"
/></div>
<div
class=
"layui-inline"
>
<div
class=
"layui-btn-group"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"search-advertcate"
><i
class=
"layui-icon layui-icon-search"
></i>
搜索
</button>
<a
class=
"layui-btn"
lay-submit
lay-filter=
"search-advertcate-all"
onclick=
"$('#advertcate-groupid').val('')"
><i
class=
"layui-icon layui-icon-light"
></i>
全部
</a>
<a
class=
"layui-btn"
id=
"advertcate-add"
><i
class=
"layui-icon layui-icon-add-circle"
></i>
添加
</a>
</div>
</div>
</div>
</form>
</div>
<div
class=
"layui-card-body"
>
<div
class=
"layui-card-box"
>
<table
lay-filter=
"advertcate"
id=
"advertcate"
></table>
</div>
</div>
</div>
</div>
<!--JS部分-->
<script>
layui
.
use
([
'vinfo'
,
'buildItems'
],
function
(){
var
map_root
=
layui
.
cache
.
maps
;
var
app_root
=
map_root
+
'advert_cate/'
;
var
layer
=
layui
.
layer
,
table
=
layui
.
table
,
form
=
layui
.
form
,
admin
=
layui
.
admin
;
/*初始渲染*/
/*==============左树结构END==============*/
/*渲染数据*/
var
kc
=
$
(
'input[name=kc]'
).
val
();
table
.
render
({
elem
:
'#advertcate'
,
page
:
true
,
limit
:{
$limit
},
height
:
'full-341'
,
url
:
app_root
+
"index?&do=json"
,
where
:{
kc
:
kc
},
cols
:
[[
{
type
:
'checkbox'
,
fixed
:
'left'
},
{
field
:
'id'
,
width
:
50
,
unresize
:
true
,
align
:
'center'
,
title
:
'ID'
,
sort
:
!
0
},
{
field
:
'name'
,
align
:
'center'
,
title
:
'标题'
,
edit
:
'text'
},
{
field
:
'create_time'
,
width
:
150
,
align
:
'center'
,
title
:
'创建时间'
},
{
fixed
:
'right'
,
width
:
130
,
align
:
'center'
,
toolbar
:
'<div><a lay-event="edit" class="layui-btn layui-btn-xs">编辑</a><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a></div>'
,
title
:
'操作'
}
]],
done
:
function
(){
admin
.
vShow
(
$
(
'[lay-table-id="advertcate"]'
));
}
});
// 状态 - 开关操作
form
.
on
(
'switch(advertcate-chang)'
,
function
(
obj
){
var
json
=
JSON
.
parse
(
decodeURIComponent
(
$
(
this
).
data
(
'json'
)));
var
av
=
obj
.
elem
.
checked
?
1
:
0
;
admin
.
req
(
app_root
+
"editup"
,{
id
:
json
.
id
,
av
:
av
,
af
:
obj
.
elem
.
name
},
function
(
res
){
layer
.
tips
(
res
.
msg
,
obj
.
othis
,{
time
:
1000
});
if
(
res
.
code
===
0
)
obj
.
elem
.
checked
=
parseInt
(
obj
.
value
);
},
'post'
,{
headersToken
:
true
});
});
/*快编监听*/
table
.
on
(
'edit(advertcate)'
,
function
(
obj
){
admin
.
req
(
app_root
+
"editup"
,{
id
:
obj
.
data
.
id
,
av
:
obj
.
value
,
af
:
obj
.
field
},
function
(
res
){
layer
.
msg
(
res
.
msg
,{
shade
:[
0.4
,
'#000'
],
time
:
500
});
},
'post'
,{
headersToken
:
true
});
});
/**/
/*工具条监听*/
table
.
on
(
'tool(advertcate)'
,
function
(
obj
){
var
data
=
obj
.
data
;
var
id
=
data
.
id
;
if
(
obj
.
event
===
'edit'
){
advertcateOpen
(
id
);
}
else
if
(
obj
.
event
===
'del'
){
del
(
id
);
}
else
if
(
obj
.
event
===
'advertcate-event-image'
){
var
src
=
$
(
this
).
attr
(
'src'
),
alt
=
$
(
this
).
attr
(
'alt'
);
layer
.
photos
({
photos
:{
data
:[{
alt
:
alt
,
src
:
src
}],
start
:
'0'
},
anim
:
5
,
shade
:[
0.4
,
'#000'
]});
}
});
/**/
/*删除*/
function
del
(
ids
){
layer
.
confirm
(
'确定要删除所选记录吗?'
,
function
(){
admin
.
req
(
app_root
+
"del"
,{
id
:
ids
},
function
(
res
){
layer
.
msg
(
res
.
msg
,{
shade
:[
0.4
,
'#000'
],
time
:
1500
},
function
(){
if
(
res
.
code
==
1
)
table
.
reloadData
(
'advertcate'
);
});
},
'post'
,{
headersToken
:
true
});
});
}
/**/
$
(
'#advertcate-add'
).
on
(
'click'
,
function
(){
advertcateOpen
();});
/**/
/*弹出窗*/
function
advertcateOpen
(
id
=
''
,
type
=
''
){
var
title
=
"添加广告"
;
if
(
id
>
0
){
title
=
'编辑广告'
;
}
layer
.
open
({
type
:
2
,
area
:
[
'900px'
,
'900px'
],
title
:
title
,
btn
:
[
'确定'
,
'关闭'
],
fixed
:
false
,
//不固定
content
:
'/admin/advert_cate/edit?id='
+
id
+
'&type='
+
type
,
yes
:
function
(
index
,
layero
){
var
data
=
window
[
"layui-layer-iframe"
+
index
].
callbackdata
();
$
.
ajax
({
method
:
"post"
,
url
:
layui
.
cache
.
maps
+
'/advert_cate/edit'
,
data
:
data
,
dataType
:
"json"
,
success
:
function
(
res
){
if
(
res
.
code
===
1
)
{
layer
.
msg
(
res
.
msg
,{
icon
:
1
,
shade
:[
0.4
,
'#000'
],
time
:
1500
},
function
(){
layer
.
close
(
index
);
table
.
reloadData
(
'advertcate'
);
});
}
else
{
layer
.
msg
(
res
.
msg
,{
icon
:
2
,
shade
:[
0.4
,
'#000'
],
time
:
1500
},
function
(){
});
}
// layer.closeAll();
}
});
},
});
}
/**/
});
</script>
\ No newline at end of file
app/admin/view/article/index.html
View file @
f0a8aa53
...
@@ -194,5 +194,7 @@
...
@@ -194,5 +194,7 @@
},
},
});
});
}
/**/
}
/**/
});
});
</script>
</script>
\ No newline at end of file
app/admin/view/system/manager/index.html
View file @
f0a8aa53
...
@@ -119,7 +119,21 @@ layui.use(['vinfo', 'buildItems'], function(){
...
@@ -119,7 +119,21 @@ layui.use(['vinfo', 'buildItems'], function(){
}
}
/*初始渲染*/
/*初始渲染*/
renderTree
(
organArr
);
renderTree
(
organArr
);
/*左树添加按钮*/
$
(
'#organ-add'
).
on
(
'click'
,
function
(){
organOpen
();});
/**/
/*左树编辑按钮*/
$
(
'#organ-edit'
).
on
(
'click'
,
function
(){
organOpen
(
organObj
);});
/**/
/*左树删除按钮*/
$
(
'#organ-del'
).
on
(
'click'
,
function
(){
if
(
!
organObj
)
return
layer
.
msg
(
'未选择机构'
);
layer
.
confirm
(
'确定要删除所选机构吗?'
,
function
(){
admin
.
req
(
app_root
+
"odel"
,{
id
:
organObj
.
id
},
function
(
res
){
layer
.
msg
(
res
.
msg
,{
shade
:[
0.4
,
'#000'
],
time
:
1500
},
function
(){
if
(
res
.
code
==
1
)
renderTree
(
res
.
data
,
true
);
});
},
'post'
,{
headersToken
:
true
});
});
});
/**/
/*树形编辑弹窗*/
/*树形编辑弹窗*/
function
organOpen
(
Dt
){
function
organOpen
(
Dt
){
admin
.
open
({
admin
.
open
({
...
...
app/admin/view/user/detail.html
0 → 100644
View file @
f0a8aa53
{extend name="base/header" /}
{block name="body"}
<style>
.layui-table
.widthtd
{
width
:
120px
;}
</style>
<div
style=
"margin: 0px 10px"
>
<p>
基本信息:
</p>
<table
class=
"layui-table"
>
<tbody>
<tr>
<td
class=
"widthtd"
><strong>
头像
</strong></td>
<td><img
width=
"50"
height=
"50"
src=
"{$info.headericourl}"
class=
"imgclick"
/></td>
<td
class=
"widthtd"
><strong>
用户名
</strong></td>
<td>
{$info.username}
</td>
</tr>
<tr>
<td
class=
"widthtd"
><strong>
手机号
</strong></td>
<td>
{$info.mobile}
</td>
<td
class=
"widthtd"
><strong>
注册时间
</strong></td>
<td>
{$info.reg_time}
</td>
</tr>
<tr>
<td
class=
"widthtd"
><strong>
真实姓名
</strong></td>
<td>
{$info.realname}
</td>
<td
class=
"widthtd"
><strong>
余额/信用分
</strong></td>
<td>
{$info.role == 1 ? $info.money : $info.credit_money}
</td>
</tr>
<tr>
<td
class=
"widthtd"
><strong>
用户类型
</strong></td>
<td>
{$info.roletxt}
</td>
<td
class=
"widthtd"
><strong>
最后登录时间
</strong></td>
<td>
{$info.last_login_time}
</td>
</tr>
<tr>
<td
class=
"widthtd"
><strong>
性别
</strong></td>
<td>
{$info.sexdata}
</td>
<td
class=
"widthtd"
><strong>
个人介绍
</strong></td>
<td>
{$info.description}
</td>
</tr>
</tbody>
</table>
<p>
实名认证:
</p>
<table
class=
"layui-table"
>
<colgroup>
<col
width=
"150"
>
<col
width=
"150"
>
<col>
</colgroup>
<thead>
<tr>
<th>
人物
</th>
<th>
民族
</th>
<th>
格言
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
孔子
</td>
<td>
华夏
</td>
<td>
有朋自远方来,不亦乐乎
</td>
</tr>
<tr>
<td>
孟子
</td>
<td>
华夏
</td>
<td>
穷则独善其身,达则兼济天下
</td>
</tr>
</tbody>
</table>
</div>
{/block}
{block name="script"}
<script
type=
"text/javascript"
>
layui
.
use
([
'buildItems'
,
'form'
,
'laydate'
,
'util'
],
function
()
{
var
form
=
layui
.
form
;
/*解析顶部分组选项*/
var
str
=
[{
"name"
:
"cover_img_id"
,
"title"
:
"上传图片"
,
"value"
:
"{$data.cover_img_id|default=''|get_upload_file}"
,
"pathid"
:
"{$data.cover_img_id|default=''}"
,
"type"
:
"imagewt"
}];
layui
.
buildItems
.
build
({
fjbid
:
'fjfrom'
,
bid
:
'cover_img_id'
,
url
:
''
,
map
:
layui
.
cache
.
maps
+
'system.upload/'
,
gid
:
1
,
data
:
str
});
layui
.
buildItems
.
init
();
form
.
render
();
});
var
callbackdata
=
function
()
{
var
data
=
$
(
".layui-form"
).
serialize
();
return
data
;
};
</script>
{/block}
\ No newline at end of file
app/admin/view/user/index.html
0 → 100644
View file @
f0a8aa53
<div
class=
"layui-fluid"
>
<style>
.files_itemadv
{
width
:
30px
;
height
:
30px
;
line-height
:
30px
;
cursor
:
pointer
;
padding
:
1px
;
background
:
#fff
;
display
:
-webkit-box
;
-moz-box-align
:
center
;
-webkit-box-align
:
center
;
-moz-box-pack
:
center
;
-webkit-box-pack
:
center
;}
.files_itemadv
img
{
max-width
:
28px
;
max-height
:
28px
;
border
:
0
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
<form
class=
"layui-form render"
>
<input
type=
"hidden"
name=
"groupid"
id=
"user-groupid"
value=
""
/>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
style=
"width:250px;"
><input
type=
"text"
name=
"kw"
placeholder=
"关键词"
autocomplete=
"off"
class=
"layui-input"
lay-affix=
"clear"
/></div>
<div
class=
"layui-inline"
>
<div
class=
"layui-btn-group"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"search-user"
><i
class=
"layui-icon layui-icon-search"
></i>
搜索
</button>
<a
class=
"layui-btn"
lay-submit
lay-filter=
"search-user-all"
onclick=
"$('#user-groupid').val('')"
><i
class=
"layui-icon layui-icon-light"
></i>
全部
</a>
</div>
</div>
</div>
</form>
</div>
<div
class=
"layui-card-body"
>
<div
class=
"layui-card-box"
>
<table
lay-filter=
"user"
id=
"user"
></table>
</div>
</div>
</div>
</div>
<script
type=
"text/html"
id=
"userdemo"
>
<
div
class
=
"layui-clear-space"
>
<
a
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"detail"
>
详情
<
/a
>
<
a
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"more"
>
更多
<
i
class
=
"layui-icon layui-icon-down"
><
/i
>
<
/a
>
<
/div
>
</script>
<!--JS部分-->
<script>
layui
.
use
([
'vinfo'
,
'buildItems'
],
function
(){
var
map_root
=
layui
.
cache
.
maps
;
var
app_root
=
map_root
+
'user/'
;
var
layer
=
layui
.
layer
,
table
=
layui
.
table
,
form
=
layui
.
form
,
admin
=
layui
.
admin
;
var
dropdown
=
layui
.
dropdown
;
/*初始渲染*/
/*==============左树结构END==============*/
/*渲染数据*/
var
kc
=
$
(
'input[name=kc]'
).
val
();
table
.
render
({
elem
:
'#user'
,
page
:
true
,
limit
:{
$limit
},
height
:
'full-341'
,
url
:
app_root
+
"index?&do=json"
,
where
:{
kc
:
kc
},
cols
:
[[
{
type
:
'checkbox'
,
fixed
:
'left'
},
{
field
:
'id'
,
width
:
50
,
unresize
:
true
,
align
:
'center'
,
title
:
'ID'
,
sort
:
!
0
},
{
field
:
'headericourl'
,
width
:
50
,
align
:
'center'
,
title
:
'头像'
,
templet
:
'<div><div class="files_itemadv"><img src="{{d.headericourl}}" lay-event="user-event-image" /></div></div>'
},
{
field
:
'username'
,
align
:
'center'
,
title
:
'用户名'
},
{
field
:
'realname'
,
align
:
'center'
,
width
:
120
,
title
:
'真实姓名'
,
templet
:
'<div>{{= d.realname ? d.realname : "-"}}</div>'
},
{
field
:
'mobile'
,
align
:
'center'
,
width
:
120
,
title
:
'手机号'
},
{
field
:
'roletxt'
,
align
:
'center'
,
width
:
120
,
title
:
'用户类型'
},
{
field
:
'sexdata'
,
align
:
'center'
,
width
:
100
,
title
:
'性别'
},
{
field
:
'money'
,
align
:
'center'
,
width
:
100
,
title
:
'余额/信用分'
,
templet
:
'<div>{{= d.role == 1 ? d.money : d.credit_money}}</div>'
},
{
field
:
'status'
,
align
:
'center'
,
width
:
100
,
title
:
'是否启用'
,
templet
:
function
(
d
){
return
'<input type="checkbox" name="status" lay-skin="switch" lay-text="是|否" lay-filter="user-chang" value="'
+
d
.
status
+
'" data-json="'
+
encodeURIComponent
(
JSON
.
stringify
(
d
))
+
'"'
+
(
d
.
status
==
1
?
' checked'
:
''
)
+
'>'
;},
unresize
:
true
,},
{
field
:
'reg_time'
,
width
:
150
,
align
:
'center'
,
title
:
'注册时间'
},
{
fixed
:
'right'
,
width
:
120
,
align
:
'center'
,
templet
:
'#userdemo'
,
title
:
'操作'
}
]],
done
:
function
(){
admin
.
vShow
(
$
(
'[lay-table-id="user"]'
));
}
});
// 状态 - 开关操作
form
.
on
(
'switch(user-chang)'
,
function
(
obj
){
var
json
=
JSON
.
parse
(
decodeURIComponent
(
$
(
this
).
data
(
'json'
)));
var
av
=
obj
.
elem
.
checked
?
1
:
0
;
admin
.
req
(
app_root
+
"editup"
,{
id
:
json
.
id
,
av
:
av
,
af
:
obj
.
elem
.
name
},
function
(
res
){
layer
.
tips
(
res
.
msg
,
obj
.
othis
,{
time
:
1000
});
if
(
res
.
code
===
0
)
obj
.
elem
.
checked
=
parseInt
(
obj
.
value
);
},
'post'
,{
headersToken
:
true
});
});
/*快编监听*/
table
.
on
(
'edit(user)'
,
function
(
obj
){
admin
.
req
(
app_root
+
"editup"
,{
id
:
obj
.
data
.
id
,
av
:
obj
.
value
,
af
:
obj
.
field
},
function
(
res
){
layer
.
msg
(
res
.
msg
,{
shade
:[
0.4
,
'#000'
],
time
:
500
});
},
'post'
,{
headersToken
:
true
});
});
/**/
/*工具条监听*/
table
.
on
(
'tool(user)'
,
function
(
obj
){
var
data
=
obj
.
data
;
var
id
=
data
.
id
;
if
(
obj
.
event
===
'detail'
){
userOpen
(
id
);
}
else
if
(
obj
.
event
===
'del'
){
del
(
id
);
}
else
if
(
obj
.
event
===
'user-event-image'
){
var
src
=
$
(
this
).
attr
(
'src'
),
alt
=
$
(
this
).
attr
(
'alt'
);
layer
.
photos
({
photos
:{
data
:[{
alt
:
alt
,
src
:
src
}],
start
:
'0'
},
anim
:
5
,
shade
:[
0.4
,
'#000'
]});
}
else
if
(
obj
.
event
===
'more'
){
// 更多 - 下拉菜单
dropdown
.
render
({
elem
:
this
,
// 触发事件的 DOM 对象
show
:
true
,
// 外部事件触发即显示
data
:
[{
title
:
'资金记录'
,
id
:
'monelog'
},{
title
:
'重置密码'
,
id
:
'restpwd'
},{
title
:
'删除'
,
id
:
'del'
}],
click
:
function
(
menudata
){
if
(
menudata
.
id
===
'keshi'
){
window
.
location
.
href
=
"#/course.course_class/index/kc="
+
encodeURIComponent
(
data
.
title
);
}
else
if
(
menudata
.
id
===
'restpwd'
){
window
.
location
.
href
=
"#/course.course_class_category/index/kc="
+
encodeURIComponent
(
data
.
title
);
}
else
if
(
menudata
.
id
===
'zuoye'
){
window
.
location
.
href
=
"#/course.course_work/index/kc="
+
encodeURIComponent
(
data
.
title
);
}
else
if
(
menudata
.
id
===
'del'
){
del
(
id
);
}
},
id
:
'dropdown-table-tool'
,
align
:
'right'
,
// 右对齐弹出
style
:
'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);'
// 设置额外样式
});
}
});
/**/
/*删除*/
function
del
(
ids
){
layer
.
confirm
(
'确定要删除所选记录吗?'
,
function
(){
admin
.
req
(
app_root
+
"del"
,{
id
:
ids
},
function
(
res
){
layer
.
msg
(
res
.
msg
,{
shade
:[
0.4
,
'#000'
],
time
:
1500
},
function
(){
if
(
res
.
code
==
1
)
table
.
reloadData
(
'user'
);
});
},
'post'
,{
headersToken
:
true
});
});
}
/**/
/*弹出窗*/
function
userOpen
(
id
=
''
,
type
=
''
){
layer
.
open
({
type
:
2
,
area
:
[
'900px'
,
'900px'
],
title
:
'会员详情'
,
btn
:
[
'确定'
,
'关闭'
],
fixed
:
false
,
//不固定
content
:
'/admin/user/detail?id='
+
id
+
'&type='
+
type
,
yes
:
function
(
index
,
layero
){
layer
.
close
(
index
);
},
});
}
/**/
});
</script>
\ No newline at end of file
app/common.php
View file @
f0a8aa53
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*/
*/
// 版本信息
// 版本信息
define
(
'VT_VERSION'
,
'2.2.
10
'
);
define
(
'VT_VERSION'
,
'2.2.
5
'
);
// 后台管理员 session 标识
// 后台管理员 session 标识
define
(
'VT_MANAGER'
,
'V_MANAGER'
);
define
(
'VT_MANAGER'
,
'V_MANAGER'
);
// 前台会员 session 标识
// 前台会员 session 标识
...
@@ -38,13 +38,13 @@ function get_upload_file($fileid = '', $datatype = '')
...
@@ -38,13 +38,13 @@ function get_upload_file($fileid = '', $datatype = '')
if
(
$datatype
==
'list'
)
{
if
(
$datatype
==
'list'
)
{
//多附件读取列表
//多附件读取列表
$map
[]
=
[
'fileid'
,
'in'
,
$fileid
];
$map
[]
=
[
'fileid'
,
'in'
,
$fileid
];
return
SystemUploadFile
::
where
(
$map
)
->
select
();
return
SystemUploadFile
::
where
(
$map
)
->
select
()
->
toArray
()
;
}
elseif
(
$datatype
==
'info'
)
{
}
elseif
(
$datatype
==
'info'
)
{
$map
[]
=
[
'fileid'
,
'='
,
$fileid
];
$map
[]
=
[
'fileid'
,
'='
,
$fileid
];
return
SystemUploadFile
::
where
(
$map
)
->
find
();
return
SystemUploadFile
::
where
(
$map
)
->
find
();
}
else
{
}
else
{
$fileinfo
=
(
new
SystemUploadFile
)
->
where
(
'fileid'
,
$fileid
)
->
find
();
$fileinfo
=
(
new
SystemUploadFile
)
->
where
(
'fileid'
,
$fileid
)
->
find
();
return
$fileinfo
[
'fileurl'
]
;
return
isset
(
$fileinfo
[
'fileurl'
])
?
$fileinfo
[
'fileurl'
]
:
''
;
}
}
}
}
...
...
app/event.php
View file @
f0a8aa53
...
@@ -14,5 +14,7 @@ return [
...
@@ -14,5 +14,7 @@ return [
//日志write方法标签位
//日志write方法标签位
'LogWrite'
=>
[],
'LogWrite'
=>
[],
],
],
'subscribe'
=>
[],
'subscribe'
=>
[
'app\subscribe\course'
],
];
];
app/job/Jobtask.php
0 → 100644
View file @
f0a8aa53
<?php
namespace
app\job
;
use
think\facade\Log
;
use
think\queue\Job
;
use
think\facade\Db
;
class
Jobtask
{
public
function
fire
(
Job
$job
,
$data
)
{
//....这里执行具体的任务
// 处理课程审核通过数据同步
if
(
$data
[
'tasktype'
]
==
'course'
)
{
Db
::
startTrans
();
try
{
$this
->
synccourse
(
$data
);
Db
::
commit
();
$job
->
delete
();
Log
::
write
(
'成功:'
.
json_encode
(
$data
));
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
Log
::
write
(
'失败:'
.
$e
->
getMessage
());
$job
->
release
();
//$delay为延迟时间
}
}
// if ($job->attempts() > 3) {
// //通过这个方法可以检查这个任务已经重试了几次了
// }
//
// //如果任务执行成功后 记得删除任务,不然这个任务会重复执行,直到达到最大重试次数后失败后,执行failed方法
//
// // 也可以重新发布这个任务
// $job->release(); //$delay为延迟时间
}
public
function
failed
(
$data
)
{
Log
::
write
(
'测试日志信息,失败'
);
// ...任务达到最大重试次数后,失败了
}
//同步课程
public
function
synccourse
(
$data
)
{
if
(
$data
[
'action'
]
==
'shstatus'
)
{
//更新课程
$courseinfo
=
Db
::
name
(
'sh_course'
)
->
where
(
'id'
,
$data
[
'course_id'
])
->
find
();
$is_cz
=
Db
::
name
(
'course'
)
->
where
(
'id'
,
$data
[
'course_id'
])
->
count
();
if
(
$is_cz
>
0
)
{
unset
(
$courseinfo
[
'click'
]);
unset
(
$courseinfo
[
'tvclick'
]);
Db
::
name
(
'course'
)
->
update
(
$courseinfo
);
}
else
{
Db
::
name
(
'course'
)
->
insert
(
$courseinfo
);
//添加课程
}
//处理课时
$course_class_list
=
Db
::
name
(
'sh_course_class'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
select
()
->
toArray
();
Db
::
name
(
'course_class'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
delete
();
//删除课时
Db
::
name
(
'course_class'
)
->
insertAll
(
$course_class_list
);
//添加课时
//处理章节
$course_class_category
=
Db
::
name
(
'sh_course_class_category'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
select
()
->
toArray
();
if
(
$course_class_category
){
Db
::
name
(
'course_class_category'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
delete
();
//删除章节
Db
::
name
(
'course_class_category'
)
->
insertAll
(
$course_class_category
);
//添加章节
}
//处理作业
$course_work
=
Db
::
name
(
'sh_course_work'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
select
()
->
toArray
();
if
(
$course_work
){
Db
::
name
(
'course_work'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
delete
();
//删除作业
Db
::
name
(
'course_work'
)
->
insertAll
(
$course_work
);
//添加作业
}
}
elseif
(
$data
[
'action'
]
==
'shcourseupdate'
)
{
//更新状态数据 删除,上下架
$courseinfo
=
Db
::
name
(
'sh_course'
)
->
field
(
'is_sell,is_del'
)
->
where
(
'id'
,
$data
[
'course_id'
])
->
find
();
Db
::
name
(
'course'
)
->
where
(
'id'
,
$data
[
'course_id'
])
->
update
(
$courseinfo
);
//处理课时
$course_class_list
=
Db
::
name
(
'sh_course_class'
)
->
field
(
'id,is_del,is_sell'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
select
()
->
toArray
();
foreach
(
$course_class_list
as
$item
)
{
Db
::
name
(
'course_class'
)
->
update
(
$item
);
}
//处理章节
$course_class_category
=
Db
::
name
(
'sh_course_class_category'
)
->
field
(
'id,is_del'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
select
()
->
toArray
();
foreach
(
$course_class_category
as
$item
)
{
Db
::
name
(
'course_class_category'
)
->
update
(
$item
);
}
//处理作业
$course_work
=
Db
::
name
(
'sh_course_work'
)
->
field
(
'id,is_del'
)
->
where
(
'course_id'
,
$data
[
'course_id'
])
->
select
()
->
toArray
();
foreach
(
$course_work
as
$item
)
{
Db
::
name
(
'course_work'
)
->
update
(
$item
);
}
}
elseif
(
$data
[
'action'
]
==
'courseupdateclick'
)
{
//更新销量阅读量
$courseinfo
=
Db
::
name
(
'course'
)
->
field
(
'click,tvclick'
)
->
where
(
'id'
,
$data
[
'course_id'
])
->
find
();
Db
::
name
(
'sh_course'
)
->
where
(
'id'
,
$data
[
'course_id'
])
->
update
(
$courseinfo
);
}
}
}
\ No newline at end of file
app/model/ShCourseWork.php
View file @
f0a8aa53
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
namespace
app\model
;
namespace
app\model
;
use
app\model\project\User
;
use
app\model\project\User
;
use
think\facade\Db
;
use
think\facade\Db
;
use
think\Model
;
use
think\Model
;
...
...
app/model/project/Advert.php
View file @
f0a8aa53
...
@@ -19,5 +19,9 @@ class Advert extends Model
...
@@ -19,5 +19,9 @@ class Advert extends Model
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'cover_img_id'
)
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'cover_img_id'
)
->
field
(
'fileid, filename, filesize, fileurl, filetype'
);
->
field
(
'fileid, filename, filesize, fileurl, filetype'
);
}
}
public
function
getAdvcatenameAttr
(
$value
,
$data
){
return
AdvertCate
::
find
(
$data
[
'p_id'
])
->
name
;
}
}
}
\ No newline at end of file
app/model/project/User.php
View file @
f0a8aa53
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
app\model\project
;
namespace
app\model\project
;
use
think\Model
;
use
think\Model
;
use
function
Symfony
\Component\Translation\t
;
class
User
extends
Model
class
User
extends
Model
{
{
...
@@ -10,10 +11,8 @@ class User extends Model
...
@@ -10,10 +11,8 @@ class User extends Model
protected
$name
=
'user'
;
protected
$name
=
'user'
;
protected
$autoWriteTimestamp
=
true
;
protected
$autoWriteTimestamp
=
true
;
protected
$createTime
=
'create_time'
;
protected
$createTime
=
'create_time'
;
protected
$hidden
=
[
'password'
,
'token'
,
'salt'
];
protected
$hidden
=
[
'password'
,
'token'
,
'salt'
];
public
function
getSchoolData
()
public
function
getSchoolData
()
{
{
...
@@ -25,5 +24,52 @@ class User extends Model
...
@@ -25,5 +24,52 @@ class User extends Model
return
$this
->
hasOne
(
Business
::
class
,
'user_id'
,
'id'
);
return
$this
->
hasOne
(
Business
::
class
,
'user_id'
,
'id'
);
}
}
//获取头像
public
function
getHeadericourlAttr
(
$value
,
$data
)
{
return
get_upload_file
(
$data
[
'headico'
]);
}
//获取性别
public
function
getSexdataAttr
(
$value
,
$data
)
{
switch
(
$data
[
'sex'
])
{
case
'1'
:
$txt
=
'男'
;
break
;
case
'2'
:
$txt
=
'女'
;
break
;
default
:
$txt
=
'未知'
;
}
return
$txt
;
}
public
function
getRegTimeAttr
(
$value
,
$data
)
{
return
date
(
'Y-m-d H:i:s'
,
$value
);
}
public
function
getLastLoginTimeAttr
(
$value
,
$data
)
{
return
date
(
'Y-m-d H:i:s'
,
$value
);
}
//用户类型
public
function
getRoletxtAttr
(
$value
,
$data
)
{
switch
(
$data
[
'role'
])
{
case
'3'
:
$txt
=
'高校用户'
;
break
;
case
'2'
:
$txt
=
'企业用户'
;
break
;
default
:
$txt
=
'普通用户'
;
}
return
$txt
;
}
}
}
\ No newline at end of file
app/subscribe/course.php
0 → 100644
View file @
f0a8aa53
<?php
namespace
app\subscribe
;
use
app\job\Jobtask
;
use
think\Event
;
use
think\facade\Log
;
use
think\facade\Queue
;
class
course
{
public
function
onCourse
(
$event
)
{
Queue
::
push
(
Jobtask
::
class
,
$event
);
// 推送到队列的任务类及其数据参数
}
public
function
subscribe
(
Event
$event
)
{
$event
->
listen
(
'Course'
,
[
__CLASS__
,
'onCourse'
]);
}
}
\ No newline at end of file
config/queue.php
View file @
f0a8aa53
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
return
[
return
[
'default'
=>
'
sync
'
,
'default'
=>
'
database
'
,
'connections'
=>
[
'connections'
=>
[
'sync'
=>
[
'sync'
=>
[
'type'
=>
'sync'
,
'type'
=>
'sync'
,
...
...
public/static/admin/module/buildItems/buildItems.js
View file @
f0a8aa53
...
@@ -76,13 +76,13 @@ layui.define(['tagsInput','fileLibrary','cascader'], function(e){
...
@@ -76,13 +76,13 @@ layui.define(['tagsInput','fileLibrary','cascader'], function(e){
c
.
tinymce
=
c
.
item_html
+
c
.
block_html
+
'>'
+
c
.
textarea_html
+
' id="tinymce-{{ d.id ? d.id : d.name }}">{{- d.value }}</textarea>'
+
c
.
tips_html
+
'</div></div>'
;
c
.
tinymce
=
c
.
item_html
+
c
.
block_html
+
'>'
+
c
.
textarea_html
+
' id="tinymce-{{ d.id ? d.id : d.name }}">{{- d.value }}</textarea>'
+
c
.
tips_html
+
'</div></div>'
;
//上传单图
//上传单图
c
.
image
=
c
.
item_html
+
c
.
block_html
+
'><div id="image-show-{{ d.name }}" data-type="image" data-verify="{{ d.verify ||
\'\'
}}" data-reqtext="{{ d.reqtext ||
\'\'
}}">{{# if (d.value) { }}'
+
c
.
image
=
c
.
item_html
+
c
.
block_html
+
'><div id="image-show-{{ d.name }}" data-type="image" data-verify="{{ d.verify ||
\'\'
}}" data-reqtext="{{ d.reqtext ||
\'\'
}}">{{# if (d.value) { }}'
+
'<div class="image_item"><img src="{{ d.value }}"/><input type="hidden" name="{{ d.name }}" value="{{ d.
value
}}"/>'
+
'<div class="image_item"><img src="{{ d.value }}"/><input type="hidden" name="{{ d.name }}" value="{{ d.
pathid
}}"/>'
+
'<i class="layui-icon layui-icon-edit item-edit"></i><i class="layui-icon layui-icon-close item-delete"></i></div>{{# }else{ }}<input type="hidden" name="{{ d.name }}" lay-verify="{{ d.verify ||
\'\'
}}" lay-reqtext="{{ d.reqtext ||
\'\'
}}"/>{{# } }}</div>'
+
'<i class="layui-icon layui-icon-edit item-edit"></i><i class="layui-icon layui-icon-close item-delete"></i></div>{{# }else{ }}<input type="hidden" name="{{ d.name }}" lay-verify="{{ d.verify ||
\'\'
}}" lay-reqtext="{{ d.reqtext ||
\'\'
}}"/>{{# } }}</div>'
+
'<div class="image_item layui-upload-drag" style="background:#efefef;" id="up-image-btn-{{ d.name }}" data-type="image" data-name="{{ d.name }}" data-thum="{{ d.thum || 0 }}"><i class="layui-icon"></i><br/>上传图片</div>'
+
'<div class="image_item layui-upload-drag" style="background:#efefef;" id="up-image-btn-{{ d.name }}" data-type="image" data-name="{{ d.name }}" data-thum="{{ d.thum || 0 }}"><i class="layui-icon"></i><br/>上传图片</div>'
+
'<div style="clear:both"></div>'
+
c
.
tips_html
+
'</div></div>'
;
'<div style="clear:both"></div>'
+
c
.
tips_html
+
'</div></div>'
;
//上传多图
//上传多图
c
.
images
=
c
.
item_html
+
c
.
block_html
+
'><div id="image-show-{{ d.name }}" data-type="images" data-verify="{{ d.verify ||
\'\'
}}" data-reqtext="{{ d.reqtext ||
\'\'
}}">{{# var i = 0;layui.each(d.value, function(key, url){ i=1; }}'
+
c
.
images
=
c
.
item_html
+
c
.
block_html
+
'><div id="image-show-{{ d.name }}" data-type="images" data-verify="{{ d.verify ||
\'\'
}}" data-reqtext="{{ d.reqtext ||
\'\'
}}">{{# var i = 0;layui.each(d.value, function(key, url){ i=1; }}'
+
'<div class="image_item"><img src="{{
url
}}"/><input type="hidden" name="{{ d.name }}[]" value="{{ url }}"/>'
+
'<div class="image_item"><img src="{{
d.patharr[key]
}}"/><input type="hidden" name="{{ d.name }}[]" value="{{ url }}"/>'
+
'<i class="layui-icon layui-icon-edit item-edit"></i><i class="layui-icon layui-icon-close item-delete"></i></div>{{# }); }}{{# if (i == 0) { }}<input type="hidden" name="{{ d.name }}" lay-verify="{{ d.verify ||
\'\'
}}" lay-reqtext="{{ d.reqtext ||
\'\'
}}"/>{{# } }}</div>'
+
'<i class="layui-icon layui-icon-edit item-edit"></i><i class="layui-icon layui-icon-close item-delete"></i></div>{{# }); }}{{# if (i == 0) { }}<input type="hidden" name="{{ d.name }}" lay-verify="{{ d.verify ||
\'\'
}}" lay-reqtext="{{ d.reqtext ||
\'\'
}}"/>{{# } }}</div>'
+
'<div class="image_item layui-upload-drag" style="background:#efefef;" id="up-image-btn-{{ d.name }}" data-type="images" data-name="{{ d.name }}" data-thum="{{ d.thum || 0 }}"><i class="layui-icon"></i><br/>上传图片</div>'
+
'<div class="image_item layui-upload-drag" style="background:#efefef;" id="up-image-btn-{{ d.name }}" data-type="images" data-name="{{ d.name }}" data-thum="{{ d.thum || 0 }}"><i class="layui-icon"></i><br/>上传图片</div>'
+
'<div style="clear:both"></div>'
+
c
.
tips_html
+
'</div></div>'
;
'<div style="clear:both"></div>'
+
c
.
tips_html
+
'</div></div>'
;
...
...
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