Originally, this CP is a single SMS interface. for various reasons, you need to send a message to all the members of the website (tens of thousands of member records) each time ), it is difficult for the program to insert an update record in ten thousand rows between different database servers from MYSQL to MSSQL, display the real-time sending progress, and feedback the post-sending results. The following requirements are provided during text message sending: <LINKhref = "http: // www. php100.
Originally, this CP is a single SMS interface. for various reasons, you need to send a message to all the members of the website (tens of thousands of member records) each time ), it is difficult for the program to insert an update record in ten thousand rows between different database servers from MYSQL to MSSQL, display the real-time sending progress, and feedback the post-sending results.
The following requirements are required during text message sending:
1) program timeout is not allowed; 2) the validity of the mobile phone number is automatically checked; 3) the sending progress ratio is calculated;
4) from MYSQL to MSSQL, there are 10 million rows of records inserted and updated between different database servers. SQL statements are not overloaded;
Briefly describe the solution:
An AJAX script in JQ is used to submit an application for sending a text message record. the program reads the application record and uses the SESSION to record the progress data. based on the number of messages sent each time, the phone number of the unsent text message in the record is returned, before sending the program, add the mobile phone legality verification. AJAX receives the record data returned for the first time, submits the mobile phone number to a recursive function, and then submits the remaining mobile phone number again in the function until the progress is 100%.
I don't know what I have to explain. the reference code is as follows:
Function send_onesms (s, p, sendid) {// This is the first AJAX sending
If (sendid = ''){
$. Prompt ('The text message you have not selected to send? ', {Buttons: {OK: true }});
Return false;
}
Var totel = '';
$ ('# Loading'). show ();
$. Ajax ({
Timeout: 36000,
Type: "GET ",
Url: "/admincp/page. php ",
Data: "showtype = 2 & page =" + p + '& sendid =' + sendid,
BeforeSend: function (){
$. Ajax ({async: true, url: "/admincp/jindu. php? Act = clear & rnd = "+ new Date (). getTime (), success: function (response) {$ ("# jindu" ).html (response) ;}, dataType: "html "});
('A.sendclass'locked .html ('locked status'). removeAttr ("onclick ");
('Sending sid'{sendid}.html ('sending... '). removeAttr ("onclick ");
},
Success: function (msg ){
$ ('# I2page'). val = p;
// Certificate ('{smslist'{.html (unescape (msg ));
// $ ('# Loading'). hide ();
If (msg! = 'Over '){
Totel = msg;
// SetInterval (function () {$. ajax ({async: true, url: "/admincp/jindu. php? Rnd = "+ new Date (). getTime (), success: function (response) {$ ("# jindu" ).html (response) ;}, dataType: "html"})}, 1000 );
}
}
});
Send_sms (s, p, sendid, totel );
// Window. clearInterval (thread );
}
Function send_sms (s, p, sendid, totel) {// a recursive function
$. Ajax ({
Timeout: 36000,
DataType: "html ",
Type: "POST ",
Url: "/admincp/page. php? Rnd = "+ new Date (). getTime (),
Data: "showtype = 2 & page =" + p + '& sendid =' + sendid + '& totel =' + totel,
Success: function (response ){
If (response! = 'Over '){
$. Ajax ({async: true, url: "/admincp/jindu. php? Rnd = "+ new Date (). getTime (), success: function (response) {$ ("# jindu" ).html (response) ;}, dataType: "html "});
SetTimeout (send_sms (s, p, sendid, response), 1000 );
} Else {
$. Ajax ({async: true, url: "/admincp/jindu. php? Act = over & rnd = "+ new Date (). getTime (), success: function (response) {alert (response) ;}, dataType:" html "});
$ ('# Loading'). hide ();
Menu_sec2_move (p );
}
}
});
}