Commit 68223263 by Phạm Văn Đoan

cập nhật lưu tên bài hát khi chọn blacklist

parent 4efddab5
......@@ -554,10 +554,11 @@ class CmsTrack extends CI_Controller
public function updateBlacklistByAjax()
{
$track_id = $this->input->post('track_id');
$title = $this->input->post('title');
$src = $this->input->post('src');
$selected = $this->input->post('selected');
//
$result = $this->crawler_listen_blacklist_model->checkAndUpdate($track_id, $src, $selected);
$result = $this->crawler_listen_blacklist_model->checkAndUpdate($track_id, $title, $src, $selected);
//
if ($result) {
echo json_encode([
......
......@@ -47,7 +47,7 @@ class Crawler_listen_blacklist_model extends CI_Model
return $data;
}
public function checkAndUpdate($track_id, $src, $selected)
public function checkAndUpdate($track_id, $title, $src, $selected)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
......@@ -66,7 +66,7 @@ class Crawler_listen_blacklist_model extends CI_Model
$this->db->insert($this->_table, [
'track_id' => $track_id,
'src' => strtolower($src),
'title' => null,
'title' => $title,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
]);
......
......@@ -97,17 +97,17 @@
<div class="profile-info-value">
<label>
<input type="checkbox" value="zing" id="chk_zing"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, 'zing')"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, '<?php echo str_replace(["'", '"'], [","], $track[0]['title']); ?>', 'zing')"
<?php echo (in_array('zing', $blacklist) ? 'checked' : '') ?>>&nbsp;Zing
</label><br>
<label>
<input type="checkbox" value="nct" id="chk_nct"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, 'nct')"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, '<?php echo str_replace(["'", '"'], [","], $track[0]['title']); ?>', 'nct')"
<?php echo (in_array('nct', $blacklist) ? 'checked' : '') ?>>&nbsp;NCT
</label><br>
<label>
<input type="checkbox" value="keeng" id="chk_keeng"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, 'keeng')"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, '<?php echo str_replace(["'", '"'], [","], $track[0]['title']); ?>', 'keeng')"
<?php echo (in_array('keeng', $blacklist) ? 'checked' : '') ?>>&nbsp;Keeng
</label>
</div>
......@@ -129,7 +129,7 @@
<p>Không tìm thấy thông tin Bài hát!</p>
<?php endif; ?>
<script>
function updateBlacklistByAjax(track_id, src) {
function updateBlacklistByAjax(track_id, title, src) {
var selected = 0;
if ($('#chk_' + src).is(":checked")) {
......@@ -138,15 +138,16 @@
selected = 0;
}
callAjax(track_id, src, selected);
callAjax(track_id, title, src, selected);
}
function callAjax(track_id, src, selected) {
function callAjax(track_id, title, 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,
title: title,
src: src,
selected: selected
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment