Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hexbee
Cloudreve
提交
060f7a20
C
Cloudreve
项目概览
hexbee
/
Cloudreve
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cloudreve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
060f7a20
编写于
10月 20, 2018
作者:
H
HFO4
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Manage page for task queue
上级
a67185c7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
161 addition
and
0 deletion
+161
-0
application/index/controller/Admin.php
application/index/controller/Admin.php
+13
-0
application/index/controller/Queue.php
application/index/controller/Queue.php
+3
-0
application/index/model/AdminHandler.php
application/index/model/AdminHandler.php
+11
-0
application/index/view/admin/task.html
application/index/view/admin/task.html
+99
-0
application/index/view/header_admin.html
application/index/view/header_admin.html
+3
-0
static/js/admin/task.js
static/js/admin/task.js
+32
-0
未找到文件。
application/index/controller/Admin.php
浏览文件 @
060f7a20
...
...
@@ -252,6 +252,10 @@ class Admin extends Controller{
return
$this
->
adminObj
->
saveAria2Setting
(
input
(
'post.'
));
}
public
function
SaveTaskOption
(){
return
$this
->
adminObj
->
saveTaskOption
(
input
(
'post.'
));
}
public
function
SendTestMail
(){
return
$this
->
adminObj
->
sendTestMail
(
input
(
'post.'
));
}
...
...
@@ -474,6 +478,15 @@ class Admin extends Controller{
]);
}
public
function
Queue
(){
$taskOption
=
Option
::
getValue
(
"task_queue_token"
);
return
view
(
'task'
,
[
'options'
=>
$this
->
siteOptions
,
'taskOption'
=>
$taskOption
,
'task'
=>
$this
->
adminObj
->
getTasks
(),
]);
}
public
function
PurchaseGroup
(){
$groupData
=
json_decode
(
Option
::
getValue
(
"group_sell_data"
),
true
);
foreach
(
$groupData
as
$key
=>
$value
)
{
...
...
application/index/controller/Queue.php
浏览文件 @
060f7a20
...
...
@@ -12,6 +12,9 @@ class Queue extends Controller{
public
function
__construct
(
\
think\Request
$request
=
null
){
$token
=
Option
::
getValue
(
"task_queue_token"
);
if
(
$token
==
""
){
abort
(
403
);
}
if
(
Request
::
instance
()
->
header
(
"Authorization"
)
!=
"Bearer "
.
$token
){
abort
(
403
);
}
...
...
application/index/model/AdminHandler.php
浏览文件 @
060f7a20
...
...
@@ -109,6 +109,10 @@ class AdminHandler extends Model{
return
$this
->
saveOptions
(
$options
);
}
public
function
saveTaskOption
(
$options
){
return
$this
->
saveOptions
(
$options
);
}
public
function
saveMailTemplate
(
$options
){
return
$this
->
saveOptions
(
$options
);
}
...
...
@@ -394,6 +398,13 @@ class AdminHandler extends Model{
$this
->
pageNow
=
input
(
"?get.page"
)
?
input
(
"get.page"
)
:
1
;
}
public
function
getTasks
(){
$taskData
=
Db
::
name
(
"task"
)
->
order
(
"id DESC"
)
->
paginate
(
10
);
return
$taskData
;
}
public
function
listFile
(){
$pageSize
=
!
cookie
(
'?pageSize'
)
?
10
:
cookie
(
'pageSize'
);
$orderType
=
empty
(
cookie
(
'orderMethodFile'
))
?
"id DESC"
:
cookie
(
'orderMethodFile'
);
...
...
application/index/view/admin/task.html
0 → 100644
浏览文件 @
060f7a20
{extend name="header_admin" /}
{block name="title"}任务队列 - {$options.siteName}{/block}
{block name="content"}
<div
class=
"content-wrapper"
>
<div
class=
"container-fluid"
>
<!-- Breadcrumbs-->
<ol
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
>
<a
href=
"/Admin"
>
管理面板
</a>
</li>
<li
class=
"breadcrumb-item active"
>
任务队列
</li>
<li
class=
"breadcrumb-item active"
>
配置
</li>
</ol>
<!-- Area Chart Example-->
<div
class=
"row"
>
<div
class=
"col-12"
>
<h2>
任务队列
</h2>
<br>
<div
class=
"card"
>
<div
class=
"card-header"
>
<ul
class=
"nav nav-tabs card-header-tabs"
>
<li
class=
"nav-item"
>
<a
class=
"nav-link active"
data-toggle=
"tab"
href=
"#options"
><i
class=
"fa fa-cog"
aria-hidden=
"true"
></i>
配置
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
data-toggle=
"tab"
href=
"#list"
><i
class=
"fa fa-list"
aria-hidden=
"true"
></i>
任务列表
</a>
</li>
</ul>
</div>
<div
class=
"card-body"
>
<div
class=
"tab-content"
>
<div
class=
"tab-pane fade show active"
id=
"options"
role=
"tabpanel"
aria-labelledby=
"pills-home-tab"
>
<form
id=
"taskOptions"
>
<div
class=
"row form-setting"
>
<div
class=
"col-md-1 form-label "
>
<label
for=
"fromName"
class=
"col-form-label col-form-label-sm"
>
Token
</label>
</div>
<div
class=
"col-md-4"
>
<input
type=
"text"
class=
"form-control"
name=
"task_queue_token"
id=
"task_queue_token"
value=
"{$taskOption}"
spellcheck=
"false"
>
</div>
<div
class=
"col-md-4 option-des"
>
任务队列鉴权Token,应该与任务队列配置文件conf.yaml中的token保持一致,留空表示禁止任务队列请求
</div>
</div>
<div
class=
"row form-setting"
>
<div
class=
"col-md-1 form-label "
>
</div>
<div
class=
"col-md-4"
>
<button
type=
"button"
class=
"btn btn-outline-secondary"
id=
"generateToken"
>
随机生成Token
</button>
<button
type=
"button"
class=
"btn btn-primary"
id=
"saveTask"
>
保存设置
</button></div>
<div
class=
"col-md-4 option-des"
>
</div>
<br><br><br>
</div>
</form>
</div>
<div
class=
"tab-pane fade"
id=
"list"
role=
"tabpanel"
aria-labelledby=
"pills-profile-tab"
>
<table
class=
"table"
>
<thead>
<tr>
<th
scope=
"col"
class=
"textCenter"
>
#
</th>
<th
scope=
"col"
width=
"50%"
>
任务名
</th>
<th
scope=
"col"
class=
"textCenter"
>
状态
</th>
<th
scope=
"col"
class=
"textCenter"
>
创建日期
</th>
<th
scope=
"col"
class=
"textCenter"
>
创建者UID
</th>
</tr>
</thead>
<tbody
id=
"listContent"
>
{volist name='task' id='t'}
<tr
id=
"i-{$t.id}"
>
<th
scope=
"row"
class=
"textCenter"
>
{$t.id}
</th>
<td>
{$t.task_name}
</td>
<td
class=
"textCenter"
>
{$t.status}
</td>
<td
class=
"textCenter"
>
{$t.addtime}
</td>
<td
class=
"textCenter"
>
{$t.uid}
</td>
</tr>
{/volist}
</tbody>
</table>
{$task->render()}
</div>
<div
class=
"tab-pane fade"
id=
"tools"
role=
"tabpanel"
aria-labelledby=
"pills-profile-tab"
>
ddd
</div>
</div>
</div>
</div><br>
</div>
</div>
<!-- Example DataTables Card-->
</div>
<!-- /.container-fluid-->
</div>
{/block}
{block name="js"}
<script
src=
"/static/js/admin/summernote.min.js"
></script>
<script
src=
"/static/js/admin/summernote-zh-CN.min.js"
></script>
<script
src=
"/static/js/admin/task.js"
></script>
{/block}
\ No newline at end of file
application/index/view/header_admin.html
浏览文件 @
060f7a20
...
...
@@ -122,6 +122,9 @@
<span
class=
"nav-link-text"
>
其他
</span>
</a>
<ul
class=
"sidenav-second-level collapse"
id=
"else"
>
<li>
<a
href=
"/Admin/Queue"
>
任务队列
</a>
</li>
<li>
<a
href=
"/Admin/Cron"
>
定时任务
</a>
</li>
...
...
static/js/admin/task.js
0 → 100644
浏览文件 @
060f7a20
$
(
"
#saveTask
"
).
click
(
function
()
{
$
(
"
#saveTask
"
).
attr
(
"
disabled
"
,
"
true
"
);
$
.
post
(
"
/Admin/SaveTaskOption
"
,
$
(
"
#taskOptions
"
).
serialize
()
,
function
(
data
)
{
if
(
data
.
error
==
"
1
"
)
{
toastr
[
"
warning
"
](
data
.
msg
);
$
(
"
#saveTask
"
).
removeAttr
(
"
disabled
"
);
}
else
if
(
data
.
error
==
"
200
"
)
{
toastr
[
"
success
"
](
"
设置已保存
"
);
$
(
"
#saveTask
"
).
removeAttr
(
"
disabled
"
);
}
else
{
toastr
[
"
warning
"
](
"
未知错误
"
);
$
(
"
#saveTask
"
).
removeAttr
(
"
disabled
"
);
}
});
})
$
(
"
#generateToken
"
).
click
(
function
(){
len
=
64
;
var
$chars
=
'
ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678
'
;
var
maxPos
=
$chars
.
length
;
var
pwd
=
''
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
pwd
+=
$chars
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
maxPos
));
}
$
(
"
#task_queue_token
"
).
val
(
pwd
);
})
$
(
document
).
ready
(
function
(){
if
(
document
.
location
.
href
.
indexOf
(
"
page
"
)
!=-
1
){
$
(
"
[href='#list']
"
).
click
();
}
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录