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
09dbeac6
Commit
09dbeac6
authored
Sep 03, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cập nhật
parent
39f3f1b9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
3 deletions
+119
-3
CmsRanking.php
application/controllers/backend/CmsRanking.php
+55
-2
Common_model.php
application/models/Common_model.php
+57
-0
ranking_selection_view.php
...views/backend/ajax/cms_ranking/ranking_selection_view.php
+1
-1
overlap_ranking_view.php
...n/views/backend/ajax/cms_setting/overlap_ranking_view.php
+2
-0
js_process_report.php
.../views/backend/cms_ranking/partials/js_process_report.php
+3
-0
report_violation_modal.php
...s/backend/cms_ranking/partials/report_violation_modal.php
+1
-0
No files found.
application/controllers/backend/CmsRanking.php
View file @
09dbeac6
...
...
@@ -18,6 +18,7 @@ class CmsRanking extends CI_Controller
parent
::
__construct
();
date_default_timezone_set
(
"Asia/Ho_Chi_Minh"
);
//
$this
->
load
->
model
(
'common_model'
);
$this
->
load
->
model
(
'track_model'
);
$this
->
load
->
model
(
'user_model'
);
$this
->
load
->
model
(
'report_views_daily_model'
);
...
...
@@ -419,6 +420,7 @@ class CmsRanking extends CI_Controller
$time
=
$this
->
input
->
post
(
'time'
);
$scope
=
$this
->
input
->
post
(
'scope'
);
//
$ranking_id
=
$this
->
input
->
post
(
'ranking_id'
);
$keep_ranking
=
$this
->
input
->
post
(
'keep_ranking'
);
$keep_track_id
=
$this
->
input
->
post
(
'keep_track_id'
);
$keep_track_title
=
$this
->
input
->
post
(
'keep_track_title'
);
...
...
@@ -427,7 +429,7 @@ class CmsRanking extends CI_Controller
$delete_track_id
=
$this
->
input
->
post
(
'delete_track_id'
);
$delete_track_title
=
$this
->
input
->
post
(
'delete_track_title'
);
//
if
(
$delete_track_id
>
0
&&
in_array
(
$scope
,
[
'DAILY'
,
'WEEKLY'
,
'MONTHLY'
]))
{
if
(
$
ranking_id
>
0
&&
$
delete_track_id
>
0
&&
in_array
(
$scope
,
[
'DAILY'
,
'WEEKLY'
,
'MONTHLY'
]))
{
$date
=
null
;
$week
=
null
;
$month
=
null
;
...
...
@@ -455,6 +457,7 @@ class CmsRanking extends CI_Controller
}
$data_insert
=
[
'scope'
=>
$scope
,
'ranking_id'
=>
$ranking_id
,
'date'
=>
$date
,
'week'
=>
$week
,
'month'
=>
$month
,
...
...
@@ -504,7 +507,57 @@ class CmsRanking extends CI_Controller
if
(
in_array
(
$scope
,
[
'DAILY'
,
'WEEKLY'
,
'MONTHLY'
]))
{
$overlap
=
$this
->
report_violation_model
->
getById
(
$id
,
0
);
if
(
isset
(
$overlap
[
0
]))
{
print_r
(
$overlap
);
$limit
=
105
;
$offset
=
0
;
// Xử lý xóa và lấy ds sau khi xóa
switch
(
$scope
)
{
case
'DAILY'
:
$this
->
common_model
->
delete
(
'report_views_daily'
,
$overlap
[
0
][
'ranking_id'
]);
//
$date
=
$overlap
[
0
][
'date'
];
$ranking
=
$this
->
report_views_daily_model
->
cmsGetPagination
(
$limit
,
$offset
,
$date
);
break
;
case
'WEEKLY'
:
$this
->
common_model
->
delete
(
'report_views_weekly_new'
,
$overlap
[
0
][
'ranking_id'
]);
//
$time
=
$overlap
[
0
][
'week'
]
.
'-'
.
$overlap
[
0
][
'year'
];
$ranking
=
$this
->
report_views_weekly_model
->
cmsGetPagination
(
$limit
,
$offset
,
$time
);
break
;
case
'MONTHLY'
:
$this
->
common_model
->
delete
(
'report_views_monthly_new'
,
$overlap
[
0
][
'ranking_id'
]);
//
$time
=
$overlap
[
0
][
'month'
]
.
'-'
.
$overlap
[
0
][
'year'
];
$ranking
=
$this
->
report_views_monthly_model
->
cmsGetPagination
(
$limit
,
$offset
,
$time
);
break
;
default
:
$ranking
=
[];
}
// Xử lý cập nhật lại BXH sau khi xóa
if
(
is_array
(
$ranking
)
&&
count
(
$ranking
)
>
0
)
{
$temp
=
[];
foreach
(
$ranking
as
$key
=>
$item
)
{
if
(
$scope
==
'DAILY'
)
{
$temp
[]
=
[
'id'
=>
$item
[
'id'
],
'ranking'
=>
$key
+
1
];
}
else
{
$temp
[]
=
[
'id'
=>
$item
[
'id'
],
'order'
=>
$key
+
1
];
}
}
switch
(
$scope
)
{
case
'DAILY'
:
$this
->
common_model
->
update_batch
(
'report_views_daily'
,
$temp
,
'id'
);
break
;
case
'WEEKLY'
:
$this
->
common_model
->
update_batch
(
'report_views_weekly_new'
,
$temp
,
'id'
);
break
;
case
'MONTHLY'
:
$this
->
common_model
->
update_batch
(
'report_views_monthly_new'
,
$temp
,
'id'
);
break
;
default
:
}
}
// Cập nhật trạng thái đã xử lý
$this
->
report_violation_model
->
update
();
redirect
(
base_url
(
$this
->
overlap_ranking_list
));
}
else
{
redirect
(
base_url
(
$this
->
overlap_ranking_list
));
}
...
...
application/models/Common_model.php
0 → 100644
View file @
09dbeac6
<?php
if
(
!
defined
(
'BASEPATH'
))
exit
(
'No direct script access allowed'
);
class
Common_model
extends
CI_Model
{
public
function
__construct
()
{
parent
::
__construct
();
date_default_timezone_set
(
"Asia/Ho_Chi_Minh"
);
}
public
function
update
(
$table
,
$id
,
$data_update
)
{
try
{
$this
->
db
->
where
(
'id'
,
$id
);
$this
->
db
->
update
(
$table
,
$data_update
);
return
true
;
}
catch
(
Exception
$e
)
{
return
false
;
}
}
/**
* https://codeigniter.com/userguide3/database/query_builder.html#updating-data
*
* @param $table
* @param $data
* @param string $update_by_field
* @return bool
*/
public
function
update_batch
(
$table
,
$data
,
$update_by_field
=
'id'
)
{
if
(
$table
&&
is_array
(
$data
)
&&
count
(
$data
)
>
0
)
{
try
{
$this
->
db
->
update_batch
(
$table
,
$data
,
$update_by_field
);
return
true
;
}
catch
(
Exception
$e
)
{
return
false
;
}
}
else
{
return
false
;
}
}
public
function
delete
(
$table
,
$id
)
{
if
(
$table
&&
$id
>
0
)
{
$this
->
db
->
where
(
'id'
,
$id
);
$this
->
db
->
delete
(
$table
);
//
return
true
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
application/views/backend/ajax/cms_ranking/ranking_selection_view.php
View file @
09dbeac6
<?php
if
(
is_array
(
$ranking
)
&&
count
(
$ranking
)
>
0
)
:
?>
<option
value=
"-1"
ranking=
"-1"
>
- Chọn -
</option>
<?php
foreach
(
$ranking
as
$item
)
:
$ranking
=
isset
(
$item
[
'ranking'
])
?
$item
[
'ranking'
]
:
$item
[
'order'
];
?>
<option
value=
"
<?php
echo
$item
[
'track_id'
];
?>
"
ranking=
"
<?php
echo
$ranking
?>
"
>
<option
value=
"
<?php
echo
$item
[
'track_id'
];
?>
"
ranking=
"
<?php
echo
$ranking
?>
"
ranking_id=
"
<?php
echo
$item
[
'id'
];
?>
"
>
<?php
echo
$ranking
.
'. '
.
$item
[
'name_song'
]
.
' (ID= '
.
$item
[
'track_id'
]
.
')'
;
?>
</option>
<?php
endforeach
;
?>
...
...
application/views/backend/ajax/cms_setting/overlap_ranking_view.php
View file @
09dbeac6
...
...
@@ -26,6 +26,8 @@
</td>
<td
style=
"text-align: left"
>
<?php
echo
$data
[
'delete_track_title'
];
?>
<br>
<span
style=
"color: #adadad"
>
ID:
<?php
echo
$data
[
'ranking_id'
];
?>
</span>
</td>
<td>
<?php
echo
((
$data
[
'status'
]
==
1
)
?
'Đã xử lý'
:
'Chờ xử lý'
)
?>
...
...
application/views/backend/cms_ranking/partials/js_process_report.php
View file @
09dbeac6
...
...
@@ -6,6 +6,7 @@
$
(
'#keep_track_title'
).
val
(
$
(
'#ranking_true option:selected'
).
text
().
trim
());
});
$
(
"#ranking_false"
).
change
(
function
(){
$
(
'#ranking_id'
).
val
(
$
(
'#ranking_false option:selected'
).
attr
(
'ranking_id'
));
$
(
'#delete_ranking'
).
val
(
$
(
'#ranking_false option:selected'
).
attr
(
'ranking'
));
$
(
'#delete_track_title'
).
val
(
$
(
'#ranking_false option:selected'
).
text
().
trim
());
});
...
...
@@ -41,6 +42,7 @@
// Hàm gửi data báo cáo sai sót
function
sendReportOverlapping
()
{
var
ranking_id
=
$
(
'#ranking_id'
).
val
();
var
keep_ranking
=
$
(
'#keep_ranking'
).
val
();
var
keep_track_id
=
$
(
'#ranking_true'
).
val
();
var
keep_track_title
=
$
(
'#keep_track_title'
).
val
();
...
...
@@ -58,6 +60,7 @@
csrf_name
:
'
<?php
echo
$this
->
security
->
get_csrf_hash
();
?>
'
,
time
:
(
$
(
"#input-date-picker"
).
val
())
?
$
(
"#input-date-picker"
).
val
()
:
null
,
scope
:
'
<?php
echo
(
isset
(
$tags
)
?
$tags
:
'DAILY'
)
?>
'
,
ranking_id
:
ranking_id
,
keep_ranking
:
keep_ranking
,
keep_track_id
:
keep_track_id
,
keep_track_title
:
(
keep_track_title
)
?
keep_track_title
.
trim
()
:
keep_track_title
,
...
...
application/views/backend/cms_ranking/partials/report_violation_modal.php
View file @
09dbeac6
...
...
@@ -10,6 +10,7 @@
<div
class=
"col-md-12"
>
<div
class=
"form-group"
>
<label>
BXH:
<span
id=
"ranking_at"
style=
"color: red"
></span></label>
<input
type=
"hidden"
id=
"ranking_id"
value=
""
>
<input
type=
"hidden"
id=
"keep_ranking"
value=
"-1"
>
<input
type=
"hidden"
id=
"delete_ranking"
value=
"-1"
>
<input
type=
"hidden"
id=
"keep_track_title"
value=
""
>
...
...
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