알림 플러그인 이용중입니다.
본문
https://sir.kr/g5_plugin/5467?sfl=wr_subject%7C%7Cwr_content&stx=%EC%95%8C%EB%A6%BC
위 링크 쪽지알림 플러그인 이용중입니다.사용은 잘되는데.. 한번확인했던 알림. 그러니까 쪽지 를 한번만 보냈는데.
받는 사람이 동일한쪽지를 여러개 받은것처럼 알림이 됩니다.
실제로 쪽지함 가봐도 동일한쪽지가 초단위 분단위로 여러장 계속쌓이구요..
확인을하였거나.
한번만 알람을 표시할순없을까요?ㅠㅠ
<?php
if (!defined('_GNUBOARD_')) exit; //개별 페이지 접근 불가
// 간격
//echo help('기본 60000ms, 밀리초(ms)는 천분의 1초. ex) 60초 = 60000ms');
$wset['delay'] = '60000';
$wset['delay'] = (isset($wset['delay']) && $wset['delay'] >= 60000) ? $wset['delay'] : 60000;
$alarm_url = G5_PLUGIN_URL."/alarm";
?>
<?php
//특정 페이지에서 alarm 표시안함
$except_alarm_page = array('memo.php',
'point.php',
'response.php',
'follow.php',
'scrap.php',
'mypost.php',
'myphoto.php',
'shopping.php',
'coupon.php',
'memo.php',
'board.php',
'memo_view.php',
'memo_form.php');
if (!in_array(basename($_SERVER['PHP_SELF']), $except_alarm_page))
{
if ($member['mb_id'])
{
?>
<link rel="stylesheet" href="<?php echo $alarm_url ?>/alarm.css">
<script>
var memo_alarm_url = "<?php echo $alarm_url;?>";
var audio = new Audio("<?php echo $alarm_url;?>/memo_on.mp3"); // 임의 폴더 아래에 사운드 파일을 넣고 자바스크립트 동일경로
</script>
<script src="<?php echo $alarm_url ?>/alarm.js"></script>
<script type="text/javascript">
$(function() {
setInterval(function() {
check_alarm();
}, <?php echo $wset['delay'] ?>);
check_alarm();
});
</script>
<?php } ?>
<?php } ?>
var show_alarm_exist=false;
function check_alarm(){
$.ajax({
type:'POST',
data : ({act : 'alarm'}),
url: memo_alarm_url + '/get-events.php',
dataType:'json',
async:true,
cache:false,
success:function(result){
if(result.msg=='SUCCESS'){
show_alarm(result.title, result.content, result.url, result.me_id);
}else{
}
}
});
}
function show_alarm(title,content,url,me_id){
if(show_alarm_exist) hide_alarm();
show_alarm_exist=true;
var html = "";
audio.play();
html = "<div id='alarm_layer' class='wrapper-notification bottom right side' style='display:none'>";
html += "<div class='notification notification-primary notification-msg animated bounceInUp' id='" + me_id + "'>";
html += "<div class='notification-icon'><i class='fa fa-envelope'></i></div>";
html += "<div class='notification-close'>";
html += "<button class='close' onclick='hide_alarm()'><i class='fa fa-times fa-lg'></i></button>";
html += "</div>";
html += "<div class='notification-option'><button class='notification-check' data-toggle='tooltip' data-trigger='hover' data-html='true' data-placement='top' data-original-title='읽음' onclick='set_recv_memo(" + me_id + ")'><i class='fa fa-check'></i></button></div>";
html += "<div class='notification-heading'>" + RemoveTag(title) + "</div>";
html += "<div class='notification-content'><a onclick=\"win_memo('" + url + "');\" class=\"cursor\">" + content + "</a></div>";
html += "</div>";
html += "</div>";
$('body').prepend(html);
$('#alarm_layer').fadeIn();
setTimeout(function(){ hide_alarm(); }, 30000);
}
function hide_alarm(){
if(show_alarm_exist){
show_alarm_exist=false;
$("#alarm_layer").fadeOut(400,function(){
$('#alarm_layer').remove();
});
}
}
function set_recv_memo(me_id){
$.ajax({
type:'POST',
data : ({act : 'recv_memo', me_id : me_id}),
url: memo_alarm_url + '/get-events.php',
dataType:'json',
async:true,
cache:false,
success:function(result){
if(result.msg=='SUCCESS'){
hide_alarm();
}else{
}
}
});
}
function RemoveTag(s){
var tmp = '';
tmp = s;
tmp = tmp.replace('<','<');
tmp = tmp.replace('>','>');
tmp = tmp.replace('"','"');
return tmp;
}
답변을 작성하시기 전에 로그인 해주세요.