Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Письменов Дмитрий Иванович
/
yourroomads
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9049cf37
authored
Jan 17, 2022
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#22056 Отключение включение синхронизации в админ панель
1 parent
0edc209e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
4 deletions
app/Console/Kernel.php
app/Http/Controllers/TokensController.php
composer.json
composer.lock
resources/js/Pages/Tokens/Index.vue
routes/web.php
app/Console/Kernel.php
View file @
9049cf3
...
...
@@ -53,6 +53,7 @@ use App\Console\Commands\VCardsLoad;
use
Illuminate\Console\Scheduling\Schedule
;
use
Illuminate\Foundation\Console\Kernel
as
ConsoleKernel
;
use
Illuminate\Support\Facades\Artisan
;
use
Illuminate\Support\Facades\Redis
;
class
Kernel
extends
ConsoleKernel
{
...
...
@@ -78,6 +79,10 @@ class Kernel extends ConsoleKernel
$schedule
->
command
(
RefreshLimits
::
class
)
->
hourly
();
if
(
Redis
::
get
(
'cron_sync_disable'
))
{
return
;
}
$schedule
->
command
(
DictionariesLoad
::
class
)
->
saturdays
()
->
at
(
'05:00'
);
$schedule
->
command
(
CampaignsCheckChange
::
class
)
->
hourlyAt
(
5
);
$schedule
->
command
(
CampaignsLoadUpdated
::
class
)
->
hourlyAt
(
10
);
...
...
app/Http/Controllers/TokensController.php
View file @
9049cf3
...
...
@@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Redirect;
use
Illuminate\Support\Facades\Request
;
use
Inertia\Inertia
;
use
Illuminate\Support\Facades\Artisan
;
use
Illuminate\Support\Facades\Redis
;
class
TokensController
extends
Controller
{
...
...
@@ -23,6 +24,7 @@ class TokensController extends Controller
{
return
Inertia
::
render
(
'Tokens/Index'
,
[
'filters'
=>
Request
::
all
(
'api'
,
'type'
,
'login'
),
'cron_sync'
=>
!
Redis
::
get
(
'cron_sync_disable'
),
'types'
=>
[
Tokens
::
MAIN
=>
'Основной аккаунт'
,
Tokens
::
GOAL
=>
'Целевой аккаунт'
],
'tokens'
=>
Tokens
::
withCount
(
'errors'
)
->
filter
(
Request
::
only
(
'api'
,
'type'
,
'login'
))
->
paginate
()
...
...
@@ -81,6 +83,13 @@ class TokensController extends Controller
]);
}
public
function
cronSyncUpdate
()
{
Redis
::
set
(
'cron_sync_disable'
,
!!
request
(
'cron_sync_disable'
));
return
Redirect
::
back
()
->
with
(
'success'
,
'Cron sync updated.'
);
}
public
function
update
(
Tokens
$token
)
{
$token
->
update
(
...
...
composer.json
View file @
9049cf3
...
...
@@ -18,6 +18,7 @@
"fzaninotto/faker"
:
"^1.9.1"
,
"guzzlehttp/guzzle"
:
"^7.0.1"
,
"inertiajs/inertia-laravel"
:
"^0.3"
,
"itsgoingd/clockwork"
:
"^5.0"
,
"laravel/framework"
:
"^8.0"
,
"laravel/legacy-factories"
:
"^1.0"
,
"laravel/tinker"
:
"^2.0"
,
...
...
@@ -26,9 +27,9 @@
"mockery/mockery"
:
"^1.3.1"
,
"nunomaduro/collision"
:
"^5.0"
,
"phpunit/phpunit"
:
"^9.3"
,
"predis/predis"
:
"^1.1"
,
"reinink/remember-query-strings"
:
"^0.1.0"
,
"tightenco/ziggy"
:
"^0.8.0"
,
"itsgoingd/clockwork"
:
"^5.0"
"tightenco/ziggy"
:
"^0.8.0"
},
"require-dev"
:
{
"barryvdh/laravel-ide-helper"
:
"^2.10"
...
...
composer.lock
View file @
9049cf3
...
...
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "
00fe65321384040b3a686ba34d323406
",
"content-hash": "
a9fea84ce946679c9d5e7048f38cabcc
",
"packages": [
{
"name": "asm89/stack-cors",
...
...
@@ -3528,6 +3528,72 @@
"time": "2021-03-23T07:16:29+00:00"
},
{
"name": "predis/predis",
"version": "v1.1.10",
"source": {
"type": "git",
"url": "https://github.com/predis/predis.git",
"reference": "a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/predis/predis/zipball/a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e",
"reference": "a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"suggest": {
"ext-curl": "Allows access to Webdis when paired with phpiredis",
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
},
"type": "library",
"autoload": {
"psr-4": {
"Predis\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniele Alessandri",
"email": "suppakilla@gmail.com",
"homepage": "http://clorophilla.net",
"role": "Creator & Maintainer"
},
{
"name": "Till Krüss",
"homepage": "https://till.im",
"role": "Maintainer"
}
],
"description": "Flexible and feature-complete Redis client for PHP and HHVM",
"homepage": "http://github.com/predis/predis",
"keywords": [
"nosql",
"predis",
"redis"
],
"support": {
"issues": "https://github.com/predis/predis/issues",
"source": "https://github.com/predis/predis/tree/v1.1.10"
},
"funding": [
{
"url": "https://github.com/sponsors/tillkruss",
"type": "github"
}
],
"time": "2022-01-05T17:46:08+00:00"
},
{
"name": "psr/container",
"version": "1.1.1",
"source": {
...
...
@@ -9078,5 +9144,5 @@
"ext-json": "*"
},
"platform-dev": [],
"plugin-api-version": "2.
0
.0"
"plugin-api-version": "2.
1
.0"
}
resources/js/Pages/Tokens/Index.vue
View file @
9049cf3
...
...
@@ -11,6 +11,17 @@
</select>
</search-filter>
<div
class=
"flex flex-wrap"
>
<input
:checked=
"cron_sync"
@
change=
"cronSyncToggle(!cron_sync)"
type=
"checkbox"
class=
"mt-1"
id=
"cron-sync"
>
<label
class=
"ml-1"
for=
"cron-sync"
>
Синхронизация
</label>
</div>
<inertia-link
class=
"btn-indigo"
:href=
"route('token.get',
{'api': 'yd'})">
<span>
Добавить
</span>
<span
class=
"hidden md:inline"
>
токен
</span>
...
...
@@ -84,6 +95,7 @@ export default {
},
layout
:
Layout
,
props
:
{
cron_sync
:
Boolean
,
tokens
:
Object
,
filters
:
Object
,
types
:
Object
,
...
...
@@ -109,6 +121,11 @@ export default {
reset
()
{
this
.
form
=
mapValues
(
this
.
form
,
()
=>
null
)
},
cronSyncToggle
(
cron_sync
)
{
this
.
$inertia
.
post
(
this
.
route
(
'cron_sync_update'
),
{
cron_sync_disable
:
!
cron_sync
?
1
:
0
,
})
},
},
}
</
script
>
routes/web.php
View file @
9049cf3
...
...
@@ -161,6 +161,9 @@ Route::group(['middleware' => 'auth'], function () {
Route
::
get
(
'tokens'
,
[
TokensController
::
class
,
'index'
])
->
name
(
'tokens'
);
Route
::
post
(
'tokens'
,
[
TokensController
::
class
,
'cronSyncUpdate'
])
->
name
(
'cron_sync_update'
);
Route
::
get
(
'token/edit/{token}'
,
[
TokensController
::
class
,
'edit'
])
->
name
(
'token.edit'
);
Route
::
get
(
'token/errors/{token}'
,
[
TokensController
::
class
,
'errors'
])
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment