mirror of
https://github.com/ngfchl/ptools
synced 2023-07-10 13:41:22 +08:00
更新基础规则,更新杜比、蚂蚁、明教、芒果部分规则
This commit is contained in:
@@ -14,8 +14,6 @@ from pt_site.views import scheduler, pt_spider
|
||||
from ptools.base import CommonResponse, StatusCodeEnum
|
||||
|
||||
|
||||
|
||||
|
||||
def add_task(request):
|
||||
if request.method == 'POST':
|
||||
content = json.loads(request.body.decode()) # 接收参数
|
||||
@@ -175,17 +173,19 @@ def get_update_logs():
|
||||
|
||||
|
||||
def update_page(request):
|
||||
cid = ''
|
||||
restart = 'false'
|
||||
delta = '程序未在容器中启动?'
|
||||
# 获取docker对象
|
||||
client = docker.from_env()
|
||||
# 从内部获取容器id
|
||||
for c in client.api.containers():
|
||||
if 'ngfchl/ptools' in c.get('Image'):
|
||||
cid = c.get('Id')
|
||||
delta = c.get('Status')
|
||||
restart = 'true'
|
||||
try:
|
||||
# 获取docker对象
|
||||
client = docker.from_env()
|
||||
# 从内部获取容器id
|
||||
for c in client.api.containers():
|
||||
if 'ngfchl/ptools' in c.get('Image'):
|
||||
cid = c.get('Id')
|
||||
delta = c.get('Status')
|
||||
restart = 'true'
|
||||
except Exception as e:
|
||||
cid = ''
|
||||
restart = 'false'
|
||||
delta = '程序未在容器中启动?'
|
||||
if get_update_logs():
|
||||
update = 'false'
|
||||
update_tips = '目前您使用的是最新版本!'
|
||||
@@ -277,7 +277,7 @@ def do_restart(request):
|
||||
# client.api.inspect_container(cid)
|
||||
# StartedAt = client.api.inspect_container(cid).get('State').get('StartedAt')
|
||||
return JsonResponse(data=CommonResponse.error(
|
||||
msg='重启指令发送成功,容器重启中 ...'
|
||||
msg='重启指令发送成功,容器重启中 ... 15秒后自动刷新页面 ...'
|
||||
).to_dict(), safe=False)
|
||||
except Exception as e:
|
||||
return JsonResponse(data=CommonResponse.error(
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
<el-link slot="reference"
|
||||
type="success">{{ update_tips }}
|
||||
<span v-if="{{ restart }}"> + 容器已运行:{{ delta }}</span>
|
||||
<span v-text="time"></span>
|
||||
</el-link>
|
||||
</el-popover>
|
||||
</div>
|
||||
@@ -123,6 +124,7 @@
|
||||
update: {{ update }},
|
||||
local_log_width: 24,
|
||||
cid: "{{ cid }}",
|
||||
time: ''
|
||||
},
|
||||
created() {
|
||||
if (this.update) {
|
||||
@@ -136,11 +138,20 @@
|
||||
message: "{{ update_tips }}",
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
,
|
||||
},
|
||||
watch: {
|
||||
time: function (newValue) {
|
||||
if (newValue == 0) {
|
||||
this.$router.push("{% url "update_page" %}")
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
timeDown() {
|
||||
this.time--
|
||||
},
|
||||
do_restart() {
|
||||
this.$confirm('此操作将重启容器,并更新软件, 是否继续?', '提示', {
|
||||
this.$confirm('重启容器, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
@@ -153,6 +164,8 @@
|
||||
type: 'success',
|
||||
message: res.data.msg
|
||||
});
|
||||
this.time = 15
|
||||
setInterval(this.timeDown, 1000)
|
||||
} else {
|
||||
console.log(res)
|
||||
this.$message({
|
||||
@@ -171,7 +184,7 @@
|
||||
},
|
||||
|
||||
do_update() {
|
||||
this.$confirm('此操作会拉取软件更新软件,并重启容器,是否继续?', '提示', {
|
||||
this.$confirm('此操作会拉取代码并更新软件,并重启容器,是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
@@ -191,6 +204,8 @@
|
||||
type: 'success',
|
||||
message: res.data.msg
|
||||
});
|
||||
this.time = 15
|
||||
setInterval(this.timeDown, 1000)
|
||||
} else {
|
||||
console.log(res, 2)
|
||||
this.$message({
|
||||
|
||||
Reference in New Issue
Block a user