Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vmusicchart-cms
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
vmusicchart-cms
Commits
9bed8390
Commit
9bed8390
authored
Apr 12, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test lấy số liệu lịch sử lượt nghe từ views listen_history_view
parent
ce500d2d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
CmsRanking.php
application/controllers/backend/CmsRanking.php
+19
-0
Crawler_listen_history_model.php
application/models/Crawler_listen_history_model.php
+18
-0
No files found.
application/controllers/backend/CmsRanking.php
View file @
9bed8390
...
@@ -312,6 +312,25 @@ class CmsRanking extends CI_Controller
...
@@ -312,6 +312,25 @@ class CmsRanking extends CI_Controller
}
}
}
}
/*$histories_view = $this->crawler_listen_history_model->getByTrackIdFromView($track_id);
$date_list = $histories_view[0]['date_log_list'];
$zing_list = $histories_view[0]['zing_count_list'];
$nct_list = $histories_view[0]['nct_count_list'];
$keeng_list = $histories_view[0]['keeng_count_list'];
//
$array_date = explode(',', $date_list);
$array_zing = explode(',', $zing_list);
$array_nct = explode(',', $nct_list);
$array_keeng = explode(',', $keeng_list);
//
$data = [];
foreach ($array_date as $key => $val) {
$data[$key]['date'] = $val;
$data[$key]['zing'] = intval($array_zing[$key]);
$data[$key]['nct'] = intval($array_nct[$key]);
$data[$key]['keeng'] = intval($array_keeng[$key]);
}*/
$response
[
'response'
]
=
$data
;
$response
[
'response'
]
=
$data
;
$response
[
'track_title'
]
=
$track_title
;
$response
[
'track_title'
]
=
$track_title
;
...
...
application/models/Crawler_listen_history_model.php
View file @
9bed8390
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
class
Crawler_listen_history_model
extends
CI_Model
class
Crawler_listen_history_model
extends
CI_Model
{
{
protected
$_table
=
'crawler_listen_histories'
;
protected
$_table
=
'crawler_listen_histories'
;
protected
$_table_view
=
'listen_history_view'
;
public
function
__construct
()
public
function
__construct
()
{
{
...
@@ -23,6 +24,23 @@ class Crawler_listen_history_model extends CI_Model
...
@@ -23,6 +24,23 @@ class Crawler_listen_history_model extends CI_Model
$this
->
db
->
where
(
$this
->
_table
.
'.track_id'
,
$track_id
);
$this
->
db
->
where
(
$this
->
_table
.
'.track_id'
,
$track_id
);
$this
->
db
->
order_by
(
$this
->
_table
.
'.date_log'
,
'asc'
);
$this
->
db
->
order_by
(
$this
->
_table
.
'.date_log'
,
'asc'
);
$query
=
$this
->
db
->
get
();
$query
=
$this
->
db
->
get
();
return
$query
->
result_array
();
}
/**
* Lấy lịch sử lượt nghe của bài hát theo ID từ views
*
* @param $track_id
* @return mixed
*/
public
function
getByTrackIdFromView
(
$track_id
)
{
$this
->
db
->
select
(
$this
->
_table_view
.
'.*'
);
$this
->
db
->
from
(
$this
->
_table_view
);
$this
->
db
->
where
(
$this
->
_table_view
.
'.track_id'
,
$track_id
);
$query
=
$this
->
db
->
get
();
return
$query
->
result_array
();
return
$query
->
result_array
();
}
}
...
...
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