mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-03 11:09:27 +00:00
优化关闭工单操作 & 维护模式判断条件
This commit is contained in:
@@ -53,8 +53,8 @@ class AutoJob extends Command
|
||||
$this->checkNodeStatus();
|
||||
|
||||
// 检查维护模式
|
||||
if (sysConfig('maintenance_mode')) {
|
||||
Config::whereIn('name', ['maintenance_mode', 'maintenance_time'])->update(['value' => null]);
|
||||
if (sysConfig('maintenance_mode') && sysConfig('maintenance_time') && sysConfig('maintenance_time') <= date('c')) {
|
||||
Config::whereIn('name', ['maintenance_mode', 'maintenance_content', 'maintenance_time'])->update(['value' => null]);
|
||||
}
|
||||
|
||||
$jobEndTime = microtime(true);
|
||||
|
||||
@@ -104,10 +104,8 @@ class DailyJob extends Command
|
||||
// 关闭超过72小时未处理的工单
|
||||
private function closeTickets(): void
|
||||
{
|
||||
$ticketList = Ticket::where('updated_at', '<=', date('Y-m-d', strtotime('-3 days')))->whereStatus(1)->get();
|
||||
foreach ($ticketList as $ticket) {
|
||||
$ret = Ticket::whereId($ticket->id)->update(['status' => 2]);
|
||||
if ($ret) {
|
||||
foreach (Ticket::where('updated_at', '<=', date('Y-m-d', strtotime('-3 days')))->whereStatus(1)->get() as $ticket) {
|
||||
if ($ticket->close()) {
|
||||
PushNotification::send('工单关闭提醒', '工单:ID'.$ticket->id.'超过72小时未处理,系统已自动关闭');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,9 +125,9 @@ class TicketController extends Controller
|
||||
// 关闭工单
|
||||
public function destroy($id)
|
||||
{
|
||||
$ticket = Ticket::findOrFail($id)->with('user');
|
||||
$ticket = Ticket::with('user')->find($id);
|
||||
|
||||
if (! Ticket::whereId($id)->update(['status' => 2])) {
|
||||
if (! $ticket->close()) {
|
||||
return Response::json(['status' => 'fail', 'message' => '关闭失败']);
|
||||
}
|
||||
|
||||
|
||||
@@ -384,8 +384,7 @@ class UserController extends Controller
|
||||
{
|
||||
$id = $request->input('id');
|
||||
|
||||
$ret = Ticket::uid()->whereId($id)->update(['status' => 2]);
|
||||
if ($ret) {
|
||||
if (Ticket::uid()->whereId($id)->close()) {
|
||||
PushNotification::send('工单关闭提醒', '工单:ID'.$id.'用户已手动关闭');
|
||||
|
||||
return Response::json(['status' => 'success', 'message' => '关闭成功']);
|
||||
|
||||
@@ -28,6 +28,13 @@ class Ticket extends Model
|
||||
return $this->BelongsTo(User::class);
|
||||
}
|
||||
|
||||
public function close(): bool
|
||||
{
|
||||
$this->status = 2;
|
||||
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
public function getStatusLabelAttribute(): string
|
||||
{
|
||||
switch ($this->attributes['status']) {
|
||||
|
||||
461
composer.lock
generated
461
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -2,5 +2,5 @@
|
||||
|
||||
return [
|
||||
'name' => 'ProxyPanel',
|
||||
'number' => '2.5.1',
|
||||
'number' => '2.5.x',
|
||||
];
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
Support but not limited to: Shadowsocks,ShadowsocksR,ShadowsocksRR,V2Ray,Trojan,VNET
|
||||
|
||||
- [Demo](https://demo.proxypanel.ml/)
|
||||
- [Demo](https://demo.proxypanel.ml/) Demo will always on dev/latest code, rather than the stable version.
|
||||
- Account: test@test.com
|
||||
- Password: 123456
|
||||
- [Wiki](https://proxypanel.gitbook.io/wiki/)
|
||||
- [Issues](https://github.com/ZBrettonYe/ProxyPanel/issues)
|
||||
- [UpdateLog](https://proxypanel.gitbook.io/wiki/updatelog)
|
||||
- [Upcoming](https://github.com/ZBrettonYe/ProxyPanel/projects/2)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<!-- Scripts -->
|
||||
<script src="/assets/global/vendor/breakpoints/breakpoints.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
Breakpoints();
|
||||
Breakpoints();
|
||||
</script>
|
||||
@yield('css')
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user