Qq consulting how to use a balanced distribution to customer service now many web pages use qq Consulting, users click qq consulting can communicate with customer service qq. The front-end code is as follows: & lt; a & nbsp; target_blank & nbsp; hrefwpa. qq. commsgrd? V3 & amp; uin652193863 & amp; siteqq & amp; me qq
Qq consulting is now used on many Web pages. Users can click qq consulting to communicate with customer service on qq.
The front-end code is as follows:
If there are multiple qq customer service, but I don't want to list all qq, I want to list only one qq. when a user clicks, the user will be evenly allocated to customer service. for example, there are five customer service personnel, when the website has 100 people for consultation, each customer service can receive about 20 consultations on average. How can this problem be achieved?
--------------------------------------
I have posted several forum posts before, but they said that the front-end cannot be completed and the background should be used together. Ask experts to teach me.
------ Solution ----------------------
Create a table in the database with the 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 first unused qq.
Then
Update qq set status = 1 where id = xxx; xxx is the qq id just extracted
Then Judge
Select count (*) from qq where status = 0
Check whether there are any unshown ones. If yes, it will not be processed.
If no
Update qq set status = 0; batch restore.
In this way, the distribution can be averaged.