在游戏陪玩平台系统中,用户通过实名认证审核、资质技能审核后,可以申请成为平台大神,带其他玩家组队开黑并获得收益。在游戏陪玩平台系统的整个约单流程中,新订单提示是很重要的模块,尤其是对于需要接单的大神而言,今天我们就一起来了解一下新订单提示效果的实现代码:



游戏陪玩平台系统新订单提示效果



<script>
function remind() {
// 新订单提醒
$.ajax({
type :'POST',
url :'__APP__/Index/checkNewOrder',
data : {},
dataType:'json',
success:function(data){
console.log(data);
if (data.data == 1){
// 右下角弹框
layer.open({
type:0,
title: '提示',
content: '您有新的订单,请及时查看',
anim: 2,
shade:0,
offset:"rb"
});
}
}
});


// 新订单提醒
$.ajax({
type :'POST',
url :'__APP__/Index/checkNewGroupOrder',
data : {},
dataType:'json',
success:function(data){
console.log(data);
if (data.data == 1){
// 右下角弹框
layer.open({
type:0,
title: '提示',
content: '您有新的订单,请及时查看',
anim: 2,
shade:0,
offset:"rb"
});
}
}
});

}
setInterval("remind()",10000);
</script>



当大神在游戏陪玩平台系统中,接收到新订单后,除了需要由弹框的出现之外,还应该有提示音,所以新增一个提示音功能。



游戏陪玩平台系统中新订单提示音



<script>
function remind() {
// 新订单提醒
$.ajax({
type: 'POST',
url: '__APP__/Index/checkNewOrder',
data: {},
dataType: 'json',
success: function (data) {
console.log(data);
if (data.data == 1) {
playSound();
// 右下角弹框
layer.open({
type: 0,
title: '提示',
content: '您有新的订单,请及时查看',
anim: 2,
shade: 0,
offset: "rb"
});
}
}
});


// 新订单提醒
$.ajax({
type: 'POST',
url: '__APP__/Index/checkNewGroupOrder',
data: {},
dataType: 'json',
success: function (data) {
console.log(data);
if (data.data == 1) {
playSound();
// 右下角弹框
layer.open({
type: 0,
title: '提示',
content: '您有新的订单,请及时查看',
anim: 2,
shade: 0,
offset: "rb"
});
}
}
});

}


let playSound = function () {
let browser = window.navigator.userAgent.toLowerCase();
if (browser.indexOf("ie") >= 0) {
//IE内核浏览器
let strEmbed = '<embed name="embedPlay" src="/admin/image/voice.mp3" autostart="true" hidden="true" loop="false"></embed>';
if ($("body").find("embed").length <= 0)
$("body").append(strEmbed);
let embed = document.embedPlay;
embed.volume = 100;
} else {
//非IE内核浏览器
let strAudio = "<audio id='audioPlay' src='/admin/image/voice.mp3' hidden='true'>";

if ($("#audioPlay").length <= 0) {
$("body").append(strAudio);
}
let audio = document.getElementById("audioPlay");
//浏览器支持 audio
audio.play();
}
}

setInterval("remind()", 10000);
</script>



以上就是“在开发游戏陪玩平台系统时,如何实现新订单提示效果?”的全部内容,希望对大家有帮助,别看这个功能很小,但是对于游戏陪玩平台系统的开发而言,却很重要。