帮忙写一个php接口 有新的订单 后台提醒语音播报

*若价格不公道,可以让提问者在平台追加赏金哦,平台是您利益的保证

已完成
帮忙写一个php接口  有新的订单  后台提醒语音播报-百里守约
百里守约 3年前发布
悬赏:25.0 元

问题详情:分类: PHP

js代码部分
<!--新订单提醒-->
function timeout() {
var res;
$.ajax({
url:'index.php?act=dingshi',
type:'get',
datatype:'text',
async:false,
success:function (data) {
res = data;
}
});
return res;
}
var i=timeout();

function hello() {
console.log('5678');
$.getJSON(STORE_URL + '/order/newOrder', null, function (result) {
console.log(result);
if (result.code === 1) {
console.log("00000");
$(".add_blank").show();
playSound();
}
});
}
setInterval("hello()",10000);<!--10秒定时请求一次-->
<!--展示9秒关闭-->
$(function(){
console.log("123");
setInterval(function(){
$(".add_blank").hide();
},9000);
});

var playSound = function () {
var borswer = window.navigator.userAgent.toLowerCase();
if ( borswer.indexOf( "ie" ) >= 0 )
{
//IE内核浏览器
var strEmbed = '<embed name="embedPlay" src="/mp3/notice.mp3" autostart="true" hidden="true" loop="false"></embed>';
if ( $( "body" ).find( "embed" ).length <= 0 )
$( "body" ).append( strEmbed );
var embed = document.embedPlay;

//浏览器不支持 audion,则使用 embed 播放
embed.volume = 100;
//embed.play();这个不需要
} else
{
//非IE内核浏览器
var strAudio = "<audio id='audioPlay' src='/mp3/notice.mp3' hidden='true'>";

if($("#audioPlay").length<=0){
$( "body" ).append( strAudio );
}

var audio = document.getElementById( "audioPlay" );

//浏览器支持 audio
audio.play();
}
}
这是order订单表
控制器下的newOrder 方法,主要需求就是编写这个接口 目前是返回成功无限刷新了。需求是判断到有新付款的订单然后刷新页面提醒播报

public function newOrder()
{

return $this->renderSuccess('成功');

}



*若价格不公道,可以让提问者在平台追加赏金哦,平台是您利益的保证。你觉得当前的价格如何呢,奉上您珍贵的一票吧

虚高0人次 适中0人次 偏低0人次

分享海报会更快解决你的问题哦!分享海报

此处可发布评论

评论(0

暂无评论,快来写一下吧
客服QQ 1913284695