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
0ab190d7
Commit
0ab190d7
authored
Oct 18, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cập nhật tính năng bỏ bài khỏi BXH sau 6 tháng
parent
060f73de
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
8 deletions
+107
-8
CmsTrack.php
application/controllers/backend/CmsTrack.php
+5
-3
Crawler_listen_blacklist_model.php
application/models/Crawler_listen_blacklist_model.php
+1
-0
Crawler_listen_model.php
application/models/Crawler_listen_model.php
+29
-0
Track_model.php
application/models/Track_model.php
+8
-2
list_track_view.php
application/views/backend/ajax/cms_track/list_track_view.php
+13
-0
list_track_view.php
application/views/backend/cms_track/list_track_view.php
+51
-3
No files found.
application/controllers/backend/CmsTrack.php
View file @
0ab190d7
...
...
@@ -45,6 +45,7 @@ class CmsTrack extends CI_Controller
$fBySinger
=
$this
->
input
->
post
(
'fBySinger'
);
$fByComposer
=
$this
->
input
->
post
(
'fByComposer'
);
$fByBlacklist
=
$this
->
input
->
post
(
'fByBlacklist'
);
$fByRemoveRanking
=
$this
->
input
->
post
(
'fByRemoveRanking'
);
$pageId
=
$this
->
input
->
post
(
'pageId'
);
//
$pageId
=
(
$pageId
==
0
)
?
1
:
$pageId
;
...
...
@@ -52,9 +53,9 @@ class CmsTrack extends CI_Controller
$limit
=
100
;
$offset
=
(
$pageId
-
1
)
*
$limit
;
$data
[
'offset'
]
=
(
$pageId
-
1
)
*
$limit
;
$totalRecord
=
$this
->
track_model
->
cmsCountAll
(
$fByName
,
$fBySinger
,
$fByComposer
,
$fBySource
,
$fByBlacklist
);
$totalRecord
=
$this
->
track_model
->
cmsCountAll
(
$fByName
,
$fBySinger
,
$fByComposer
,
$fBySource
,
$fByBlacklist
,
$fByRemoveRanking
);
$data
[
'pagination'
]
=
MyHelper
::
genPaginationLink
(
$totalRecord
,
$limit
,
$pageId
);
$data
[
'listData'
]
=
$this
->
track_model
->
cmsGetPagination
(
$limit
,
$offset
,
$fByName
,
$fBySinger
,
$fByComposer
,
$fBySource
,
$fByBlacklist
);
$data
[
'listData'
]
=
$this
->
track_model
->
cmsGetPagination
(
$limit
,
$offset
,
$fByName
,
$fBySinger
,
$fByComposer
,
$fBySource
,
$fByBlacklist
,
$fByRemoveRanking
);
//
$this
->
load
->
view
(
'backend/ajax/cms_track/list_track_view'
,
$data
);
}
...
...
@@ -576,7 +577,8 @@ class CmsTrack extends CI_Controller
$reset
=
$this
->
crawler_listen_model
->
resetCrawlerListenBySrc
(
$track_id
,
$src
);
// Reset data ở bảng crawler_listen_histories
if
(
$reset
)
{
// Không reset với trường hợp quá 6 tháng
if
(
$reset
&&
$src
!=
'all_6months'
)
{
$this
->
crawler_listen_history_model
->
resetCrawlerListenHistoryBySrc
(
$track_id
,
$src
);
}
}
...
...
application/models/Crawler_listen_blacklist_model.php
View file @
0ab190d7
...
...
@@ -67,6 +67,7 @@ class Crawler_listen_blacklist_model extends CI_Model
'track_id'
=>
$track_id
,
'src'
=>
strtolower
(
$src
),
'title'
=>
$title
,
'created_by'
=>
$this
->
session
->
userdata
(
'id'
),
'created_at'
=>
date
(
'Y-m-d H:i:s'
),
'updated_at'
=>
date
(
'Y-m-d H:i:s'
)
]);
...
...
application/models/Crawler_listen_model.php
View file @
0ab190d7
...
...
@@ -13,6 +13,7 @@ class Crawler_listen_model extends CI_Model
/**
* Hàm thực hiện reset lượt nghe ở nguồn tương ứng
* khi user tích chọn không lấy lượt nghe ở nguồn src nào đó
* Cập nhật thêm case: sau 6 tháng sẽ loại bỏ bài hát khỏi BXH (18/10/2020)
*
* @param $track_id
* @param $src
...
...
@@ -65,6 +66,34 @@ class Crawler_listen_model extends CI_Model
'keeng_crawler_at'
=>
null
];
break
;
case
'all_6months'
:
$data_reset
=
[
'yesterday_zing'
=>
0
,
'today_zing'
=>
0
,
'date_zing'
=>
0
,
'week_zing'
=>
0
,
'month_zing'
=>
0
,
'year_zing'
=>
0
,
'alltime_zing'
=>
0
,
'zing_crawler_at'
=>
null
,
'yesterday_nct'
=>
0
,
'today_nct'
=>
0
,
'date_nct'
=>
0
,
'week_nct'
=>
0
,
'month_nct'
=>
0
,
'year_nct'
=>
0
,
'alltime_nct'
=>
0
,
'nct_crawler_at'
=>
null
,
'yesterday_keeng'
=>
0
,
'today_keeng'
=>
0
,
'date_keeng'
=>
0
,
'week_keeng'
=>
0
,
'month_keeng'
=>
0
,
'year_keeng'
=>
0
,
'alltime_keeng'
=>
0
,
'keeng_crawler_at'
=>
null
];
break
;
default
:
$data_reset
=
[];
}
...
...
application/models/Track_model.php
View file @
0ab190d7
...
...
@@ -227,7 +227,7 @@ class Track_model extends CI_Model
return
$query
->
result_array
();
}
public
function
cmsCountAll
(
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
,
$fBySource
=
null
,
$fByBlacklist
=
null
)
public
function
cmsCountAll
(
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
,
$fBySource
=
null
,
$fByBlacklist
=
null
,
$fByRemoveRanking
=
null
)
{
$this
->
db
->
select
(
'COUNT(*) AS totalResults'
);
$this
->
db
->
from
(
$this
->
_table
);
...
...
@@ -268,6 +268,9 @@ class Track_model extends CI_Model
if
(
$fByBlacklist
==
1
)
{
$this
->
db
->
where
(
'blacklist_listen is NOT NULL'
,
null
,
false
);
}
if
(
$fByRemoveRanking
==
1
)
{
$this
->
db
->
where
(
'is_remove_from_ranking'
,
$fByRemoveRanking
);
}
$query
=
$this
->
db
->
get
();
$result
=
$query
->
result_array
();
if
(
$result
)
{
...
...
@@ -277,7 +280,7 @@ class Track_model extends CI_Model
}
}
public
function
cmsGetPagination
(
$record
,
$start
,
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
,
$fBySource
=
null
,
$fByBlacklist
=
null
)
public
function
cmsGetPagination
(
$record
,
$start
,
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
,
$fBySource
=
null
,
$fByBlacklist
=
null
,
$fByRemoveRanking
=
null
)
{
$this
->
db
->
select
(
$this
->
_table
.
'.*'
);
$this
->
db
->
from
(
$this
->
_table
);
...
...
@@ -318,6 +321,9 @@ class Track_model extends CI_Model
if
(
$fByBlacklist
==
1
)
{
$this
->
db
->
where
(
'blacklist_listen is NOT NULL'
,
null
,
false
);
}
if
(
$fByRemoveRanking
==
1
)
{
$this
->
db
->
where
(
'is_remove_from_ranking'
,
$fByRemoveRanking
);
}
$this
->
db
->
order_by
(
$this
->
_table
.
'.id'
,
'desc'
);
$this
->
db
->
limit
(
$record
,
$start
);
$query
=
$this
->
db
->
get
();
...
...
application/views/backend/ajax/cms_track/list_track_view.php
View file @
0ab190d7
...
...
@@ -8,6 +8,7 @@
<th
style=
"text-align: center"
>
Tên bài hát
</th>
<th
style=
"text-align: center"
>
Nghệ sĩ
</th>
<th
style=
"text-align: center"
>
Trang không lấy
<br>
lượt nghe
</th>
<th
style=
"text-align: center; width: 100px"
>
BXH
<br>
quá 6 tháng
</th>
<th
style=
"text-align: center"
>
Xử lý
</th>
</tr>
</thead>
...
...
@@ -31,6 +32,18 @@
</td>
<td
style=
"text-align: left"
>
<?php
echo
strtoupper
(
$data
[
'blacklist_listen'
]);
?>
</td>
<td
style=
"text-align: center"
>
<?php
if
(
$data
[
'is_remove_from_ranking'
])
:
?>
<input
type=
"checkbox"
disabled
checked=
"checked"
>
<?php
else
:
?>
<?php
if
(
$this
->
session
->
userdata
(
'group_id'
)
==
2
)
:
?>
<input
type=
"checkbox"
id=
"chk_
<?php
echo
$data
[
'id'
];
?>
"
onclick=
"updateBlacklistMore6MonthsByAjax(
<?php
echo
$data
[
'id'
]
?>
, '
<?php
echo
$data
[
'title'
]
?>
', 'all_6months')"
>
<?php
else
:
?>
<span></span>
<?php
endif
;
?>
<?php
endif
;
?>
</td>
<td
style=
"text-align: center"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/showTrack/'
.
$data
[
'id'
]);
?>
"
title=
"Xem chi tiết"
>
<i
class=
"ace-icon fa fa-eye bigger-130"
></i>
</a>
...
...
application/views/backend/cms_track/list_track_view.php
View file @
0ab190d7
...
...
@@ -2,7 +2,7 @@
<?php
MyHelper
::
loadView
(
'backend/cms_partials/error_message_view'
)
?>
<div
class=
"row"
>
<!-- Tìm kiếm theo tên bài hát -->
<div
class=
"col-lg-
3
"
>
<div
class=
"col-lg-
2
"
>
<input
class=
"form-control"
type=
"text"
name=
"input-name"
id=
"input-name"
placeholder=
"Nhập #ID, tên bài hát..."
/>
</div>
<!-- Lọc theo nguồn cung cấp nhạc -->
...
...
@@ -36,10 +36,16 @@
<option
value=
"1"
>
Đã chặn
</option>
</select>
</div>
<div
class=
"col-lg-2"
>
<select
class=
"form-control"
name=
"fByRemoveRanking"
id=
"fByRemoveRanking"
>
<option
value=
"-1"
>
- Bỏ khỏi BXH -
</option>
<option
value=
"1"
>
Đã bỏ BXH
</option>
</select>
</div>
<!-- Xóa bộ lọc -->
<div
class=
"col-lg-1"
>
<
!--<
div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div>
</div>
-->
<!-- Thêm mới bài hát -->
<!--<div class="col-lg-1" style="float:right;">
<a class="btn btn-sm btn-success" href="
<?php
/*echo base_url('backend/cmsTrack/addTrack');*/
?>
">
...
...
@@ -74,6 +80,7 @@ $(document).ready(function() {
loadDataByAjaxFromSelectBox
(
'fBySinger'
,
url
);
loadDataByAjaxFromSelectBox
(
'fByComposer'
,
url
);
loadDataByAjaxFromSelectBox
(
'fByBlacklist'
,
url
);
loadDataByAjaxFromSelectBox
(
'fByRemoveRanking'
,
url
);
// Xóa bộ lọc
$
(
'#delete-filter'
).
click
(
function
()
{
...
...
@@ -81,6 +88,7 @@ $(document).ready(function() {
$
(
"#fBySinger"
).
val
(
'-1'
);
$
(
"#fByComposer"
).
val
(
'-1'
);
$
(
"#fByBlacklist"
).
val
(
'-1'
);
$
(
"#fByRemoveRanking"
).
val
(
'-1'
);
changePagination
(
'0'
);
return
false
;
...
...
@@ -122,6 +130,7 @@ function callAjax(pageId, url) {
var
fBySinger
=
$
(
"#fBySinger"
).
val
();
var
fByComposer
=
$
(
"#fByComposer"
).
val
();
var
fByBlacklist
=
$
(
"#fByBlacklist"
).
val
();
var
fByRemoveRanking
=
$
(
"#fByRemoveRanking"
).
val
();
var
dataReq
=
{
csrf_name
:
csrf_value
,
fByName
:
fByName
,
...
...
@@ -129,6 +138,7 @@ function callAjax(pageId, url) {
fBySinger
:
fBySinger
,
fByComposer
:
fByComposer
,
fByBlacklist
:
fByBlacklist
,
fByRemoveRanking
:
fByRemoveRanking
,
pageId
:
pageId
};
//Ajax
...
...
@@ -144,4 +154,41 @@ function callAjax(pageId, url) {
}
});
}
function
updateBlacklistMore6MonthsByAjax
(
track_id
,
title
,
src
)
{
$
(
'#data-loading'
).
show
();
var
selected
=
0
;
if
(
$
(
'#chk_'
+
track_id
).
is
(
":checked"
))
{
selected
=
1
;
}
else
{
selected
=
0
;
}
var
csrf_value
=
'
<?php
echo
$this
->
security
->
get_csrf_hash
();
?>
'
;
var
url
=
'
<?php
echo
base_url
(
"backend/cmsTrack/updateBlacklistByAjax"
);
?>
'
;
var
dataReq
=
{
csrf_name
:
csrf_value
,
track_id
:
track_id
,
title
:
title
,
src
:
src
,
selected
:
selected
};
//Ajax
$
.
ajax
({
type
:
"POST"
,
url
:
url
,
data
:
dataReq
,
dataType
:
"JSON"
,
cache
:
false
,
success
:
function
(
data
)
{
$
(
'#data-loading'
).
hide
();
location
.
reload
();
},
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
$
(
'#data-loading'
).
hide
();
}
});
}
</script>
\ No newline at end of file
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