Home  >  Article  >  Backend Development  >  A question about real-time passenger flow, how to design the database and how to implement this function?

A question about real-time passenger flow, how to design the database and how to implement this function?

WBOY
WBOYOriginal
2016-08-31 08:54:54838browse

1. Requirements: I now need to make a bus passenger flow display, using different displays to display the bus passenger flow, similar to the real-time traffic conditions on the map. All statuses are manually set in the background.
2. There is a line 1 with stations A, B, C, D, E, F, G, H. You can travel A->H, or you can travel H->A. Set A->B is state 1, B->C is state 2, C->H state 3.
The displayed state is:
A--state 1-->B--state 2-->C-state 3 -->H
If B-E is set to state 4, the displayed state is:
A--state 1-->B--state 4-->E--state 3-->H

The same goes for traveling in the opposite direction.

Now I have no idea how to do this, including how to design the database. I hope you can give me some ideas, thank you

Reply content:

1. Requirements: I now need to make a bus passenger flow display, using different displays to display the bus passenger flow, similar to the real-time traffic conditions on the map. All statuses are manually set in the background.
2. There is a line 1 with stations A, B, C, D, E, F, G, H. You can travel A->H, or you can travel H->A. Set A->B is state 1, B->C is state 2, C->H state 3.
The displayed state is:
A--state 1-->B--state 2-->C-state 3 -->H
If B-E is set to state 4, the displayed state is:
A--state 1-->B--state 4-->E--state 3-->H

The same goes for traveling in the opposite direction.

Now I have no idea how to do this, including how to design the database. I hope you can give me some ideas, thank you

Let me give you a quick tip - when saving the database, divide it into small sections according to the minimum granularity:

<code>
| begin | end | status |
| A     | B   | 1      |
| B     | C   | 2      |
| C     | D   | 3      |
| ...   | ... | ...    |
| D     | C   | 1      |
| C     | B   | 2      |
| B     | A   | 3      |
</code>
Statement:
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