Home  >  Q&A  >  body text

javascript - How to pass this kind of parameter interface?

There are four quarters in total. In what form are parameters passed through the interface?
2017-1-1~2017-3-31?
please help

给我你的怀抱给我你的怀抱2669 days ago859

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-06-28 09:24:19

    It’s just transmitted like this, and the backend will process it and make a mapping.

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-06-28 09:24:19

    Method 1, you can use 1, 2, 3, and 4 to represent the first to fourth quarters respectively. Then let the background process and return the data of which quarter according to the value you passed, and then display it. For example, pass 1. The background returns the first quarter data.
    Method 2, the start and end time of the first quarter: '2017-1-1 0:0:0', '2017-3-31 23:59:59', the second quarter: '2017-4-1 0: 0:0','2017-6-30 23:59:59',. . . Then analyze it in the background.
    Method 3, based on method 2, convert the start and end times of the first quarter (2017-1-1 0:0:0 and 2017-3-31 23:59:59) into timestamps, Passed to the background.
    Method 1 and 3 are used more often. I personally think that method 1 is the most used, and then method 3

    reply
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-28 09:24:19

    I think this can be adapted to the backend, and it can be used as conveniently as possible. If the interface needs to achieve finer granularity (for example, it needs to be accurate to "year, month, day to year, month, day"), then pass it. Timestamp, if all the interfaces are Q1Q2Q3Q4 and there is unlikely to be additional demand, it is OK to replace it with a string...

    reply
    0
  • Cancelreply