Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crawler.vmusicchart.vn
Overview
Overview
Details
Activity
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
Phạm Văn Đoan
crawler.vmusicchart.vn
Commits
0777f7ca
Commit
0777f7ca
authored
Apr 07, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ghi log cập nhật thông tin nghệ sĩ
parent
369cba97
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
UpdateTrackArtistCommand.php
app/Console/Commands/Update/UpdateTrackArtistCommand.php
+15
-1
Kernel.php
app/Console/Kernel.php
+7
-2
No files found.
app/Console/Commands/Update/UpdateTrackArtistCommand.php
View file @
0777f7ca
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Console\Commands\Update
;
namespace
App\Console\Commands\Update
;
use
App\Models\Crontjob
;
use
App\Models\Track
;
use
App\Models\Track
;
use
App\Models\TrackArtist
;
use
App\Models\TrackArtist
;
use
App\Models\TrackUser
;
use
App\Models\TrackUser
;
...
@@ -31,7 +32,7 @@ class UpdateTrackArtistCommand extends Command
...
@@ -31,7 +32,7 @@ class UpdateTrackArtistCommand extends Command
/**
/**
* Create a new command instance.
* Create a new command instance.
*
*
*
CalculateDailyListen
Command constructor.
*
UpdateTrackArtist
Command constructor.
* @param TrackRepository $trackRepository
* @param TrackRepository $trackRepository
*/
*/
public
function
__construct
(
TrackRepository
$trackRepository
)
public
function
__construct
(
TrackRepository
$trackRepository
)
...
@@ -60,6 +61,9 @@ class UpdateTrackArtistCommand extends Command
...
@@ -60,6 +61,9 @@ class UpdateTrackArtistCommand extends Command
$src
=
$this
->
choice
(
'Chọn nguồn cập nhật '
,
[
'zing'
,
'nct'
,
'keeng'
,
'all'
]);
$src
=
$this
->
choice
(
'Chọn nguồn cập nhật '
,
[
'zing'
,
'nct'
,
'keeng'
,
'all'
]);
}
}
// Ghi log
Crontjob
::
create
([
'message'
=>
'UpdateTrackArtistCommand is called ('
.
$src
.
')'
]);
echo
"
\n
Bắt đầu cập nhật ca sĩ cho bài hát."
;
echo
"
\n
Bắt đầu cập nhật ca sĩ cho bài hát."
;
switch
(
$src
)
{
switch
(
$src
)
{
...
@@ -184,6 +188,16 @@ class UpdateTrackArtistCommand extends Command
...
@@ -184,6 +188,16 @@ class UpdateTrackArtistCommand extends Command
echo
"
\n
Kết thúc cập nhật ca sĩ cho bài hát.
\n
"
;
echo
"
\n
Kết thúc cập nhật ca sĩ cho bài hát.
\n
"
;
}
}
/**
* Hàm xử lý đồng bộ thông tin nghệ sĩ ở bảng users và track_user, track_artists
*
* @param $src
* @param $track_db
* @param array $track_id_singer
* @param array $track_id_composer
*
* @return bool
*/
private
function
privateUpdateTrackSinger
(
$src
,
$track_db
,
$track_id_singer
=
[],
$track_id_composer
=
[])
private
function
privateUpdateTrackSinger
(
$src
,
$track_db
,
$track_id_singer
=
[],
$track_id_composer
=
[])
{
{
echo
"
\n
Cập nhật cho tổng số bài: "
.
$track_db
->
count
();
echo
"
\n
Cập nhật cho tổng số bài: "
.
$track_db
->
count
();
...
...
app/Console/Kernel.php
View file @
0777f7ca
...
@@ -65,17 +65,22 @@ class Kernel extends ConsoleKernel
...
@@ -65,17 +65,22 @@ class Kernel extends ConsoleKernel
$schedule
->
command
(
'keeng:get-track'
)
->
dailyAt
(
'13:30'
);
$schedule
->
command
(
'keeng:get-track'
)
->
dailyAt
(
'13:30'
);
$schedule
->
command
(
'crawler:get-track-image'
)
->
dailyAt
(
'13:40'
);
$schedule
->
command
(
'crawler:get-track-image'
)
->
dailyAt
(
'13:40'
);
// Cập nhật thông tin ca sĩ, nhạc sĩ sau 21h
$schedule
->
command
(
'track:update-artist zing'
)
->
dailyAt
(
'21:05'
);
$schedule
->
command
(
'track:update-artist keeng'
)
->
dailyAt
(
'21:10'
);
$schedule
->
command
(
'track:update-artist nct'
)
->
dailyAt
(
'21:15'
);
// 22h bắt đầu quét. Quét 3 lần, lần cuối quét hết
// 22h bắt đầu quét. Quét 3 lần, lần cuối quét hết
$schedule
->
command
(
'crawler:get-listen keeng'
)
->
dailyAt
(
'22:00'
);
$schedule
->
command
(
'crawler:get-listen keeng'
)
->
dailyAt
(
'22:00'
);
$schedule
->
command
(
'crawler:get-listen keeng'
)
->
dailyAt
(
'22:05'
);
$schedule
->
command
(
'crawler:get-listen keeng'
)
->
dailyAt
(
'22:05'
);
$schedule
->
command
(
'crawler:get-listen keeng --limit=-1'
)
->
dailyAt
(
'22:10'
);
$schedule
->
command
(
'crawler:get-listen keeng --limit=-1'
)
->
dailyAt
(
'22:10'
);
// 22h
3
0 bắt đầu quét. Quét 3 lần, lần cuối quét hết
// 22h
2
0 bắt đầu quét. Quét 3 lần, lần cuối quét hết
$schedule
->
command
(
'crawler:get-listen nct'
)
->
dailyAt
(
'22:20'
);
$schedule
->
command
(
'crawler:get-listen nct'
)
->
dailyAt
(
'22:20'
);
$schedule
->
command
(
'crawler:get-listen nct'
)
->
dailyAt
(
'22:25'
);
$schedule
->
command
(
'crawler:get-listen nct'
)
->
dailyAt
(
'22:25'
);
$schedule
->
command
(
'crawler:get-listen nct --limit=-1'
)
->
dailyAt
(
'22:30'
);
$schedule
->
command
(
'crawler:get-listen nct --limit=-1'
)
->
dailyAt
(
'22:30'
);
// 2
3h
bắt đầu quét. Quét 3 lần, lần cuối quét hết
// 2
2h40
bắt đầu quét. Quét 3 lần, lần cuối quét hết
$schedule
->
command
(
'crawler:get-listen zing'
)
->
dailyAt
(
'22:40'
);
$schedule
->
command
(
'crawler:get-listen zing'
)
->
dailyAt
(
'22:40'
);
$schedule
->
command
(
'crawler:get-listen zing'
)
->
dailyAt
(
'22:45'
);
$schedule
->
command
(
'crawler:get-listen zing'
)
->
dailyAt
(
'22:45'
);
$schedule
->
command
(
'crawler:get-listen zing --limit=-1'
)
->
dailyAt
(
'22:50'
);
$schedule
->
command
(
'crawler:get-listen zing --limit=-1'
)
->
dailyAt
(
'22:50'
);
...
...
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