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
c59c76ea
Commit
c59c76ea
authored
Jul 01, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cập nhật thêm ko lấy lượt nghe
parent
017ecde8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
179 additions
and
9 deletions
+179
-9
config.php
application/config/config.php
+3
-1
CmsTrack.php
application/controllers/backend/CmsTrack.php
+26
-0
Crawler_listen_blacklist_model.php
application/models/Crawler_listen_blacklist_model.php
+83
-0
list_track_view.php
application/views/backend/ajax/cms_track/list_track_view.php
+8
-4
show_track_view.php
application/views/backend/cms_track/show_track_view.php
+59
-4
No files found.
application/config/config.php
View file @
c59c76ea
...
...
@@ -403,8 +403,10 @@ $config['csrf_exclude_uris'] = array(
'backend/cmsRanking/getTrackHistoryAjax'
,
'backend/cmsTrack/listTrackAjax'
,
'backend/cmsArtist/listArtistAjax'
,
'backend/cmsTrack/addTrack'
,
'backend/cmsTrack/updateBlacklistByAjax'
,
'backend/cmsArtist/listArtistAjax'
,
'backend/cmsArtist/addArtistAjax'
,
'backend/cmsSetting/listGroupAjax'
,
...
...
application/controllers/backend/CmsTrack.php
View file @
c59c76ea
...
...
@@ -17,6 +17,7 @@ class CmsTrack extends CI_Controller
$this
->
load
->
model
(
'track_model'
);
$this
->
load
->
model
(
'user_model'
);
$this
->
load
->
model
(
'actionlog_model'
);
$this
->
load
->
model
(
'crawler_listen_blacklist_model'
);
}
/**
...
...
@@ -444,6 +445,7 @@ class CmsTrack extends CI_Controller
//
$this
->
_data
[
'track'
]
=
$this
->
track_model
->
getById
(
$track_id
);
$this
->
_data
[
'blacklist'
]
=
$this
->
crawler_listen_blacklist_model
->
getSrcByTrackId
(
$track_id
,
null
);
$this
->
_data
[
'singers'
]
=
$this
->
track_model
->
getSingerLítByTrackId
(
$track_id
);
//
$this
->
_data
[
'functionName'
]
=
'Thông tin Bài Hát'
;
...
...
@@ -548,4 +550,27 @@ class CmsTrack extends CI_Controller
return
false
;
}
public
function
updateBlacklistByAjax
()
{
$track_id
=
$this
->
input
->
post
(
'track_id'
);
$src
=
$this
->
input
->
post
(
'src'
);
$selected
=
$this
->
input
->
post
(
'selected'
);
//
$result
=
$this
->
crawler_listen_blacklist_model
->
checkAndUpdate
(
$track_id
,
$src
,
$selected
);
//
if
(
$result
)
{
echo
json_encode
([
'code'
=>
200
,
'message'
=>
'Cập nhật thành công'
,
'data'
=>
null
]);
}
else
{
echo
json_encode
([
'code'
=>
400
,
'message'
=>
'Cập nhật không thành công'
,
'data'
=>
null
]);
}
}
}
\ No newline at end of file
application/models/Crawler_listen_blacklist_model.php
0 → 100644
View file @
c59c76ea
<?php
if
(
!
defined
(
'BASEPATH'
))
exit
(
'No direct script access allowed'
);
class
Crawler_listen_blacklist_model
extends
CI_Model
{
protected
$_table
=
'crawler_listen_blacklists'
;
public
function
__construct
()
{
parent
::
__construct
();
date_default_timezone_set
(
"Asia/Ho_Chi_Minh"
);
}
public
function
add
(
$dataInsert
){
$this
->
db
->
insert
(
$this
->
_table
,
$dataInsert
);
$insert_id
=
$this
->
db
->
insert_id
();
return
$insert_id
;
}
public
function
update
(
$id
,
$dataUpdate
){
$this
->
db
->
where
(
'id'
,
$id
);
$this
->
db
->
update
(
$this
->
_table
,
$dataUpdate
);
return
true
;
}
public
function
delete
(
$id
){
$this
->
db
->
where
(
'id'
,
$id
);
$this
->
db
->
delete
(
$this
->
_table
);
return
true
;
}
public
function
getSrcByTrackId
(
$track_id
,
$src
=
null
)
{
$this
->
db
->
select
(
$this
->
_table
.
'.src'
);
$this
->
db
->
from
(
$this
->
_table
);
$this
->
db
->
where
(
$this
->
_table
.
'.track_id'
,
$track_id
);
if
(
!
empty
(
$src
))
{
$this
->
db
->
where
(
$this
->
_table
.
'.src'
,
$src
);
}
$query
=
$this
->
db
->
get
();
$result
=
$query
->
result_array
();
$data
=
[];
if
(
$result
)
{
foreach
(
$result
as
$key
=>
$val
)
{
$data
[]
=
$val
[
'src'
];
}
}
return
$data
;
}
public
function
checkAndUpdate
(
$track_id
,
$src
,
$selected
)
{
$this
->
db
->
select
(
$this
->
_table
.
'.*'
);
$this
->
db
->
from
(
$this
->
_table
);
$this
->
db
->
where
(
$this
->
_table
.
'.track_id'
,
$track_id
);
$this
->
db
->
where
(
$this
->
_table
.
'.src'
,
$src
);
$query
=
$this
->
db
->
get
();
$result
=
$query
->
result_array
();
//
if
(
isset
(
$result
[
0
]))
{
if
(
$selected
==
0
)
{
$this
->
db
->
where
(
'id'
,
$result
[
0
][
'id'
]);
$this
->
db
->
delete
(
$this
->
_table
);
}
return
true
;
}
else
{
$this
->
db
->
insert
(
$this
->
_table
,
[
'track_id'
=>
$track_id
,
'src'
=>
strtolower
(
$src
),
'title'
=>
null
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
),
'updated_at'
=>
date
(
'Y-m-d H:i:s'
)
]);
return
true
;
}
//
return
false
;
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
application/views/backend/ajax/cms_track/list_track_view.php
View file @
c59c76ea
...
...
@@ -6,8 +6,8 @@
<th
style=
"text-align: center"
>
Ảnh
</th>
<th
style=
"text-align: center"
>
#ID
</th>
<th
style=
"text-align: center"
>
Tên bài hát
</th>
<th
style=
"text-align: center"
>
Ca
sĩ
</th>
<th
style=
"text-align: center"
>
Sáng tác
</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"
>
Xử lý
</th>
</tr>
</thead>
...
...
@@ -24,8 +24,12 @@
<br>
<?php
echo
MyHelper
::
getSourceIcon
(
$data
[
'id_zing'
],
$data
[
'id_nct'
],
$data
[
'id_keeng'
])
?>
</td>
<td
style=
"text-align: left"
>
<?php
echo
$data
[
'singer_list'
];
?>
</td>
<td
style=
"text-align: left"
>
<?php
echo
$data
[
'composer_list'
];
?>
</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: left"
>
<?php
echo
strtoupper
(
$data
[
'blacklist_listen'
]);
?>
</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>
...
...
application/views/backend/cms_track/show_track_view.php
View file @
c59c76ea
...
...
@@ -92,13 +92,33 @@
<?php
endif
?>
</div>
</div>
<div
class=
"profile-info-row"
>
<div
class=
"profile-info-name color-red"
style=
"color: red"
>
Không lấy lượt nghe ở trang nào thì tích chọn
</div>
<div
class=
"profile-info-value"
>
<label>
<input
type=
"checkbox"
value=
"zing"
id=
"chk_zing"
onclick=
"updateBlacklistByAjax(
<?php
echo
$track
[
0
][
'id'
]
?>
, 'zing')"
<?php
echo
(
in_array
(
'zing'
,
$blacklist
)
?
'checked'
:
''
)
?>
>
Zing
</label><br>
<label>
<input
type=
"checkbox"
value=
"nct"
id=
"chk_nct"
onclick=
"updateBlacklistByAjax(
<?php
echo
$track
[
0
][
'id'
]
?>
, 'nct')"
<?php
echo
(
in_array
(
'nct'
,
$blacklist
)
?
'checked'
:
''
)
?>
>
NCT
</label><br>
<label>
<input
type=
"checkbox"
value=
"keeng"
id=
"chk_keeng"
onclick=
"updateBlacklistByAjax(
<?php
echo
$track
[
0
][
'id'
]
?>
, 'keeng')"
<?php
echo
(
in_array
(
'keeng'
,
$blacklist
)
?
'checked'
:
''
)
?>
>
Keeng
</label>
</div>
</div>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-lg-3"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/listTrack'
);
?>
"
onclick=
"return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/listTrack'
);
?>
"
>
<button
type=
"button"
class=
"btn btn-sm btn-default"
>
<i
class=
"ace-icon fa fa-arrow-left"
></i>
Quay lại
</button>
...
...
@@ -107,4 +127,40 @@
</div>
<?php
else
:
?>
<p>
Không tìm thấy thông tin Bài hát!
</p>
<?php
endif
;
?>
\ No newline at end of file
<?php
endif
;
?>
<script>
function
updateBlacklistByAjax
(
track_id
,
src
)
{
var
selected
=
0
;
if
(
$
(
'#chk_'
+
src
).
is
(
":checked"
))
{
selected
=
1
;
}
else
{
selected
=
0
;
}
callAjax
(
track_id
,
src
,
selected
);
}
function
callAjax
(
track_id
,
src
,
selected
)
{
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
,
src
:
src
,
selected
:
selected
};
//Ajax
$
.
ajax
({
type
:
"POST"
,
url
:
url
,
data
:
dataReq
,
dataType
:
"JSON"
,
cache
:
false
,
success
:
function
(
data
)
{
console
.
log
(
data
);
//$('#data-loading').hide();
}
});
}
</script>
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