Home > Backend Development > PHP Tutorial > If no one takes the order within 15 seconds, the system will remind the person who placed the order that no one will take the order.

If no one takes the order within 15 seconds, the system will remind the person who placed the order that no one will take the order.

WBOY
Release: 2016-07-06 13:52:11
Original
920 people have browsed it

If no one takes the order within 15 seconds, the system will remind the person who placed the order that no one takes the order

It is an interface written for Android and Ios using thinkphp

(It is divided into two terminals, one is the client and the other is the server. I am the server)

The client sends an order and the server receives the order. If no one picks up the order within 15 seconds, feedback information is given to the client

How to implement this interface?

Reply content:

If no one takes the order within 15 seconds, the system will remind the person who placed the order that no one takes the order

It is an interface written for Android and Ios using thinkphp

(It is divided into two terminals, one is the client and the other is the server. I am the server)

The client sends an order and the server receives the order. If no one picks up the order within 15 seconds, feedback information is given to the client

How to implement this interface?

How about leaving it to the client?
If the interface responds within 15s, it will be processed. If there is no response, the client will be prompted that no one is answering.

The client requests the interface once after 15 seconds and returns whether there is anyone to take the order

<code>var ajaxTimeoutTest = $.ajax({
  url:'',  //请求的URL
  **timeout : 1000, //超时时间设置,单位毫秒**
  type : 'get',  //请求方式,get或post
  data :{},  //请求所传参数,json格式
  dataType:'json',//返回的数据格式
  success:function(data){ //请求成功的回调函数
    alert("成功");
  },
  complete : function(XMLHttpRequest,status){ //请求完成后最终执行参数
    if(status=='timeout'){//超时,status还有success,error等值的情况
       ajaxTimeoutTest.abort();
       alert("超时");
    }
  }
});
</code>
Copy after login

You can set the timeout setting. If the time is up, execute the timeout method to prompt the client

The first floor is right. There is no need to hand it over to the server. If the front-end finds there is still no response after 15 seconds, it will be considered that no one has taken the order. Or it can use the user's order as the starting time, set a timer, and respond to customer service after 15 seconds. On the other hand, the most famous Linux timer is Linux CRON

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template