CN107943828B - Service state query method and device, computer equipment and storage medium - Google Patents

Service state query method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN107943828B
CN107943828B CN201710978140.XA CN201710978140A CN107943828B CN 107943828 B CN107943828 B CN 107943828B CN 201710978140 A CN201710978140 A CN 201710978140A CN 107943828 B CN107943828 B CN 107943828B
Authority
CN
China
Prior art keywords
service
state
query
service identifier
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201710978140.XA
Other languages
Chinese (zh)
Other versions
CN107943828A (en
Inventor
尹式钧
魏超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Niudingfeng Technology Co ltd
Original Assignee
Shenzhen Niudingfeng Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Niudingfeng Technology Co ltd filed Critical Shenzhen Niudingfeng Technology Co ltd
Priority to CN201710978140.XA priority Critical patent/CN107943828B/en
Publication of CN107943828A publication Critical patent/CN107943828A/en
Application granted granted Critical
Publication of CN107943828B publication Critical patent/CN107943828B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/02Payment architectures, schemes or protocols involving a neutral party, e.g. certification authority, notary or trusted third party [TTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Accounting & Taxation (AREA)
  • Computer Security & Cryptography (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention relates to a service state query method, a service state query device, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring a query instruction corresponding to the service identifier, and generating a query request of a service state corresponding to the service identifier by using the query instruction; sending the query request to a third-party platform so that the third-party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state; receiving a service state returned by the third-party platform according to the service identifier, and pushing the service identifier to a message queue when the service state is an intermediate state; adding corresponding delay time to the service identifier in the message queue; monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state.

Description

Service state query method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for querying a service status, a computer device, and a storage medium.
Background
Some services which are performed through a third-party platform and have low requirements on real-time performance emerge at present. Such as withholding services and payment services. Taking the withholding service as an example, the payee may withhold the school fee or the property fee through the third-party platform, and if the payee wants to know the progress of the withholding service, in the conventional manner, the payee needs to query the third-party platform regularly through the terminal.
The deduction service generally involves a plurality of services, different services may be deducted through different third-party platforms, and the time for carrying out deduction operations by different third-party platforms may also be different. For example, to solve the problem that a resident is inconvenient to pay property fees, the third-party platform can help a property company to deduct corresponding property fees from the account of the resident in 2 days in the beginning of the month, and since the accounts of different residents are possibly bound with different third-party platforms, the specific deduction time of different third-party platforms may be different, and the real-time performance of deduction services is not high. In order to acquire progress status of deduction, a property company generally needs to query a third-party platform at regular time through a terminal in a traditional mode, and the query mode is relatively blind, so that much resource consumption is increased. How to reduce the terminal resource consumption when inquiring about the service progress status becomes a technical problem to be solved at present.
Disclosure of Invention
In view of the above, it is necessary to provide a service status query method, apparatus, computer device and storage medium capable of reducing terminal resource consumption.
A method for service status query, the method comprising:
acquiring a query instruction corresponding to a service identifier, and generating a query request of a service state corresponding to the service identifier by using the query instruction;
sending the query request to a third-party platform so that the third-party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state;
receiving a service state returned by the third-party platform according to the service identifier, and pushing the service identifier to a message queue when the service state is an intermediate state;
adding corresponding delay time to the service identifier in the message queue;
monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state.
In one embodiment, the message queue includes a first queue and a second queue, and the method further includes:
adding corresponding delay time to the service identifier in the first queue; sending the service identifier added with the delay time to a second queue;
monitoring the delay time added by the service identifier in the second queue, extracting the service identifier reaching the delay time, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state.
In one embodiment, the step of adding a corresponding delay time to the service identifier in the message queue includes:
acquiring the current query times of the service identifier;
if the current query times exceed the preset times, utilizing the query times to perform linear increment or nonlinear increment to obtain the delay time corresponding to the next query of the service identifier;
and adding the delay time to the service identifier.
In one embodiment, the method further comprises:
sending a service operation request to the third-party platform, where the service operation request carries a service identifier, the service identifier corresponds to multiple services, and the step of adding a corresponding delay time to the service identifier in the message queue includes:
acquiring the service quantity corresponding to the service identification and the time consumption for returning to the service state;
calculating an active coefficient corresponding to the third-party platform by using the service quantity and the time consumption for returning to the service state;
acquiring the current query time interval of the service identifier;
calculating the delay time corresponding to the next query of the service identifier by using the active coefficient and the current query time interval;
and adding the delay time to the service identifier.
In one embodiment, the step of calculating the activity coefficient corresponding to the third-party platform by using the number of services and the time consumed for returning to the service state includes:
acquiring the total amount of the service corresponding to the service identifier and the service quantity of which the service state is the final state;
calculating a first factor by using the service quantity and the total service quantity of the service state which is the intermediate state;
recording the sending time of the service operation request; acquiring the receiving time of the service condition;
calculating the time consumption of returning to the service state by using the sending time and the receiving time, and calculating the average time consumption according to the average time consumption and the total service amount corresponding to the service identifier;
acquiring the first factor according to the gradient range to which the average consumed time belongs;
and calculating an active coefficient corresponding to the third-party platform by using the first factor and the second factor.
A traffic status query apparatus, the apparatus comprising:
the generating module is used for acquiring a query instruction corresponding to a service identifier and generating a query request of a service state corresponding to the service identifier by using the query instruction;
the sending module is used for sending the query request to a third-party platform so that the third-party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state;
the receiving module is used for receiving the service state returned by the third-party platform according to the service identifier; when the service state returned by the third-party platform is an intermediate state, pushing the service identifier to a message queue;
a delay module, configured to add a corresponding delay time to the service identifier in the message queue;
and the iteration module is used for monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is in a final state.
In one embodiment, the delay module is further configured to obtain a current number of queries of the service identifier; and if the current query times exceed the preset times, utilizing the query times to perform linear increment or nonlinear increment to obtain the delay time corresponding to the next query of the service identifier.
In one embodiment, the delay module is further configured to calculate an activity coefficient corresponding to the third-party platform by using the number of services and time consumed for returning to a service state; acquiring the service quantity corresponding to the service identifier, the time consumption for returning to the service state and the current query time interval of the service identifier; and calculating the delay time corresponding to the next query of the service identifier by using the active coefficient and the current query time interval.
A computer device, the computer device includes a memory and a computer program stored on the memory and capable of running on the processor, and the processor executes the program to implement the steps of the service status query method provided in the above embodiments of the present invention.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the service status query method provided in the above-mentioned embodiments of the present invention.
According to the business state query method, the business state query device, the computer equipment and the readable storage medium, the returned business identifier with the business state as the intermediate state is pushed to the message queue, the corresponding delay time is added to the business identifier in the message queue, when the delay time is reached, the business identifier corresponding to the delay time is extracted, the query request of the business state corresponding to the business identifier is sent again, and the corresponding business state returned by the third-party transaction platform according to the query request is received again until the received business state is the final state. Therefore, the number of times of inquiry can be reduced, the problem of resource consumption when the service progress condition is inquired is solved, and the resource consumption of the terminal is reduced.
Drawings
Fig. 1 is a schematic application environment diagram of a service status query method according to an embodiment;
FIG. 2 is a flow diagram illustrating a method for querying a service status in one embodiment;
FIG. 3 is a diagram illustrating an exemplary architecture of a device for querying a service status;
FIG. 4 is a block diagram of a computer device in one embodiment.
Detailed Description
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
Fig. 1 is a schematic application environment diagram of a service status query method and apparatus according to an embodiment. As shown in fig. 1, the application environment includes a terminal 102 and a server 104, and the terminal 102 and the server 104 communicate via a network. The terminal 102 may be a desktop computer, a personal laptop computer, a tablet computer, a smart phone, a personal digital assistant, or a wearable device, etc. The terminal 102 may be a server, and communicates with the server 104 via a network to issue a request for a service status query to the server 104. The number of servers 104 may be multiple. When the terminal 102 is an intelligent terminal, a user can perform query operation on an interface on an application program on the intelligent terminal, the terminal 102 can acquire a query instruction corresponding to the service identifier through the interface on the application program, when the terminal 102 is a desktop computer or a notebook computer, the user can perform query operation on the interface on a browser, and the terminal 102 acquires the query instruction corresponding to the service identifier through the browser.
After acquiring the query instruction corresponding to the service identifier, the terminal 102 generates a query request of a corresponding service state by using the query instruction, and sends the query request of the service state to the server 104. The server 104 returns the corresponding service status according to the query request. When the terminal 102 receives the service status returned by the server 104, and determines that the service status is in the intermediate status, the terminal 102 pushes the service identifier to the message queue, and adds corresponding delay time to the service identifier in the message queue. The terminal 102 may monitor the delay time added to the service identifier in the message queue, and when it is found that the service identifier reaches the delay time, the terminal 102 extracts the service identifier reaching the delay time, generates a corresponding query request, sends the query request of the service state corresponding to the service identifier to the server 104 again, receives the corresponding service state returned by the server 104 according to the query request again, until the server 104 completes the corresponding operation, and returns the service state returned to the terminal 102 to the final state.
Fig. 2 is a flowchart of a service status query method according to an embodiment, which is executed on the terminal 102 shown in fig. 1. It should be understood that, although the steps in the flowchart of fig. 2 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. Moreover, at least a portion of the steps in fig. 2 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, in different orders, and may be performed alternately or at least partially with respect to other steps or sub-steps of other steps. Taking the application of the method to the terminal as an example for explanation, the method specifically comprises the following steps:
step S202, obtaining a query instruction corresponding to the service identifier, and generating a query request of the service state corresponding to the service identifier by using the query instruction.
When a payee needs to perform an automatic deduction service to a payer, the payee needs to initiate a deduction substitute request to a third-party platform holding a payment license (a payment service license) through a terminal, so that the third-party platform completes a corresponding deduction substitute operation. It will be appreciated that since the third party platforms to which the payer is bound or trusted may not be the same, the payee may initiate rebate requests to multiple third party platforms holding the paid license plate via the terminal. In addition, the method can be used as long as two sides of the service relate to the query of the service, for example, two third party platforms with service traffic can also use the method to query the service state.
After the deduction substitute request is sent out, if the payee wants to know the progress of the service, the payee can send a query instruction to the third-party platform through a page on the terminal by clicking or sliding operation on the corresponding service identifier for query. And after the terminal acquires the query instruction corresponding to the service identifier, generating a query request of the service state corresponding to the service identifier according to the received query instruction.
The service identifier is a unique mark for identifying a certain service, and different services can be distinguished. The service identifier may correspond to various information of the service, such as a service name, a service number, basic information of both sides of the service, and the like.
Step S204, the query request is sent to the third party platform, so that the third party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state.
And the terminal sends the generated inquiry request corresponding to the service identifier to the third-party platform so as to inquire the state of the service to the third-party platform. And after receiving the query request, the third-party platform returns the service state corresponding to the corresponding service identifier to the terminal according to the query request.
The traffic states include intermediate states and final states. The success and failure of the service operation belong to the final states of the service identifier. When the service state is in an unknown state, the service is identified as an intermediate state, that is, all the service states not belonging to the final state of the service are intermediate states. The service is in the intermediate state for a plurality of reasons, for example, the third-party platform does not send a notification message terminal, or the network delays. After the terminal sends out the query request, the third party platform receives the query request, queries the corresponding service state according to the service identification carried in the query request, and returns the queried service state to the terminal.
Step S206, receiving the service state returned by the third party platform according to the service identifier, and pushing the service identifier to the message queue when the service state is the intermediate state.
Step S208, add corresponding delay time to the service identifier in the message queue.
And the terminal receives the service state returned by the third-party platform, and if the service state returned by the third-party platform is judged to be the final state of the service identifier, the service processing is finished, and subsequent operation can be carried out. And if the service state returned by the third-party platform is judged to be the intermediate state of the service identifier, the service corresponding to the service identifier is not processed, the third-party platform needs to wait for processing, and the third-party platform needs to inquire again.
The terminal may store the service identifier in the intermediate state through the message queue. The terminal can also add delay time to the service identifier in the message queue according to a preset time algorithm. The delay time is the query waiting time added by the terminal to the service identifier in the intermediate state in the message queue. The delay time may be a specific time point or a specific time period. For example, the specific query time for the next query request submitted to the third-party platform, for example, 17 o' clock 25 points 6/3, or the waiting time in the message queue, for example, the time period of 30 minutes or 1 hour.
Step S210, monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, and performing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state.
Specifically, the terminal monitors the delay time in the message queue, when the condition that the delay time is reached is monitored, extracts the service identifier corresponding to the delay time, generates a query request, sends the query request of the service state corresponding to the service identifier to the third-party platform again, receives the corresponding service state returned by the third-party platform according to the query request again until the third-party platform completes the corresponding operation, and returns the service state to the terminal as the final state. It can be understood that the number of times of querying is not fixed, and may be multiple times depending on the specific situation, and the querying may be ended until the terminal receives the service state returned by the third party platform as the final state. In the message queue, a plurality of service identifiers in an intermediate state may exist, and certainly, the situation that delay times of different service identifiers are reached at the same time also exists, in this situation, the terminal generates a plurality of query requests in a multi-thread concurrent query mode, sends the plurality of query requests to a third-party platform, and queries the service states of the plurality of service identifiers together.
And if the service state returned by the third-party platform is the intermediate state, pushing the service identifier to a message queue, adding corresponding delay time to the service identifier in the message queue, and waiting for the next inquiry to the third-party platform when the service identifier is in the message queue.
In a traditional mode, the query time interval is fixed, for example, each time is 5 minutes, such query is relatively blind, the number of times of invalid query is relatively large, and great terminal resource loss is caused, which brings great burden. In this embodiment, the returned service identifier with the intermediate service state is pushed to the message queue, the terminal adds corresponding delay time to the service identifier in the message queue, extracts the service identifier corresponding to the delay time when the delay time is reached, resends the query request of the service state corresponding to the service identifier, and receives the corresponding service state returned by the third-party transaction platform according to the query request again until the third-party platform completes the corresponding operation, and the service state returned to the terminal is the final state. Corresponding delay time is added to the service identifier, so that the query time is more reasonable, the number of blind queries can be reduced, the problem of more resource consumption when the progress condition of the service is queried is solved, and the resource consumption of the terminal is reduced.
In one embodiment, the message queue includes a first queue and a second queue, the method further comprising: adding corresponding delay time to the service identifier in the first queue; sending the service identifier added with the delay time to a second queue; and monitoring the delay time added by the service identifier in the second queue, extracting the service identifier reaching the delay time, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state.
In this embodiment, the message queue may further include a first queue and a second queue. The first queue may employ a high efficiency storage system to query directly from memory, such as Redis, and the second queue may also employ a high efficiency storage system to query directly from memory, such as Redis. The terminal may monitor the first queue, and when it is monitored that the service identifier in the intermediate state is pushed to the first queue, add a corresponding delay time to the service identifier, where the delay time may be a time period of 30 minutes or 1 hour, or may be a specific query time for submitting a query request to the third-party platform next time. The terminal can monitor the second queue, and whether the delay time is reached is monitored, and whether the service identifier added with the delay time in the second queue can be extracted for inquiring again.
The terminal may add a corresponding delay time to the service identifier in the intermediate state in the first queue, and send the service identifier to which the delay time is added to the second queue. The terminal can also monitor the delay time in the second queue, when the condition that the delay time is reached is monitored, the service identifier corresponding to the delay time is extracted, a query request is generated, the query request of the service state corresponding to the service identifier is sent to the third-party platform again, the corresponding service state returned by the third-party platform according to the query request is received again, and the process is stopped until the service state returned by the third-party platform is received and is in the final state. By adopting the high-efficiency storage system, the service identifier to be inquired is taken out from the database, and the service state is directly inquired in the message queue, so that the pressure caused by frequently inquiring the database is avoided. In addition, delay time is added to the service identifier in the intermediate state in the first queue, the delay time is monitored in the second queue, the service identifier reaching the delay time is extracted and inquired again, so that the delay time is added and the delay time is monitored separately, the service identifier can be managed more efficiently, and the inquiry efficiency is improved.
In one embodiment, the step of adding a corresponding delay time to the service identifier in the message queue comprises: acquiring the current query times of a service identifier; if the current query times exceed the preset times, utilizing the query times to perform linear increment or nonlinear increment to obtain the delay time corresponding to the next query of the service identifier; delay time is added to the service identification.
The terminal may perform a corresponding delay time adding operation on the service identifier according to a preset time algorithm. When the delay time is added to the service identifier by using the time algorithm, the delay time can be linearly increased along with the increase of the delay times, and also can be nonlinearly increased along with the increase of the delay times. In this embodiment, each service identifier may need to be queried many times to return to the final state, and the service identifier has a corresponding current query number. Before each inquiry, the terminal firstly obtains the current inquiry times of the service identifier, then calculates the corresponding delay time when the service identifier is inquired next time by using the inquiry times, and adds the calculated delay time to the service identifier. Typically, the delay time increases as the number of queries the terminal has to the third party platform increases.
The time algorithm for adding the delay time can be preset according to the requirement, and the preset times can be adjusted. For example, the set number of times is 5 times. Since the same service identifier may need to be queried many times to return to the final state, in the process of setting the delay time for the same service identifier, because the time algorithms set before and after 5 times are different, the query of 5 th time is usually a boundary line, and the delay time added to the service identifier after 5 times is greatly increased compared with the prior delay time.
Taking linear increment as an example, the time algorithm for adding the delay time to the service identifier may be a related mathematical formula, for example, the time algorithm set before 5 times is y ═ x, the time algorithm set after 5 times is y ═ 10 ×, then the query is initiated after 1 minute for the first time, the query is initiated after 2 minutes for the second time, the third time is 3 minutes, the fourth time is 4 minutes, the fifth time is 5 minutes, and when the time is more than 5 times, the sixth time is 60 minutes, and the delay time is increased by a larger margin than before. Here, a simple formula is taken as an example, the setting of the time algorithm is relatively flexible, and besides a simple linear algorithm, the time algorithm may also be a gradient algorithm, and the like, as long as the function of adding delay time to the service identifier is performed.
In the traditional mode, the time interval of inquiry is fixed, the inquiry mode is relatively blind, the invalid inquiry times are more, great terminal loss is caused, great burden is brought, the preset times are set, different time algorithms are adopted before and after the preset times, the time algorithm is changed for the service identification reaching the preset times, more reasonable delay time is added, the inquiry times are reduced, the terminal loss can be reduced, and the inquiry efficiency is improved.
In one embodiment, the step of calculating the activity coefficient corresponding to the third-party platform by using the service quantity and the time consumed for returning to the service state comprises the following steps: acquiring the total amount of the service corresponding to the service identifier and the number of the services with the service state as a final state; calculating a first factor by using the service quantity and the total service quantity of the service state which is an intermediate state; recording the sending time of the service operation request; acquiring the receiving time of the service condition; calculating the time consumption of returning to the service state by using the sending time and the receiving time, and calculating the average time consumption according to the average time consumption and the total service amount corresponding to the service identifier; acquiring a second factor according to the gradient range to which the average consumed time belongs; and calculating the active coefficient corresponding to the third-party platform by using the first factor and the second factor.
In this embodiment, before the terminal sends the service state query request to the third-party platform, the terminal needs to send the service operation request to the third-party platform first, after the third-party platform responds to the service operation request, the queried service identifier is in a final state, and if the third-party platform does not respond, the queried service identifier is in an intermediate state. Each time the terminal submits the service operation request, a plurality of service identifiers may correspond to the terminal. Because a plurality of third-party platforms may exist and the time for processing the service by different third-party platforms may be different, the states that a plurality of service identifiers corresponding to the service operation requests submitted in the same batch may return are different. In order to set the delay time more efficiently, it is necessary to set an activity factor for different third party platforms. The active coefficient is used to determine the processing capability of the third-party platform, and generally speaking, the higher the processing capability is, the higher the active coefficient is.
The way to calculate the activity factor of a third party platform is as follows: and acquiring the total amount of the services corresponding to the service identifiers submitted in the same batch and the number of the services with the returned service identifiers in the intermediate state, and calculating a first factor according to the number relationship of the total amount of the services and the number of the services with the returned service identifiers in the intermediate state. Calculating the time consumption from the submission of the business operation request to the reception of the returned business state, calculating the average time consumption according to the time consumption and the business total amount corresponding to the business identification submitted in the same batch, and finally obtaining a second factor through query. And calculating the active coefficient corresponding to the third-party platform according to the first factor and the second factor.
For example, a service operation request is sent to a certain third-party platform, the total number of services corresponding to the service identifiers submitted in the same batch is 100, after a period of time, no service state is returned due to network delay, and the terminal sends a query request of the service state to the third-party platform. And the third-party platform calculates that the number of the service states returned by the service identifier is 80 of the intermediate states, and the first factor is 0.8. The time from submitting the business operation request to receiving the returned business state is 10 seconds, the average time consumed by calculation is 0.1 second, and the second factor corresponding to table look-up is 0.8. And calculating by using the product of the first factor and the second factor to obtain an active coefficient of 0.64 corresponding to the third-party platform.
Table one:
average time-consuming Range Value of the second factor
Less than 500ms 1
500ms~5s 0.8
5s~15s 0.6
15s~30s 0.5
Greater than 30s 0.2
When the first factor and the second factor are used to calculate the activity coefficient corresponding to the third-party platform, the specific calculation mode may be set by itself, for example, the calculation mode is calculated by using a mathematical formula, and in the example, a simpler mode that a product of the first factor and the second factor is used is given. Of course, the corresponding relationship between the average consumed time and the second factor in the table may be adjusted according to the usage situation and the relationship between different service situations.
In the embodiment, a unified judgment standard is set for different third party platforms with business traffic, the activity coefficients corresponding to the third party platforms are calculated, the capacity of the different third party platforms is evaluated, and different delay times are added to business identifications sent to the different third party platforms through the activity coefficients, so that the added delay times are more reasonable, the inquiry is more effective, the inquiry times are reduced, and the loss of the terminal is reduced.
In one embodiment, a method for querying a service status further includes: sending a service operation request to a third-party platform, wherein the service operation request carries a service identifier, the service identifier corresponds to a plurality of services, and the step of adding corresponding delay time to the service identifier in a message queue comprises the following steps: acquiring the service quantity corresponding to the service identification and the time consumption for returning to the service state; calculating an active coefficient corresponding to the third-party platform by using the service quantity and the time consumption for returning to the service state; acquiring a current query time interval of a service identifier; calculating delay time corresponding to next query of the service identifier by using the active coefficient and the current query time interval; delay time is added to the service identification.
The time interval refers to the time from the last time the delay time is set to the present time, and when the delay time is a time period, the time interval may also be the time corresponding to the last delay time. In this embodiment, before the terminal sends the service state query request to the third-party platform, the terminal needs to send the service operation request to the third-party platform first, after the third-party platform responds to the service operation request, the queried service identifier is in a final state, and if the third-party platform does not respond, the queried service identifier is in an intermediate state. Each time the terminal submits the service operation request, a plurality of service identifiers may correspond to the terminal. Because a plurality of third-party platforms may exist, the time for processing the service by different third-party platforms may be different, and the states that a plurality of service identifiers corresponding to service operation requests submitted in the same batch may return are different, in order to set the delay time more efficiently, an activity coefficient is set for the third-party platforms, the delay time corresponding to the next query of the service identifier can be calculated by using the activity coefficient and the current query time interval, and the delay time is added to the service identifier.
In a conventional manner, the query time interval is fixed, for example, 5 minutes each time, such query is relatively blind, and a large terminal loss and a large burden are brought. In this embodiment, the last delay time is used as the time interval to calculate the delay time of the service identifier, for example, the last delay time is 10 minutes, the activity coefficient of the third-party platform corresponding to the service identifier is calculated to be 0.5, the ratio of 10 to 0.5 is calculated to obtain the delay time to be 20 minutes, and when the delay time is calculated by using the time interval and the activity coefficient of the third-party platform, a specific time algorithm may be set by itself. Therefore, each time of delay time is added again, the query time is more reasonable, the query times can be reduced, the problem of more resource consumption when the progress condition of the service is queried is solved, the resource consumption of the terminal is reduced, and the query efficiency is improved.
In one embodiment, as shown in fig. 3, there is provided a service status query apparatus, including: a generating module 302, a sending module 304, a receiving module 306, a delaying module 308, and an iterating module 310, wherein:
and the generating module is used for acquiring the query instruction corresponding to the service identifier and generating a query request of the service state corresponding to the service identifier by using the query instruction.
And the sending module is used for sending the query request to the third-party platform so that the third-party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state.
The receiving module is used for receiving the service state returned by the third-party platform according to the service identifier; and when the service state returned by the third-party platform is the intermediate state, pushing the service identifier to the message queue.
And the delay module is used for adding corresponding delay time to the service identifier in the message queue.
And the iteration module is used for monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state.
In this embodiment, the returned service identifier with the intermediate service status is pushed to the message queue, the terminal adds corresponding delay time to the service identifier in the message queue, extracts the service identifier corresponding to the delay time when the delay time is reached, resends the query request of the service status corresponding to the service identifier, and receives the corresponding service status returned by the third party transaction platform according to the query request again until the received service status is the final status. Therefore, each time of delay time is added again, the query time is more reasonable, the query times can be reduced, the problem of more resource consumption when the service progress condition is queried is solved, and the resource consumption of the terminal is reduced.
In one embodiment, the delay module in the device is further configured to obtain a current number of queries of the service identifier; and if the current query times exceed the preset times, carrying out linear increment or nonlinear increment by utilizing the query times to obtain the delay time corresponding to the next query of the service identifier.
In one embodiment, the delay module in the device is further configured to calculate an activity coefficient corresponding to the third-party platform by using the number of services and the time consumed for returning to the service state; acquiring the service quantity corresponding to the service identifier, the time consumption for returning to the service state and the current query time interval of the service identifier; and calculating the delay time corresponding to the next query of the service identifier by using the activity coefficient and the current query time interval.
In one embodiment, a computer device is provided, the computer device comprising a memory and a computer program stored on the memory and executable on a processor, the processor performing the steps of: acquiring a query instruction corresponding to the service identifier, and generating a query request of a service state corresponding to the service identifier by using the query instruction; sending the query request to a third-party platform so that the third-party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state; receiving a service state returned by the third-party platform according to the service identifier, and pushing the service identifier to a message queue when the service state is an intermediate state; adding corresponding delay time to the service identifier in the message queue; monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state.
In one embodiment, the message queue includes a first queue and a second queue, and the processor further performs the steps of: adding corresponding delay time to the service identifier in the first queue; sending the service identifier added with the delay time to a second queue; and monitoring the delay time added by the service identifier in the second queue, extracting the service identifier reaching the delay time, executing the step of sending the query request of the service state to the third-party platform again, and returning the service state to the terminal as a final state. In one embodiment, the processor further performs the steps of: acquiring the current query times and query time interval of the service identifier; if the current query times exceed the preset times, utilizing the query time interval to perform linear increment or nonlinear increment to obtain the delay time corresponding to the next query of the service identifier; delay time is added to the service identification.
In one embodiment, the processor further performs the steps of: sending a service operation request to a third-party platform, wherein the service operation request carries a service identifier, the service identifier corresponds to a plurality of services, and the step of adding corresponding delay time to the service identifier in a message queue comprises the following steps: acquiring the service quantity corresponding to the service identification and the time consumption for returning to the service state; calculating an active coefficient corresponding to the third-party platform by using the service quantity and the time consumption for returning to the service state; acquiring a current query time interval of a service identifier; calculating delay time corresponding to next query of the service identifier by using the active coefficient and the current query time interval; delay time is added to the service identification.
In one embodiment, the processor further performs the steps of: acquiring the total amount of the service corresponding to the service identifier and the number of the services with the service state as an intermediate state; calculating a first factor by using the service quantity and the total service quantity of the service state which is an intermediate state; recording the sending time of the service operation request; acquiring the receiving time of the service condition; calculating the time consumption of returning to the service state by using the sending time and the receiving time, and calculating the average time consumption according to the average time consumption and the total service amount corresponding to the service identifier; acquiring a first factor according to the gradient range to which the average consumed time belongs; and calculating the active coefficient corresponding to the third-party platform by using the first factor and the second factor.
In one embodiment, a computer-readable storage medium is proposed, on which a computer program is stored which, when being executed by a processor, carries out the steps of: acquiring a query instruction corresponding to the service identifier, and generating a query request of a service state corresponding to the service identifier by using the query instruction; sending the query request to a third-party platform so that the third-party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state; receiving a service state returned by the third-party platform according to the service identifier, and pushing the service identifier to a message queue when the service state is an intermediate state; adding corresponding delay time to the service identifier in the message queue; monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, executing the step of sending the query request of the service state to the third-party platform again, and returning the service state to the terminal as the final state.
In one embodiment, the message queue comprises a first queue and a second queue, and the program when executed by the processor performs the steps of: adding corresponding delay time to the service identifier in the first queue; sending the service identifier added with the delay time to a second queue; and monitoring the delay time added by the service identifier in the second queue, extracting the service identifier reaching the delay time, executing the step of sending the query request of the service state to the third-party platform again, and returning the service state to the terminal as a final state.
In one embodiment, the program when executed by a processor implements the steps of: acquiring the current query times and query time interval of the service identifier; if the current query times exceed the preset times, utilizing the query time interval to perform linear increment or nonlinear increment to obtain the delay time corresponding to the next query of the service identifier; delay time is added to the service identification.
In one embodiment, the program when executed by a processor implements the steps of: sending a service operation request to a third-party platform, wherein the service operation request carries a service identifier, the service identifier corresponds to a plurality of services, and the step of adding corresponding delay time to the service identifier in a message queue comprises the following steps: acquiring the service quantity corresponding to the service identification and the time consumption for returning to the service state; calculating an active coefficient corresponding to the third-party platform by using the service quantity and the time consumption for returning to the service state; acquiring a current query time interval of a service identifier; calculating delay time corresponding to next query of the service identifier by using the active coefficient and the current query time interval; delay time is added to the service identification.
In one embodiment, the program when executed by a processor implements the steps of: acquiring the total amount of the service corresponding to the service identifier and the number of the services with the service state as an intermediate state; calculating a first factor by using the service quantity and the total service quantity of the service state which is an intermediate state; recording the sending time of the service operation request; acquiring the receiving time of the service condition; calculating the time consumption of returning to the service state by using the sending time and the receiving time, and calculating the average time consumption according to the average time consumption and the total service amount corresponding to the service identifier; acquiring a first factor according to the gradient range to which the average consumed time belongs; and calculating the active coefficient corresponding to the third-party platform by using the first factor and the second factor.
In one embodiment, a computer device is provided, as shown in fig. 4, comprising a processor, a non-volatile storage medium, an internal memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The nonvolatile storage medium of the computer device stores an operating system and a computer program, and the internal memory of the computer device provides an environment for the operating system and the computer program in the nonvolatile storage medium to run. The computer program is executed by a processor to implement a business state query method. The network interface of the terminal is used for communicating with an external network interface. The display screen of the terminal can be a touch screen, and the input device can be a touch layer covered on the display screen, and can also be a key, a track ball, a touch pad, an external keyboard, a touch pad or a mouse, and the like, which are set on the shell of the terminal. The computer equipment can be a computer, a mobile phone, a tablet computer and the like, and not only comprises a terminal, but also comprises a server. The structure shown in fig. 4 is a block diagram of only a part of the structure related to the scheme of the present invention, and does not constitute a limitation of the terminal to which the scheme of the present invention is applied, and a specific terminal may include more or less components than those shown in the figure, or combine some components, or have a different arrangement of components.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware that is related to instructions of a computer program, and the program can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for service status query, the method comprising:
acquiring a query instruction corresponding to a service identifier, and generating a query request of a service state corresponding to the service identifier by using the query instruction;
sending the query request to a third-party platform so that the third-party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state;
receiving a service state returned by the third-party platform according to the service identifier, and pushing the service identifier to a message queue when the service state is an intermediate state;
adding corresponding delay time to the service identifier in the message queue;
monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, and executing the step of sending a query request of the service state to the third-party platform again until the service state returned by the third-party platform is received as a final state;
the method further comprises the following steps:
sending a service operation request to the third-party platform, where the service operation request carries a service identifier, the service identifier corresponds to multiple services, and the step of adding a corresponding delay time to the service identifier in the message queue includes:
acquiring the service quantity corresponding to the service identification and the time consumption for returning to the service state;
calculating an active coefficient corresponding to the third-party platform by using the service quantity and the time consumption for returning to the service state;
acquiring the current query time interval of the service identifier;
calculating the delay time corresponding to the next query of the service identifier by using the active coefficient and the current query time interval;
and adding the delay time to the service identifier.
2. The method of claim 1, wherein the message queue comprises a first queue and a second queue, the method further comprising:
adding corresponding delay time to the service identifier in the first queue; sending the service identifier added with the delay time to a second queue;
monitoring the delay time added by the service identifier in the second queue, extracting the service identifier reaching the delay time, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state.
3. The method of claim 1, wherein the step of adding a corresponding delay time to the service identifier in the message queue comprises:
acquiring the current query times of the service identifier;
if the current query times exceed the preset times, utilizing the query times to perform linear increment or nonlinear increment to obtain the delay time corresponding to the next query of the service identifier;
and adding the delay time to the service identifier.
4. The method of claim 1, wherein the step of calculating the activity coefficient corresponding to the third-party platform using the number of services and the time consumed for returning to the service status comprises:
acquiring the total amount of the service corresponding to the service identifier and the service quantity of which the service state is the final state;
calculating a first factor by using the service quantity and the total service quantity of the service state which is the intermediate state;
recording the sending time of the service operation request; acquiring the receiving time of the service state;
calculating the consumed time for returning to the service state by using the sending time and the receiving time, and calculating the average consumed time according to the consumed time and the total service amount corresponding to the service identifier;
acquiring a second factor according to the gradient range to which the average consumed time belongs;
and calculating an active coefficient corresponding to the third-party platform by using the first factor and the second factor.
5. The method of claim 4, wherein the calculating the activity coefficient corresponding to the third-party platform using the first factor and the second factor comprises:
and calculating the product of the first factor and the second factor to obtain the active coefficient corresponding to the third-party platform.
6. A service status query device, the device comprising:
the generating module is used for acquiring a query instruction corresponding to a service identifier and generating a query request of a service state corresponding to the service identifier by using the query instruction;
the sending module is used for sending the query request to a third-party platform so that the third-party platform returns a corresponding service state according to the query request, wherein the service state comprises an intermediate state and a final state;
the receiving module is used for receiving the service state returned by the third-party platform according to the service identifier; when the service state returned by the third-party platform is an intermediate state, pushing the service identifier to a message queue;
a delay module, configured to add a corresponding delay time to the service identifier in the message queue;
the iteration module is used for monitoring the delay time added by the service identifier, extracting the service identifier reaching the delay time when the delay time is reached, and executing the step of sending the query request of the service state to the third-party platform again until the service state returned by the third-party platform is received and is the final state;
the delay module is further to: the delay module is further configured to obtain a service number corresponding to the service identifier and time consumed for returning to the service state, and calculate an activity coefficient corresponding to the third-party platform by using the service number and the time consumed for returning to the service state; acquiring the current query time interval of the service identifier; and calculating the delay time corresponding to the next query of the service identifier by using the active coefficient and the current query time interval.
7. The apparatus of claim 6, wherein the delay module is further configured to obtain a current number of queries of the service identifier; and if the current query times exceed the preset times, utilizing the query times to perform linear increment or nonlinear increment to obtain the delay time corresponding to the next query of the service identifier.
8. The apparatus according to claim 6, wherein the delay module is further configured to obtain a total amount of services corresponding to the service identifier and a number of services whose service states are final states; calculating a first factor by using the service quantity and the total service quantity of the service state which is the intermediate state; recording the sending time of the service operation request; acquiring the receiving time of the service state; calculating the consumed time for returning to the service state by using the sending time and the receiving time, and calculating the average consumed time according to the consumed time and the total service amount corresponding to the service identifier; acquiring a second factor according to the gradient range to which the average consumed time belongs; and calculating an active coefficient corresponding to the third-party platform by using the first factor and the second factor.
9. A computer device comprising a memory and a processor, and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the business state query method according to any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the service status query method according to any one of claims 1 to 5.
CN201710978140.XA 2017-10-18 2017-10-18 Service state query method and device, computer equipment and storage medium Expired - Fee Related CN107943828B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710978140.XA CN107943828B (en) 2017-10-18 2017-10-18 Service state query method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710978140.XA CN107943828B (en) 2017-10-18 2017-10-18 Service state query method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN107943828A CN107943828A (en) 2018-04-20
CN107943828B true CN107943828B (en) 2020-06-30

Family

ID=61936276

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710978140.XA Expired - Fee Related CN107943828B (en) 2017-10-18 2017-10-18 Service state query method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN107943828B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804545B (en) * 2018-05-18 2022-07-08 土巴兔集团股份有限公司 Distributed global unique ID generation method and device
CN109508366A (en) * 2018-10-09 2019-03-22 四川航天信息有限公司 Data query method and device
CN109634761A (en) * 2018-12-17 2019-04-16 深圳乐信软件技术有限公司 A kind of system mode circulation method, apparatus, computer equipment and storage medium
CN109787884B (en) * 2019-01-02 2021-03-12 中国联合网络通信集团有限公司 Message pushing method and device
CN109785069A (en) * 2019-01-22 2019-05-21 北京顺丰同城科技有限公司 A kind of order polling method and device
CN110109970B (en) * 2019-04-17 2021-11-16 奇安信科技集团股份有限公司 Data query processing method and device
CN110264232B (en) * 2019-04-30 2023-10-27 创新先进技术有限公司 Data processing method and device for delayed verification of ticket
CN110489444B (en) * 2019-08-22 2023-06-13 深圳前海环融联易信息科技服务有限公司 Asynchronous query method and device, computer equipment and storage medium
CN113010750B (en) * 2019-12-20 2023-04-28 深圳市帝迈生物技术有限公司 Query method and device for sample analyzer, sample analyzer and medium
CN114020464B (en) * 2021-11-05 2022-11-01 江苏安超云软件有限公司 Method, device and storage medium for dynamically processing virtualized resources

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106250451A (en) * 2016-07-27 2016-12-21 北京小米移动软件有限公司 Route information query method and device
CN106888135A (en) * 2015-12-15 2017-06-23 阿里巴巴集团控股有限公司 The querying method and device of a kind of task status

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4727715B2 (en) * 2008-12-12 2011-07-20 株式会社日立製作所 Stream data processing method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106888135A (en) * 2015-12-15 2017-06-23 阿里巴巴集团控股有限公司 The querying method and device of a kind of task status
CN106250451A (en) * 2016-07-27 2016-12-21 北京小米移动软件有限公司 Route information query method and device

Also Published As

Publication number Publication date
CN107943828A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN107943828B (en) Service state query method and device, computer equipment and storage medium
CN107832126B (en) Thread adjusting method and terminal thereof
CN109313642B (en) Bill information caching method, bill information query method and terminal equipment
CN110618867A (en) Method and device for predicting resource usage amount
CN110413610B (en) Method and system for improving export efficiency of business data report forms and database server
CN115421922A (en) Current limiting method, device, equipment, medium and product of distributed system
CN110321364B (en) Transaction data query method, device and terminal of credit card management system
CN112948081B (en) Method, device, equipment and storage medium for processing tasks in delayed mode
CN110909978A (en) Resource processing method, device, server and computer readable storage medium
CN113312553A (en) Method and device for determining user label
CN107786627B (en) Resource processing system and method
CN113992586B (en) Flow control method, flow control device, computer equipment and storage medium
CN113742389A (en) Service processing method and device
CN109785107B (en) Method for flexibly configuring fund duty ratio and related products
CN111414383B (en) Data request method, data processing system and computing device
CN110333949B (en) Search engine processing method, device, terminal and storage medium
CN114003571A (en) Data processing method and device, electronic equipment and storage medium
CN113436003A (en) Duration determination method, duration determination device, electronic device, medium, and program product
CN111026746A (en) Method and device for multi-channel data calling, computer equipment and storage medium
US10269056B2 (en) Request processing system, request processing method, program, and information storage medium
CN113761077B (en) Method and device for processing bill task
CN109829712B (en) Payment mode switching method and device, computer equipment and readable storage medium
CN117009058A (en) Data processing method, device, computer equipment and storage medium
CN111882118B (en) Decision making system and method
CN116796093A (en) Interface data setting method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200630

Termination date: 20201018