QQ Consulting How to use a balanced distribution to customer service
Now a lot of web pages are used QQ Consulting, users click on QQ Consulting can and customer service QQ communication.
The front-end code is as follows:
If there are many QQ customer service, but I do not want to put all the QQ list, I would like to list only one QQ, when the user clicks will be evenly distributed to customer service, for example, there are 5 customer service, when the site has 100 people consultation, the average customer service can receive 20 or so consultation. How to achieve it?
——————————————————————————————————————
A few previous sections, but they said the front end can not be completed, to the background to cooperate. Please teach me the master.
------to solve the idea----------------------
Create a table in the database, table name QQ
The structure is as follows
ID, QQ, status
1 11111 0
2 22222 0
3 33333 0
When the user accesses.
Select QQ from QQ where status=0 ORDER by ID ASC Limit 1
Select the last unused QQ.
And then
Update QQ set Status=1 where id=xxx; XXX for the QQ ID just pulled out
Then judge
Select COUNT (*) from QQ where status=0
See if there are any that haven't been shown yet. If any, it is not processed.
If it is not, then
Update QQ set status=0; Bulk restore.
This will be evenly distributed.