search

Home  >  Q&A  >  body text

javascript - The logic of the sorting function of the WeChat mini program e-commerce search page

Currently developing the business logic of the search page. Since I rarely made interfaces before, the business logic is a bit unclear now. I hope the master can talk about the specific business logic and solve my concerns (such as sales sorting: how to achieve ascending and descending order, do you use variables to control whether the user clicks in ascending or descending order? Do you need to go to the backend request every time you click? One interface?).
The interface documentation is as follows:

给我你的怀抱给我你的怀抱2747 days ago1029

reply all(3)I'll reply

  • 阿神

    阿神2017-06-15 09:23:22

    Every time you want to request the interface from the background, such as sales volume, this changes in real time, and the data may change the next time you request it. For price sorting, if the first time is ascending order and the next time is descending order, when the amount of data is only one page, it can be sorted locally. However, when the amount of data exceeds one page and the rest of the data has not been obtained, the locally sorted data will be wrong. Yes.

    reply
    0
  • 高洛峰

    高洛峰2017-06-15 09:23:22

    If you just ask whether you want to go to the backend to request the interface, then the answer is "yes"

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-06-15 09:23:22

    When requesting the backend, add order when reading the database. If you only want to sort by a single item, you can add a val to each button and pass it to the backend. The backend will determine what sorting it is and then order to read the database

    reply
    0
  • Cancelreply