search

Home  >  Q&A  >  body text

php - How to write the commission of lottery draw in real time

I wrote a * function, the lottery results are synchronized with the lottery results of the lottery.
After the user placed a bet, I set up a crontab on the server to refresh the lottery results every minute. Once a certain lottery is drawn, ,
I will update the winning status and lottery results of all users’ betting orders. The platform has an agency mechanism. There is
a table that records the winning and losing of each agent's commission for each bet placed by the user, but now I have not put this thing in the planned task,
because if tens of thousands of people place bets in one period, Then the loop writing may not be completed within one minute. The current method is to write the agent's commission only when the user writes his own betting order
How many wins and losses are written passively? Now I want to ask, if the data is actively written in real time when the lottery is drawn, is it appropriate to run it on the server in a loop? Is there any other good method?

高洛峰高洛峰2819 days ago536

reply all(2)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 13:03:53

    Write using redis

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-16 13:03:53

    Get the data and store it in redis, then use redis to flash it to the database

    reply
    0
  • Cancelreply