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
5d595a6b
Commit
5d595a6b
authored
Oct 23, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thêm chức năng quản lý các bài hát đã lấy lượt nghe quá 6 tháng
parent
0ab190d7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
428 additions
and
0 deletions
+428
-0
config.php
application/config/config.php
+1
-0
CmsTrack.php
application/controllers/backend/CmsTrack.php
+32
-0
Track_model.php
application/models/Track_model.php
+124
-0
admin_template_view.php
application/views/backend/admin_template_view.php
+6
-0
list_track_6month_view.php
...n/views/backend/ajax/cms_track/list_track_6month_view.php
+70
-0
list_track_6month_view.php
...cation/views/backend/cms_track/list_track_6month_view.php
+195
-0
No files found.
application/config/config.php
View file @
5d595a6b
...
...
@@ -405,6 +405,7 @@ $config['csrf_exclude_uris'] = array(
'backend/cmsRanking/getRankingByAjax'
,
'backend/cmsTrack/listTrackAjax'
,
'backend/cmsTrack/listTrack6MonthAjax'
,
'backend/cmsTrack/addTrack'
,
'backend/cmsTrack/updateBlacklistByAjax'
,
...
...
application/controllers/backend/CmsTrack.php
View file @
5d595a6b
...
...
@@ -60,6 +60,38 @@ class CmsTrack extends CI_Controller
$this
->
load
->
view
(
'backend/ajax/cms_track/list_track_view'
,
$data
);
}
public
function
listTrack6Month
()
{
$this
->
_data
[
'functionName'
]
=
'Track'
;
$this
->
_data
[
'action'
]
=
'listTrack'
;
$this
->
_data
[
'titlePage'
]
=
'Track'
;
$this
->
_data
[
'loadPage'
]
=
'backend/cms_track/list_track_6month_view'
;
$this
->
load
->
view
(
'backend/admin_template_view'
,
$this
->
_data
);
}
public
function
listTrack6MonthAjax
()
{
$data
=
array
();
$fByName
=
$this
->
input
->
post
(
'fByName'
);
$fBySource
=
$this
->
input
->
post
(
'fBySource'
);
$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
;
//
$limit
=
100
;
$offset
=
(
$pageId
-
1
)
*
$limit
;
$data
[
'offset'
]
=
(
$pageId
-
1
)
*
$limit
;
$totalRecord
=
$this
->
track_model
->
cmsCountAll6Month
(
$fByName
,
$fBySinger
,
$fByComposer
,
$fBySource
,
$fByBlacklist
,
$fByRemoveRanking
);
$data
[
'pagination'
]
=
MyHelper
::
genPaginationLink
(
$totalRecord
,
$limit
,
$pageId
);
$data
[
'listData'
]
=
$this
->
track_model
->
cmsGetPagination6Month
(
$limit
,
$offset
,
$fByName
,
$fBySinger
,
$fByComposer
,
$fBySource
,
$fByBlacklist
,
$fByRemoveRanking
);
//
$this
->
load
->
view
(
'backend/ajax/cms_track/list_track_6month_view'
,
$data
);
}
/**
* Hàm xử lý cập nhật bài hát
*
...
...
application/models/Track_model.php
View file @
5d595a6b
...
...
@@ -331,6 +331,130 @@ class Track_model extends CI_Model
return
$query
->
result_array
();
}
/**
* Danh sách bài hát quá 6 tháng ở BXH, cần phải loại bỏ -----------------------------------------------------------
*
* @param null $name
* @param null $fBySinger
* @param null $fByComposer
* @param null $fBySource
* @param null $fByBlacklist
* @param null $fByRemoveRanking
*
* @return int
*/
public
function
cmsCountAll6Month
(
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
,
$fBySource
=
null
,
$fByBlacklist
=
null
,
$fByRemoveRanking
=
null
)
{
$six_month_ago
=
date
(
'Y-m-d H:i:s'
,
time
()
-
5
*
30
*
86400
);
//
$this
->
db
->
select
(
'COUNT(*) AS totalResults'
);
$this
->
db
->
from
(
$this
->
_table
);
$this
->
db
->
join
(
'crawler_listens'
,
'crawler_listens.track_id = tracks.id'
);
$this
->
db
->
where
(
'crawler_listens.created_at <='
,
$six_month_ago
);
if
(
$name
!=
null
)
{
$this
->
db
->
like
(
'title'
,
$name
,
'both'
);
$this
->
db
->
or_like
(
'description'
,
$name
,
'both'
);
$this
->
db
->
or_like
(
'slug'
,
$name
,
'both'
);
$this
->
db
->
or_like
(
'slug'
,
MyHelper
::
genSlug
(
$name
),
'both'
);
$this
->
db
->
or_like
(
'tag'
,
$name
,
'both'
);
$this
->
db
->
or_where
(
'id'
,
intval
(
$name
));
}
if
(
!
empty
(
$fBySource
))
{
switch
(
$fBySource
)
{
case
'ZING'
:
$this
->
db
->
where
(
'tracks.id_zing is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'tracks.id_zing !='
,
''
);
break
;
case
'NCT'
:
$this
->
db
->
where
(
'tracks.id_nct is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'tracks.id_nct !='
,
''
);
break
;
case
'KEENG'
:
$this
->
db
->
where
(
'tracks.id_keeng is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'tracks.id_keeng !='
,
''
);
break
;
}
}
if
(
$fBySinger
==
1
)
{
$this
->
db
->
where
(
'tracks.singer_list is NOT NULL'
,
null
,
false
);
}
else
if
(
$fBySinger
==
2
)
{
$this
->
db
->
where
(
'tracks.singer_list'
,
null
);
}
if
(
$fByComposer
==
1
)
{
$this
->
db
->
where
(
'tracks.composer_list is NOT NULL'
,
null
,
false
);
}
else
if
(
$fByComposer
==
2
)
{
$this
->
db
->
where
(
'tracks.composer_list'
,
null
);
}
if
(
$fByBlacklist
==
1
)
{
$this
->
db
->
where
(
'tracks.blacklist_listen is NOT NULL'
,
null
,
false
);
}
if
(
$fByRemoveRanking
==
1
)
{
$this
->
db
->
where
(
'tracks.is_remove_from_ranking'
,
$fByRemoveRanking
);
}
$query
=
$this
->
db
->
get
();
$result
=
$query
->
result_array
();
if
(
$result
)
{
return
$result
[
0
][
'totalResults'
];
}
else
{
return
0
;
}
}
public
function
cmsGetPagination6Month
(
$record
,
$start
,
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
,
$fBySource
=
null
,
$fByBlacklist
=
null
,
$fByRemoveRanking
=
null
)
{
$six_month_ago
=
date
(
'Y-m-d H:i:s'
,
time
()
-
5
*
30
*
86400
);
//
$this
->
db
->
select
(
$this
->
_table
.
'.*, crawler_listens.created_at AS track_created_at'
);
$this
->
db
->
from
(
$this
->
_table
);
$this
->
db
->
join
(
'crawler_listens'
,
'crawler_listens.track_id = tracks.id'
);
$this
->
db
->
where
(
'crawler_listens.created_at <='
,
$six_month_ago
);
if
(
$name
!=
null
)
{
$this
->
db
->
like
(
'tracks.title'
,
$name
,
'both'
);
$this
->
db
->
or_like
(
'tracks.description'
,
$name
,
'both'
);
$this
->
db
->
or_like
(
'tracks.slug'
,
$name
,
'both'
);
$this
->
db
->
or_like
(
'tracks.slug'
,
MyHelper
::
genSlug
(
$name
),
'both'
);
$this
->
db
->
or_like
(
'tracks.tag'
,
$name
,
'both'
);
$this
->
db
->
or_where
(
'id'
,
intval
(
$name
));
}
if
(
!
empty
(
$fBySource
))
{
switch
(
$fBySource
)
{
case
'ZING'
:
$this
->
db
->
where
(
'tracks.id_zing is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'tracks.id_zing !='
,
''
);
break
;
case
'NCT'
:
$this
->
db
->
where
(
'tracks.id_nct is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'tracks.id_nct !='
,
''
);
break
;
case
'KEENG'
:
$this
->
db
->
where
(
'tracks.id_keeng is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'tracks.id_keeng !='
,
''
);
break
;
}
}
if
(
$fBySinger
==
1
)
{
$this
->
db
->
where
(
'tracks.singer_list is NOT NULL'
,
null
,
false
);
}
else
if
(
$fBySinger
==
2
)
{
$this
->
db
->
where
(
'tracks.singer_list'
,
null
);
}
if
(
$fByComposer
==
1
)
{
$this
->
db
->
where
(
'tracks.composer_list is NOT NULL'
,
null
,
false
);
}
else
if
(
$fByComposer
==
2
)
{
$this
->
db
->
where
(
'tracks.composer_list'
,
null
);
}
if
(
$fByBlacklist
==
1
)
{
$this
->
db
->
where
(
'tracks.blacklist_listen is NOT NULL'
,
null
,
false
);
}
if
(
$fByRemoveRanking
==
1
)
{
$this
->
db
->
where
(
'tracks.is_remove_from_ranking'
,
$fByRemoveRanking
);
}
$this
->
db
->
order_by
(
'crawler_listens.created_at'
,
'asc'
);
$this
->
db
->
limit
(
$record
,
$start
);
$query
=
$this
->
db
->
get
();
//
return
$query
->
result_array
();
}
public
function
getListForSelectBox
()
{
$this
->
db
->
select
(
'id, fullname, username, sid'
);
...
...
application/views/backend/admin_template_view.php
View file @
5d595a6b
...
...
@@ -190,6 +190,12 @@ $action = $CI->router->fetch_method();
</a>
<b
class=
"arrow"
></b>
</li>
<li
class=
"
<?php
if
(
$action
&&
(
in_array
(
$action
,
array
(
'listTrack6Month'
))))
echo
'active'
?>
"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/listTrack6Month'
);
?>
"
>
<i
class=
"menu-icon fa fa-caret-right"
></i>
BXH quá 6 tháng
</a>
<b
class=
"arrow"
></b>
</li>
</ul>
</li>
...
...
application/views/backend/ajax/cms_track/list_track_6month_view.php
0 → 100644
View file @
5d595a6b
<div
style=
"/*max-height: 465px; overflow: scroll*/"
>
<table
class=
"table table-striped table-bordered table-hover"
>
<thead>
<tr>
<th
style=
"text-align: center"
>
TT
</th>
<th
style=
"text-align: center"
>
Ảnh
</th>
<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; width: 215px"
>
Ngày bắt đầu quét
</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>
<tbody>
<?php
if
(
count
(
$listData
)
>
0
)
:
foreach
(
$listData
as
$key
=>
$data
)
:
?>
<?php
$ago
=
time
()
-
strtotime
(
$data
[
'track_created_at'
])
?>
<tr>
<td
style=
"text-align: center"
>
<?php
echo
(
$key
+
1
+
$offset
);
?>
</td>
<td
style=
"text-align: center"
>
<img
style=
"max-width: 50px"
src=
"
<?php
echo
MyHelper
::
getArtByTrack
(
$data
[
'art'
],
false
,
$data
[
'art_type'
])
?>
"
>
</td>
<td
style=
"text-align: left"
>
<?php
echo
$data
[
'title'
];
?>
<br>
<?php
echo
MyHelper
::
getSourceIcon
(
$data
[
'id_zing'
],
$data
[
'id_nct'
],
$data
[
'id_keeng'
])
?>
<br>
<?php
echo
'ID: '
.
$data
[
'id'
];
?>
</td>
<td
style=
"text-align: left"
>
Ca sĩ:
<span
style=
"font-weight: bold"
>
<?php
echo
$data
[
'singer_list'
];
?>
</span>
<br>
Sáng tác:
<span
style=
"font-weight: bold"
>
<?php
echo
$data
[
'composer_list'
];
?>
</span>
</td>
<td
style=
"text-align: center"
>
<?php
echo
MyHelper
::
reFormatDate
(
$data
[
'track_created_at'
],
'd/m/Y'
);
?>
<br>
<?php
echo
'Cách đây: '
.
gmdate
(
'm'
,
$ago
)
.
' tháng, '
.
gmdate
(
'd'
,
$ago
)
.
' ngày'
?>
</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>
</td>
</tr>
<?php
endforeach
;
?>
<?php
else
:
?>
<tr>
<td
colspan=
"10"
style=
"color: red; font-style: italic"
>
Không có dữ liệu nào!
</td>
</tr>
<?php
endif
;
?>
</tbody>
</table>
</div>
<!-- /.row -->
<div
style=
"text-align: center;"
>
<?php
echo
$pagination
;
?>
</div>
\ No newline at end of file
application/views/backend/cms_track/list_track_6month_view.php
0 → 100644
View file @
5d595a6b
<!-- Thông báo lỗi -->
<?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-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 -->
<div
class=
"col-lg-2"
>
<select
class=
"form-control"
name=
"fBySource"
id=
"fBySource"
>
<option
value=
""
>
- Tất cả nguồn -
</option>
<option
value=
"ZING"
>
Nguồn Zing
</option>
<option
value=
"NCT"
>
Nguồn NCT
</option>
<option
value=
"KEENG"
>
Nguồn Keeng
</option>
</select>
</div>
<!-- Lọc theo thông tin ca sĩ -->
<div
class=
"col-lg-2"
>
<select
class=
"form-control"
name=
"fBySinger"
id=
"fBySinger"
>
<option
value=
"-1"
>
- Thông tin ca sĩ -
</option>
<option
value=
"1"
>
Đã cập nhật
</option>
<option
value=
"2"
>
Chưa cập nhật
</option>
</select>
</div>
<!-- Lọc theo thông tin nhạc sĩ -->
<div
class=
"col-lg-2"
>
<select
class=
"form-control"
name=
"fByComposer"
id=
"fByComposer"
>
<option
value=
"-1"
>
- Thông tin nhạc sĩ -
</option>
<option
value=
"1"
>
Đã cập nhật
</option>
<option
value=
"2"
>
Chưa cập nhật
</option>
</select>
</div>
<div
class=
"col-lg-2"
>
<select
class=
"form-control"
name=
"fByBlacklist"
id=
"fByBlacklist"
>
<option
value=
"-1"
>
- Chặn lượt nghe -
</option>
<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">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</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');*/
?>
">
<i class="glyphicon-plus"></i> Thêm</a>
</div>-->
</div>
<!-- /.row -->
<div
class=
"space-6"
></div>
<div
class=
"row"
>
<div
style=
"text-align: center"
id=
"data-loading"
>
<i
class=
"fa fa-refresh fa-spin bigger-200"
></i>
Đang tải dữ liệu...
</div>
<div
class=
"col-lg-12"
>
<div
id=
"div-response"
></div>
</div>
</div>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
var
url
=
'
<?php
echo
base_url
(
"backend/cmsTrack/listTrack6MonthAjax"
);
?>
'
;
// Tìm kiếm theo cú pháp
var
oldTimeout2
=
''
;
$
(
'#input-name'
).
keyup
(
function
()
{
clearTimeout
(
oldTimeout2
);
oldTimeout2
=
setTimeout
(
function
()
{
loadDataByAjaxFromInput
(
url
);
},
250
);
});
loadDataByAjaxFromSelectBox
(
'fBySource'
,
url
);
loadDataByAjaxFromSelectBox
(
'fBySinger'
,
url
);
loadDataByAjaxFromSelectBox
(
'fByComposer'
,
url
);
loadDataByAjaxFromSelectBox
(
'fByBlacklist'
,
url
);
loadDataByAjaxFromSelectBox
(
'fByRemoveRanking'
,
url
);
// Xóa bộ lọc
$
(
'#delete-filter'
).
click
(
function
()
{
$
(
"#input-name"
).
val
(
''
);
$
(
"#fBySinger"
).
val
(
'-1'
);
$
(
"#fByComposer"
).
val
(
'-1'
);
$
(
"#fByBlacklist"
).
val
(
'-1'
);
$
(
"#fByRemoveRanking"
).
val
(
'-1'
);
changePagination
(
'0'
);
return
false
;
});
changePagination
(
'0'
);
});
//Ham chung cho cac input
function
loadDataByAjaxFromInput
(
url
)
{
$
(
'#data-loading'
).
show
();
callAjax
(
0
,
url
);
}
//Ham chung cho cac SelectBox
function
loadDataByAjaxFromSelectBox
(
id
,
url
)
{
$
(
'#'
+
id
).
change
(
function
()
{
$
(
'#data-loading'
).
show
();
callAjax
(
0
,
url
);
});
}
function
loadDataByAjaxDateRange
(
dtFrom
,
dtTo
,
url
)
{
$
(
'#data-loading'
).
show
();
callAjax
(
pageId
,
url
);
}
function
changePagination
(
pageId
)
{
$
(
'#data-loading'
).
show
();
var
url
=
'
<?php
echo
base_url
(
"backend/cmsTrack/listTrack6MonthAjax"
);
?>
'
;
callAjax
(
pageId
,
url
);
}
function
callAjax
(
pageId
,
url
)
{
var
csrf_value
=
'
<?php
echo
$this
->
security
->
get_csrf_hash
();
?>
'
;
var
fByName
=
$
(
"#input-name"
).
val
();
var
fBySource
=
$
(
"#fBySource"
).
val
();
var
fBySinger
=
$
(
"#fBySinger"
).
val
();
var
fByComposer
=
$
(
"#fByComposer"
).
val
();
var
fByBlacklist
=
$
(
"#fByBlacklist"
).
val
();
var
fByRemoveRanking
=
$
(
"#fByRemoveRanking"
).
val
();
var
dataReq
=
{
csrf_name
:
csrf_value
,
fByName
:
fByName
,
fBySource
:
fBySource
,
fBySinger
:
fBySinger
,
fByComposer
:
fByComposer
,
fByBlacklist
:
fByBlacklist
,
fByRemoveRanking
:
fByRemoveRanking
,
pageId
:
pageId
};
//Ajax
$
.
ajax
({
type
:
"POST"
,
url
:
url
,
data
:
dataReq
,
dataType
:
"text"
,
cache
:
false
,
success
:
function
(
data
)
{
$
(
'#div-response'
).
html
(
data
);
$
(
'#data-loading'
).
hide
();
}
});
}
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