CN111340474A - Resource processing method, device and system based on distributed transaction - Google Patents

Resource processing method, device and system based on distributed transaction Download PDF

Info

Publication number
CN111340474A
CN111340474A CN202010411803.1A CN202010411803A CN111340474A CN 111340474 A CN111340474 A CN 111340474A CN 202010411803 A CN202010411803 A CN 202010411803A CN 111340474 A CN111340474 A CN 111340474A
Authority
CN
China
Prior art keywords
resource
execution
pledge
user
service
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.)
Pending
Application number
CN202010411803.1A
Other languages
Chinese (zh)
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.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information 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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202010411803.1A priority Critical patent/CN111340474A/en
Publication of CN111340474A publication Critical patent/CN111340474A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/403Solvency checks
    • G06Q20/4037Remote solvency checks
    • 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/22Payment schemes or models
    • G06Q20/24Credit schemes, i.e. "pay after"
    • 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/38Payment protocols; Details thereof
    • G06Q20/42Confirmation, e.g. check or permission by the legal debtor of payment
    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/03Credit; Loans; Processing thereof

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Computer Security & Cryptography (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The present specification provides a resource processing method, device and system based on distributed transactions, wherein the resource processing method based on distributed transactions includes: acquiring a resource pledge request submitted by a user; creating a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user; executing a pre-freezing operation of the out-of-service operation by calling a resource service, and executing a pre-quota operation of the quota operation by calling a credit service, and executing a first-stage execution on the distributed transaction; and performing second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit service after the first-stage execution.

Description

Resource processing method, device and system based on distributed transaction
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a resource processing method, device, and system based on distributed transactions.
Background
With the rapid development of internet technology, internet technology has become an indispensable part in daily life, and various services are emerging on the network, for example, in the process of transaction between a buyer and a seller, a transaction platform opens credit lines to the buyer, the buyer can use the credit lines to conduct transaction with the seller, but in the process of actual use, the opening of the credit lines is related to the credit of the buyer, so that in many cases, the buyer can trade a commodity with the seller, but the credit lines are insufficient and the transaction cannot be conducted.
Disclosure of Invention
In view of the above, the present specification provides a resource processing method based on distributed transaction, a resource processing apparatus based on distributed transaction, a resource processing system based on distributed transaction, a computing device and a computer readable storage medium.
In one aspect of the embodiments of the present specification, a resource processing method based on distributed transactions is provided, including:
acquiring a resource pledge request submitted by a user;
creating a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
executing a pre-freezing operation of the out-of-service operation by calling a resource service, and executing a pre-quota operation of the quota operation by calling a credit service, and executing a first-stage execution on the distributed transaction;
and performing second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit service after the first-stage execution.
Optionally, the performing, according to the execution message returned by the resource service and the credit granting service after the first-stage execution, the second-stage execution on the distributed transaction includes:
if the execution message returned by the resource service and/or the credit service is an execution failure message, calling the resource service to rollback the pre-freezing operation executed in the first stage, and/or calling the credit service to rollback the pre-quota operation executed in the first stage.
Optionally, the performing, according to the execution message returned by the resource service and the credit granting service after the first-stage execution, the second-stage execution on the distributed transaction includes:
and if the execution messages returned by the resource service and the credit service are successful execution messages, calling the resource service to submit the pre-freezing operation, and calling the credit service to submit the pre-quota-submitting operation.
Optionally, the rolling back the pre-freezing operation performed in the first stage includes: releasing the use permission of the resources which are subjected to the pre-freezing processing in the resource account;
and/or the presence of a gas in the gas,
the rolling back the pre-quota operation performed by the first stage comprises: and recovering the credit line of the user to a state before pre-quota processing.
Optionally, the submitting the pre-freezing operation includes: confirming the limitation of the use permission of the resources subjected to the pre-freezing processing in the resource account, and updating the confirmation result into a resource database;
and/or the presence of a gas in the gas,
the submitting the pre-quota operation comprises: and releasing the limitation of the use authority of the newly added credit line of the credit line, and updating the release processing result to the credit database.
Optionally, the pre-freezing operation includes:
judging whether the available amount of the available resources of the resource account of the user under the resource type is larger than or equal to the resource application amount or not according to the resource type and the resource application amount contained in the resource pledge request;
if so, pre-freezing the resources under the resource types in the resource account according to the resource application amount; the usage right of the frozen resource in the resource account after the pre-freezing process is limited;
generating an execution success message that the execution of the pre-freezing operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-freezing operation.
Optionally, the pre-quota operation includes:
checking whether the credit granting state of the user is abnormal or not based on the credit data of the user;
if so, carrying out pre-quota processing on the credit line of the user according to the application line carried in the resource pledge request; the use authority of the new credit line after the pre-quota processing is limited;
generating an execution success message that the execution of the pre-quota operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-quota operation.
Optionally, before the step of obtaining the resource pledge request submitted by the user is executed, the method includes:
receiving a resource pledge request submitted by the user;
reading and displaying account data of the resource account of the user based on the resource pledge request;
acquiring the resource type selected by the user based on the displayed account data and the submitted resource pledge amount;
and calculating a credit line corresponding to the resource pledge amount of the resource type according to the resource pledge amount and the credit conversion ratio corresponding to the resource type, and returning the credit line to the user.
Optionally, after performing the second-stage execution step on the distributed transaction according to the execution message returned by the resource service and the credit granting service after the first-stage execution, the method includes:
and sending a resource pledge success message that the execution of the resource pledge request is successful to the user, or sending a resource pledge failure message that the execution of the resource pledge request is failed to the user.
In a second aspect of the embodiments of the present specification, there is provided a resource processing apparatus based on distributed transactions, including:
the resource pledge request acquisition module is configured to acquire a resource pledge request submitted by a user;
a distributed transaction creation module configured to create a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
the operation execution module is configured to execute a pre-freezing operation of the out-of-quality operation by calling a resource service and execute a pre-quota operation of the quota operation by calling a credit service, and execute a first-stage execution on the distributed transaction;
and the second-stage execution module is configured to perform second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit granting service after the first-stage execution.
In a third aspect of the embodiments of the present specification, there is provided a resource processing system based on distributed transactions, including:
the system comprises a pledge processing unit, a resource service and a credit granting service;
the pledge processing unit is configured to obtain a resource pledge request submitted by a user and create a distributed transaction based on the resource pledge request; performing first-stage execution on the distributed transaction by sending a calling request to the resource service and the credit service, and generating an execution instruction for performing second-stage execution on the distributed transaction according to an execution message returned by the resource service and the credit service; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
the resource service is configured to execute a pre-freezing operation of the quality-yielding operation, return an execution message to the pledge processing unit, and receive and execute an execution instruction issued by the pledge processing unit;
and the credit granting service is configured to execute a pre-quota operation of the quota operation, return an execution message to the pledge processing unit, and receive and execute an execution instruction issued by the pledge processing unit.
Optionally, if the execution message is an execution failure message, the resource service receives and executes an execution instruction issued by the pledge processing unit, including: receiving and rolling back the pre-freezing operation executed in the first stage according to an execution instruction issued by the pledge processing unit;
the credit granting service receives and executes the execution instruction issued by the pledge processing unit, and the execution instruction comprises: and receiving and rolling back the pre-quota operation executed in the first stage according to an execution instruction issued by the pledge processing unit.
Optionally, if the execution message is a successful execution message, the resource service receives and executes an execution instruction issued by the pledge processing unit, including: receiving and submitting the pre-freezing operation according to an execution instruction issued by the pledge processing unit;
the credit granting service receives and executes the execution instruction issued by the pledge processing unit, and the execution instruction comprises: and receiving and submitting the pre-quota operation according to an execution instruction issued by the pledge processing unit.
Optionally, the rolling back the pre-freezing operation performed in the first stage includes: releasing the use permission of the resources which are subjected to the pre-freezing processing in the resource account;
and/or the presence of a gas in the gas,
the rolling back the pre-quota operation performed by the first stage comprises: and recovering the credit line of the user to a state before pre-quota processing.
Optionally, the submitting the pre-freezing operation includes: confirming the limitation of the use permission of the resources subjected to the pre-freezing processing in the resource account, and updating the confirmation result into a resource database;
and/or the presence of a gas in the gas,
the submitting the pre-quota operation comprises: and releasing the limitation of the use authority of the newly added credit line of the credit line, and updating the release processing result to the credit database.
Optionally, the pre-freezing operation includes:
judging whether the available amount of the available resources of the resource account of the user under the resource type is larger than or equal to the resource application amount or not according to the resource type and the resource application amount contained in the resource pledge request;
if so, pre-freezing the resources under the resource types in the resource account according to the resource application amount; the usage right of the frozen resource in the resource account after the pre-freezing process is limited;
generating an execution success message that the execution of the pre-freezing operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-freezing operation.
Optionally, the pre-quota operation includes:
checking whether the credit granting state of the user is abnormal or not based on the credit data of the user;
if so, carrying out pre-quota processing on the credit line of the user according to the application line carried in the resource pledge request; the use authority of the new credit line after the pre-quota processing is limited;
generating an execution success message that the execution of the pre-quota operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-quota operation.
Optionally, the resource processing system based on distributed transaction further includes a credit admission unit configured to:
receiving a resource pledge request submitted by the user;
reading and displaying account data of the resource account of the user based on the resource pledge request;
acquiring the resource type selected by the user based on the displayed account data and the submitted resource pledge amount;
and calculating a credit line corresponding to the resource pledge amount of the resource type according to the resource pledge amount and the credit conversion ratio corresponding to the resource type, and returning the credit line to the user.
Optionally, the resource processing system based on distributed transactions further includes:
and the message center is configured to send a resource pledge success message that the resource pledge request is successfully executed to the user, or send a resource pledge failure message that the resource pledge request is failed to be executed to the user.
In a fourth aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
acquiring a resource pledge request submitted by a user;
creating a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
executing a pre-freezing operation of the out-of-service operation by calling a resource service, and executing a pre-quota operation of the quota operation by calling a credit service, and executing a first-stage execution on the distributed transaction;
and performing second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit service after the first-stage execution.
In a fifth aspect of the embodiments of the present specification, a computer-readable storage medium is provided, which stores computer instructions that, when executed by a processor, implement the steps of the distributed transaction based resource processing method.
According to the resource processing method based on the distributed transaction, after a resource pledge request submitted by a user is obtained, the distributed transaction comprising two operations of a prime operation and a credit increase operation is created, the first-stage execution is carried out on the distributed transaction by calling a resource service and a credit granting service, the second-stage execution is carried out on the distributed transaction according to the execution message of the first stage returned by the resource service and the credit granting service, the prime operation and the credit increase operation can be synchronously executed by the two-stage execution of the distributed transaction, and therefore the synchronization of the resources and the credit granting of the user in the pledge processing process is guaranteed.
Drawings
Fig. 1 is a processing flow diagram of a resource processing method based on distributed transactions according to an embodiment of the present specification;
fig. 2 is a schematic diagram of a resource processing apparatus based on distributed transactions according to an embodiment of the present specification;
FIG. 3 is a block diagram of a resource processing system based on distributed transactions according to an embodiment of the present specification;
fig. 4 is a block diagram of a computing device according to an embodiment of the present disclosure.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein, as those skilled in the art will be able to make and use the present disclosure without departing from the spirit and scope of the present disclosure.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first can also be referred to as a second and, similarly, a second can also be referred to as a first without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
One embodiment of the present specification provides a resource processing method based on distributed transactions, a resource processing apparatus based on distributed transactions, a resource processing system based on distributed transactions, a computing device, and a computer-readable storage medium. The following detailed description and the explanation of the steps of the method are individually made with reference to the drawings of the embodiments provided in the present specification.
An embodiment of a resource processing method based on distributed transactions provided in this specification is as follows:
referring to fig. 1, it shows a flow chart of a distributed transaction-based resource processing method provided in this embodiment.
Step S102, a resource pledge request submitted by a user is obtained.
In practical application, in the transaction process of a user and a seller, the situation that the user performs transaction with the seller through a credit line is often existed, but the credit line of the user is insufficient, in order to promote the achievement of the transaction of the user and the seller and meet the transaction requirements of the user, the user can improve the credit line in a mode of 'pledge' of resources, and particularly in the process of quota improvement, the resources of the user need to be firstly frozen, and then the credit line of the user needs to be improved; correspondingly, in the process of releasing the pledge, the credit line of the user needs to be reduced firstly, then the frozen resource is released, and once the resource freezing and the credit line increasing processing are asynchronous or the credit line decreasing processing and the resource releasing processing are asynchronous, the situation that the resource of the user is frozen but not successfully increased or the situation that the resource of the user is decreased but not released may occur.
In the resource processing method based on the distributed transaction provided by this embodiment, in order to avoid increasing or decreasing the credit line of the user and asynchronous with the resource freezing or resource releasing, the distributed transaction is introduced, the increasing or decreasing of the credit line of the user and the resource freezing or resource releasing are used as atomic actions of the distributed transaction, and the execution synchronicity of the user and the resource is ensured by two-stage submission of the distributed transaction, so that the synchronicity of the user's resource and the credit in the process of the quality assurance is ensured.
The user in this embodiment refers to a personal user or an enterprise user who proposes to perform a pledge on resources to obtain an increase in the credit line. For example, the trading platform proposes a trading user who carries out a pledge on account funds to obtain an increased credit trading limit.
The resources refer to data resources, funds, stocks, insurance policies, bonds and the like in the user account. The credit line is a resource usage line which is credited to the user within a specified time limit according to factors such as credit information, income level and various asset values of the user, and the user has the right to dominate the resource within the usage line within the specified time limit. Although the user has the right to draw or use the resources in the credit line, the user needs to return the resources used in the credit line within a predetermined period after using the resources in the credit line. For example, according to the historical credit information, income level and various asset values of the user A, 4000 yuan of credit line is granted to the user A, and the user A can draw or use the 4000 yuan of the credit line, but the amount drawn or used in the credit line in the previous month needs to be refunded in a settlement period according to the monthly credit settlement period of the credit line.
The resource pledge request is a pledge processing request for pledge processing of the resource selected by the user, and the resource pledge request comprises the resource type of the resource to be pledged selected by the user and the resource application amount. For example, the resource type included in the resource pledge request submitted by the user is a fund type, and the resource application amount is 1000 yuan, that is, the user wants to pledge the 1000 yuan of fund in the fund account to increase the credit line.
In specific implementation, in order to improve the awareness degree of the user on the resource pledge and the credit line, in an optional implementation manner provided in this embodiment, before the resource pledge request submitted by the user is obtained, a resource custom selection and evaluation implementation is provided for the user, which is specifically implemented as follows:
receiving a resource pledge request submitted by the user;
reading and displaying account data of the resource account of the user based on the resource pledge request;
acquiring the resource type selected by the user based on the displayed account data and the submitted resource pledge amount;
and calculating a credit line corresponding to the resource pledge amount of the resource type according to the resource pledge amount and the credit conversion ratio corresponding to the resource type, and returning the credit line to the user. The credit transfer ratio is a ratio of the increase amount of the credit line determined according to the resource value of the pledged resource, for example, the credit transfer ratio of the fund type resource is 1:1, and the credit transfer ratio of the policy type resource is determined according to the premium or the premium.
For example, after receiving a resource pledge request submitted by a trading user a of a trading platform, according to a user ID of the trading user a included in the resource pledge request, reading a resource amount of each resource type resource in a resource account of the trading user a from a resource database of the trading platform and displaying the resource amount to the trading user a, and after displaying the resource amount of each resource type resource in the resource account of the trading user a, obtaining a resource type selected by the trading user a based on the displayed resource amount of each resource type resource and a submitted resource pledge amount, specifically, the resource type selected by the trading user a is a fund type, the submitted resource pledge amount is 5000 yuan, and a credit conversion ratio corresponding to the resource of the fund type is 1:1, that is: each pledge has 1 yuan of capital, and the promotion amount of the credit line is also 1 yuan; then sends and displays 5000 yuan of credit line calculated according to 5000 yuan of resource pledge amount and the credit conversion ratio of 1:1 to the trading user A.
And step S104, creating a distributed transaction based on the resource pledge request.
In this embodiment, the distributed transaction includes a resource freezing operation performed on the resource account of the user, and an increase operation performed on the credit line granted to the user.
Performing a quality-giving operation of resource freezing on the resource account of the user, namely performing authority limitation on resources in the resource account of the user, wherein the resources cannot be transferred or used by the user after being frozen; the frozen resources can restore the authority through unfreezing operation, and the user can normally transfer or use the resources after the authority is restored.
The operation of carrying out the quota increase on the credit line of the user refers to carrying out quota increase processing on the credit line of the user, and the user has the use and administration authority on the credit line increased after the quota increase processing.
It should be noted that the distributed transaction in this embodiment refers to a distributed transaction implemented based on a two-phase commit protocol, and the distributed transaction includes two atomic operations, namely a dequeue operation of performing resource freezing on a resource account of the user and an add operation of adding an amount to a credit line of the user. The execution of the distributed transaction comprises two phases, wherein the first phase is a pre-execution phase, and the execution of the second phase is carried out on the basis of the execution result of the first phase.
And step S106, executing the pre-freezing operation of the out-of-quality operation by calling a resource service, and executing the pre-quota operation of the quota operation by calling a credit service, and executing the first-stage execution on the distributed transaction.
The resource service in this embodiment is a service for providing a pledge for resources in a resource account of a user, where the user may apply for pledge for the resources in the resource account through the resource service, and in practical applications, the resource service may be set to be extensible according to a change of a resource type in the resource account of the user, so that the resource service may perform pledge management for the resources in the resource account according to the change of the resources in the resource account of the user.
The pre-freezing operation refers to pre-freezing the resource under the resource type in the resource account according to the resource application amount. The usage right of the frozen resource in the resource account after the pre-freezing process is limited. For example, if the resource type included in the resource pledge request submitted by the user is the fund type and the resource application amount is 1000 yuan, then the 1000 yuan resource in the resource account of the user is pre-frozen, that is, the use permission of the 1000 yuan resource account by the user is limited, and after the permission is limited, the user cannot transfer or use the 1000 yuan resource.
In order to improve the processing efficiency of the pre-freezing operation and avoid the situation that the available amount of the resource account of the user is insufficient in the execution process of the pre-freezing operation, in an optional implementation manner provided by this embodiment, the resource account of the user is detected before the execution of the pre-freezing operation, which is specifically implemented as follows:
judging whether the available amount of the available resources of the resource account of the user under the resource type is larger than or equal to the resource application amount or not according to the resource type and the resource application amount contained in the resource pledge request;
if so, pre-freezing the resources under the resource types in the resource account according to the resource application amount; the usage right of the frozen resource in the resource account after the pre-freezing process is limited; generating an execution success message that the execution of the pre-freezing operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-freezing operation.
For example, the resource type included in the resource pledge request submitted by the user is a fund type, the resource application amount is 1000 yuan, whether the fund amount of the available fund in the resource account of the user is greater than or equal to 1000 yuan is judged, if so, pre-freezing processing is performed on the 1000 yuan fund in the resource account of the user, namely, the use permission of the 1000 yuan in the resource account of the user is limited (after the permission is limited, the user cannot transfer or use the 1000 yuan); if the 1000-element pre-freezing processing in the resource account of the user is successful, generating an execution success message that the pre-freezing processing is successfully executed; and if the 1000-element pre-freezing processing in the resource account of the user fails, generating an execution failure message that the execution of the pre-freezing processing is successful.
The credit granting service in this embodiment refers to a service for managing the credit granting amount of the user, for example, a credit granting service for performing an increase, a decrease and an admission decision on the credit granting amount of the user. And the pre-quota-increasing operation refers to pre-quota-increasing processing on the credit line of the user according to the application line carried in the resource pledge request. And the use authority of the new credit line after the pre-quota processing is limited. For example, if the credit line of the user before the increase processing is 4000 yuan and the application line carried in the resource pledge request submitted by the user is 1000 yuan, the credit line of the user is increased from 4000 yuan to 5000 yuan, but the 1000-yuan new increase between 4000 yuan and 5000 yuan in the credit line of the user is limited in use authority, and the user cannot use the 1000-yuan new increase to perform transaction.
In order to improve the processing efficiency of the pre-freezing operation and avoid the situation that the available amount of the resource account of the user is insufficient in the execution process of the pre-freezing operation, in an optional implementation manner provided by this embodiment, the resource account of the user is detected before the execution of the pre-freezing operation, which is specifically implemented as follows:
checking whether the credit granting state of the user is abnormal or not based on the credit data of the user;
if so, carrying out pre-quota processing on the credit line of the user according to the application line carried in the resource pledge request; the use authority of the new credit line after the pre-quota processing is limited; generating an execution success message that the execution of the pre-quota operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-quota operation.
And step S108, performing second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit service after the first-stage execution.
After the resource service and the credit service are called to perform the first-stage execution on the distributed transaction according to the step S106, an execution strategy for performing the second-stage execution on the distributed transaction is determined according to the execution messages returned by the resource service and the credit service, and the second-stage execution is performed on the distributed transaction according to the determined execution strategy.
In an optional implementation manner provided in this embodiment, two atomic operations, namely a dequeue operation and a quota operation, included in the distributed transaction are executed as a whole, and according to an execution message of the dequeue operation returned by the resource service and an execution message of the quota operation returned by the credit granting service, second-stage execution of the distributed transaction is divided into two ways:
the first mode is as follows: if at least one of the execution message of the quality-out operation returned by the resource service and the execution message of the quota-increasing operation returned by the credit service is an execution failure message, it indicates that at least one of calling the resource service to perform the quality-out operation and calling the credit service to perform the quota-increasing operation fails to perform execution, calling the resource service to perform rollback on the pre-freezing operation performed in the first stage, and/or calling the credit service to perform rollback on the pre-quota-increasing operation performed in the first stage.
Wherein rolling back the pre-freeze operation performed in the first stage comprises: releasing the use permission of the resources which are subjected to the pre-freezing processing in the resource account;
rolling back the pre-quota operation performed in the first stage, comprising: and recovering the credit line of the user to a state before pre-quota processing.
For example, after the resource service is called to execute the pre-freezing operation, the 1000-yuan funds in the resource account of the user are successfully frozen, the execution message returned by the resource service after the pre-freezing operation is executed is an execution success message, and after the credit granting service is called to execute the quota improving operation, specifically in the process of improving the credit granting amount of the user from 4000 yuan to 5000 yuan, the execution message returned by the credit granting service after the pre-quota improving operation is an execution failure message, under the condition, the pre-freezing operation successfully executed by the resource service is rolled back, specifically, the use permission of the limited 1000-yuan funds in the resource account of the user is released;
or, after the resource service is called to execute the pre-freezing operation, the method comprises the following steps: in the process of freezing 1000 yuan of funds in a resource account of a user, an execution message returned by the resource service after prefreezing operation is an execution failure message, and after calling a credit granting service to execute a pre-rating operation, successfully rating the credit line of the user from 4000 yuan to 5000 yuan, and an execution message returned by the credit granting service after the pre-rating operation is an execution success message.
The second mode is as follows: if the execution message of the qualification operation returned by the resource service and the execution message of the quota operation returned by the credit service are both the execution success messages, the qualification operation carried out by calling the resource service and the quota operation carried out by calling the credit service are both successfully executed, the resource service is called to submit the pre-freezing operation, and the credit service is called to submit the quota operation.
Wherein submitting the pre-freeze operation comprises: confirming the limitation of the use permission of the resources subjected to the pre-freezing processing in the resource account, and updating the confirmation result into a resource database;
submitting the pre-quota operation, comprising: and releasing the limitation of the use authority of the newly added credit line of the credit line, and updating the release processing result to the credit database.
For example, after calling the resource service to execute the pre-freezing operation, the 1000 yuan funds in the resource account of the user are successfully frozen, the execution message returned after the resource service performs the pre-freezing operation is an execution success message, and after calling the credit granting service to execute the pre-quota operation, the credit granting quota of the user is successfully increased from 4000 yuan to 5000 yuan (the use authority of the 1000 yuan new quota between 4000 yuan and 5000 yuan in the credit granting quota is limited), the execution message returned by the credit granting service performing the pre-quota operation is also an execution success message, the freezing of the 1000 yuan funds in the resource account of the user is confirmed, the freezing result is updated to the resource database, the limit of the use authority of the 1000 yuan new quota in the credit granting quota of the user is removed, and the credit granting quota of the user is updated to 5000 yuan in the credit granting database.
As described above, for the resource pledge request submitted by the user, according to the execution result of the second-stage execution of the distributed transaction, if the second-stage execution of the distributed transaction is the rollback of the pre-freezing operation and/or the pre-quota operation executed in the first stage, a resource pledge failure message indicating that the execution of the resource pledge request fails is sent to the user; and if the execution of the second stage of the distributed transaction is confirmed and submitted to the pre-freezing operation and the pre-quota operation executed in the first stage, sending a successful resource pledge message of successful execution of the resource pledge request to the user.
The resource processing method based on the distributed transaction is further explained below by taking the application of the resource processing method based on the distributed transaction in the pledge scene as an example, and the resource processing method based on the distributed transaction applied to the pledge scene is specifically realized as follows:
1) acquiring a resource pledge request submitted by a user;
2) creating a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
3) executing a pre-freezing operation of the out-of-service operation by calling a resource service, and executing a pre-quota operation of the quota operation by calling a credit service, and executing a first-stage execution on the distributed transaction;
the credit line of the pre-quota increasing operation is obtained by calculation according to the resource pledge amount of the pre-freezing operation and the credit conversion ratio corresponding to the resource type;
4) if the execution message returned by the resource service and/or the credit service is an execution failure message, releasing the use permission of the resources subjected to pre-freezing processing in the resource account, and restoring the credit line of the user to the state before the pre-quota processing;
and if the execution messages returned by the resource service and the credit service are successful execution messages, confirming the pledge authority of the resources which are pre-frozen in the resource account, and confirming the use authority of the user to the newly added credit line of the credit line.
The distributed transaction also comprises a pledge monitoring operation, and the resource service is called to roll back the prefreezing operation and the credit service is called to roll back the pre-quota promoting operation under the condition that the change of the resource attribute of the prefrozen resource is monitored in the execution process of the pledge monitoring operation, namely: releasing the use permission of the resources subjected to the pre-freezing processing in the resource account, and recovering the credit line of the user to a state before the pre-quota processing;
or, when the resource attribute of the resource of which the pledge authority is confirmed is monitored to be changed (for example, the pledge policy is in danger, and the digital certificate or certificate of the pledge of the user is updated) in the pledge monitoring operation execution process, generating and executing a reverse transaction of the distributed transaction (namely, pledge canceling transaction), wherein the pledge canceling transaction comprises pledge canceling operation and de-rating operation; the operation of discharging the quality and the operation of releasing the pledge are reverse operations, and the operation of increasing the amount and the operation of decreasing the amount are reverse operations.
In addition, the distributed transaction also comprises a pledge monitoring operation, and whether pledge authority of the prefrozen resource is confirmed is judged under the condition that the resource attribute of the prefrozen resource is monitored to be changed in the execution process of the pledge monitoring operation; if yes, removing the affairs and executing the pledge corresponding to the distributed affairs; if not, calling the resource service to roll back the pre-freezing operation, and calling the credit service to roll back the pre-quota operation.
To sum up, the resource processing method based on distributed transactions provided in this specification creates a distributed transaction including two operations, namely, a qualification operation and a quota operation, after acquiring a resource pledge request submitted by a user, performs a first-stage execution on the distributed transaction by invoking a resource service and a credit granting service, performs a second-stage execution on the distributed transaction according to a first-stage execution message returned by the resource service and the credit granting service, and enables the qualification operation and the quota operation to be executed synchronously by performing the two stages of the distributed transaction, thereby ensuring that resources of the user and credit granting operation are kept synchronous in a pledge processing process.
An embodiment of a resource processing apparatus based on distributed transactions provided in this specification is as follows:
in the foregoing embodiment, a resource processing method based on distributed transactions is provided, and correspondingly, a resource processing apparatus based on distributed transactions is also provided, which is described below with reference to the accompanying drawings.
Referring to fig. 2, a schematic diagram of a resource processing apparatus based on distributed transactions according to the present embodiment is shown.
Since the device embodiments correspond to the method embodiments, the description is relatively simple, and the relevant portions may refer to the corresponding description of the method embodiments provided above. The device embodiments described below are merely illustrative.
This specification provides a resource processing apparatus based on distributed transactions, including:
a resource pledge request obtaining module 202 configured to obtain a resource pledge request submitted by a user;
a distributed transaction creation module 204 configured to create a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
an operation execution module 206, configured to perform a first-stage execution on the distributed transaction by invoking a resource service to perform a pre-freezing operation of the out-of-order operation and invoking a credit service to perform a pre-quota operation of the quota operation; the credit line of the pre-quota increasing operation is obtained by calculation according to the resource pledge amount of the pre-freezing operation and the credit conversion ratio corresponding to the resource type;
and the second-stage execution module 208 is configured to perform second-stage execution on the distributed transaction according to the execution message returned by the resource service and the credit granting service after the first-stage execution.
Optionally, the second stage executing module 208 includes:
and the first execution sub-module is configured to call the resource service to rollback the pre-freezing operation executed in the first stage and/or call the credit service to rollback the pre-quota operation executed in the first stage if the execution message returned by the resource service and/or the credit service is an execution failure message.
Optionally, the second stage executing module 208 includes:
and the second execution submodule is configured to call the resource service to submit the pre-freezing operation and call the credit service to submit the pre-quota operation if the execution messages returned by the resource service and the credit service are execution success messages.
Optionally, the rolling back the pre-freezing operation performed in the first stage includes: releasing the use permission of the resources which are subjected to the pre-freezing processing in the resource account;
and/or the presence of a gas in the gas,
the rolling back the pre-quota operation performed by the first stage comprises: and recovering the credit line of the user to a state before pre-quota processing.
Optionally, the submitting the pre-freezing operation includes: confirming the limitation of the use permission of the resources subjected to the pre-freezing processing in the resource account, and updating the confirmation result into a resource database;
and/or the presence of a gas in the gas,
the submitting the pre-quota operation comprises: releasing the limit of the use authority of the newly added credit line of the credit line, and updating the release processing result to the credit database; or confirming the pledge authority of the resources which are pre-frozen in the resource account, and confirming the use authority of the user to the new credit line of the credit line.
Optionally, the pre-freezing operation includes:
judging whether the available amount of the available resources of the resource account of the user under the resource type is larger than or equal to the resource application amount or not according to the resource type and the resource application amount contained in the resource pledge request;
if so, pre-freezing the resources under the resource types in the resource account according to the resource application amount; the usage right of the frozen resource in the resource account after the pre-freezing process is limited;
generating an execution success message that the execution of the pre-freezing operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-freezing operation.
Optionally, the pre-quota operation includes:
checking whether the credit granting state of the user is abnormal or not based on the credit data of the user;
if so, carrying out pre-quota processing on the credit line of the user according to the application line carried in the resource pledge request; the use authority of the new credit line after the pre-quota processing is limited;
generating an execution success message that the execution of the pre-quota operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-quota operation.
Optionally, the resource processing apparatus based on distributed transaction further includes:
the resource pledge request receiving module is configured to receive a resource pledge request submitted by the user;
the account data display module is configured to read and display account data of the resource account of the user based on the resource pledge request;
the resource information acquisition module is configured to acquire the resource types selected by the user based on the displayed account data and the submitted resource pledge amount;
and the credit transfer ratio calculation module is configured to calculate a credit line corresponding to the resource pledge amount of the resource type and return the credit line to the user according to the resource pledge amount and the credit transfer ratio corresponding to the resource type.
Optionally, the resource processing apparatus based on distributed transaction further includes:
and the message sending module is configured to send a resource pledge success message that the execution of the resource pledge request is successful to the user, or send a resource pledge failure message that the execution of the resource pledge request is failed to the user.
Optionally, the distributed transaction further includes a pledge monitoring operation, and when it is monitored in an execution process of the pledge monitoring operation that a resource attribute of the pre-frozen resource is changed, the resource service is called to roll back the pre-freezing operation, and the trust service is called to roll back the pre-quota operation, that is: releasing the use permission of the resources subjected to the pre-freezing processing in the resource account, and recovering the credit line of the user to a state before the pre-quota processing;
or, when the resource attribute of the resource of which the pledge authority is confirmed is monitored to be changed (for example, the pledge policy is in danger, and the digital certificate or certificate of the pledge of the user is updated) in the pledge monitoring operation execution process, generating and executing a reverse transaction of the distributed transaction (namely, pledge canceling transaction), wherein the pledge canceling transaction comprises pledge canceling operation and de-rating operation; the operation of discharging the quality and the operation of releasing the pledge are reverse operations, and the operation of increasing the amount and the operation of decreasing the amount are reverse operations.
In addition, the distributed transaction also comprises a pledge monitoring operation, and whether pledge authority of the prefrozen resource is confirmed is judged under the condition that the resource attribute of the prefrozen resource is monitored to be changed in the execution process of the pledge monitoring operation; if yes, removing the affairs and executing the pledge corresponding to the distributed affairs; if not, calling the resource service to roll back the pre-freezing operation, and calling the credit service to roll back the pre-quota operation.
An embodiment of a resource processing system based on distributed transactions provided in this specification is as follows:
in the foregoing embodiment, a resource processing method based on distributed transactions is provided, and in addition, a resource processing system based on distributed transactions is also provided, which is described below with reference to the accompanying drawings.
Referring to fig. 3, a block diagram of a resource processing system based on distributed transaction according to the present embodiment is shown.
For the relevant portions of the system embodiment, reference may be made to the corresponding descriptions of the method embodiments provided above. The system embodiments described below are merely illustrative.
The present specification provides a resource processing system based on distributed transactions, comprising:
a pledge processing unit 301, a resource service 302 and a trust service 303;
the pledge processing unit 301 is configured to obtain a resource pledge request submitted by a user, and create a distributed transaction based on the resource pledge request; performing first-stage execution on the distributed transaction by sending a calling request to the resource service 302 and the trust service 303, and generating an execution instruction for performing second-stage execution on the distributed transaction according to the execution messages returned by the resource service 302 and the trust service 303; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user; the credit line of the pre-quota increasing operation is obtained by calculation according to the resource pledge amount of the pre-freezing operation and the credit conversion ratio corresponding to the resource type;
the resource service 302 is configured to execute a pre-freezing operation of the demotion operation, return an execution message to the pledge processing unit 301, and receive and execute an execution instruction issued by the pledge processing unit 301;
the credit granting service 303 is configured to execute a pre-quota operation of the quota operation, return an execution message to the pledge processing unit 301, and receive and execute an execution instruction issued by the pledge processing unit 301.
Optionally, if the execution message is an execution failure message, the resource service 302 receives and executes the execution instruction issued by the pledge processing unit 301, where the execution instruction includes: receiving and rolling back the pre-freezing operation executed in the first stage according to the execution instruction issued by the pledge processing unit 301;
the credit granting service receives and executes the execution instruction issued by the pledge processing unit 301, including: and receiving and rolling back the pre-quota operation executed in the first stage according to the execution instruction issued by the pledge processing unit 301.
Optionally, if the execution message is a successful execution message, the resource service 302 receives and executes the execution instruction issued by the pledge processing unit 301, where the execution instruction includes: receiving and submitting the pre-freezing operation according to an execution instruction issued by the pledge processing unit 301;
the credit granting service 303 receives and executes the execution instruction issued by the pledge processing unit 301, including: and receiving and submitting the pre-quota operation according to the execution instruction issued by the pledge processing unit 301.
Optionally, the rolling back the pre-freezing operation performed in the first stage includes: releasing the use permission of the resources which are subjected to the pre-freezing processing in the resource account;
and/or the presence of a gas in the gas,
the rolling back the pre-quota operation performed by the first stage comprises: and recovering the credit line of the user to a state before pre-quota processing.
Optionally, the submitting the pre-freezing operation includes: confirming the limitation of the use permission of the resources subjected to the pre-freezing processing in the resource account, and updating the confirmation result into a resource database 304;
and/or the presence of a gas in the gas,
the submitting the pre-quota operation comprises: the restriction on the use authority of the new credit line is released, and the release processing result is updated to the credit database 305.
Optionally, the pre-freezing operation includes:
judging whether the available amount of the available resources of the resource account of the user under the resource type is larger than or equal to the resource application amount or not according to the resource type and the resource application amount contained in the resource pledge request;
if so, pre-freezing the resources under the resource types in the resource account according to the resource application amount; the usage right of the frozen resource in the resource account after the pre-freezing process is limited;
generating an execution success message that the execution of the pre-freezing operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-freezing operation.
Optionally, the pre-quota operation includes:
checking whether the credit granting state of the user is abnormal or not based on the credit data of the user;
if so, carrying out pre-quota processing on the credit line of the user according to the application line carried in the resource pledge request; the use authority of the new credit line after the pre-quota processing is limited;
generating an execution success message that the execution of the pre-quota operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-quota operation.
Optionally, the resource processing system based on distributed transaction further includes a credit admission unit 306, configured to:
receiving a resource pledge request submitted by the user;
reading and displaying account data of the resource account of the user based on the resource pledge request;
acquiring the resource type selected by the user based on the displayed account data and the submitted resource pledge amount;
and calculating a credit line corresponding to the resource pledge amount of the resource type according to the resource pledge amount and the credit conversion ratio corresponding to the resource type, and returning the credit line to the user.
Optionally, the resource processing system based on distributed transactions further includes:
and the message center 307 is configured to send a resource pledge success message indicating that the execution of the resource pledge request is successful to the user, or send a resource pledge failure message indicating that the execution of the resource pledge request is failed to the user.
Optionally, the distributed transaction further includes a pledge monitoring operation, and in a case that it is monitored in an execution process of the pledge monitoring operation that a resource attribute of the pre-frozen resource is changed, the resource service 302 is called to rollback the pre-freezing operation, and the trust service 303 is called to rollback the pre-quota operation, that is: releasing the use permission of the resources subjected to the pre-freezing processing in the resource account, and recovering the credit line of the user to a state before the pre-quota processing;
or, when the resource attribute of the resource of which the pledge authority is confirmed is monitored to be changed (for example, the pledge policy is in danger, and the digital certificate or certificate of the pledge of the user is updated) in the pledge monitoring operation execution process, generating and executing a reverse transaction of the distributed transaction (namely, pledge canceling transaction), wherein the pledge canceling transaction comprises pledge canceling operation and de-rating operation; the operation of discharging the quality and the operation of releasing the pledge are reverse operations, and the operation of increasing the amount and the operation of decreasing the amount are reverse operations.
In addition, the distributed transaction also comprises a pledge monitoring operation, and whether pledge authority of the prefrozen resource is confirmed is judged under the condition that the resource attribute of the prefrozen resource is monitored to be changed in the execution process of the pledge monitoring operation; if yes, removing the affairs and executing the pledge corresponding to the distributed affairs; if not, calling the resource service 302 to roll back the pre-freezing operation, and calling the trust service 303 to roll back the pre-quota operation.
The present specification provides an embodiment of a computing device as follows:
FIG. 4 is a block diagram illustrating a configuration of a computing device 400 provided according to one embodiment of the present description. The components of the computing device 400 include, but are not limited to, a memory 410 and a processor 420. Processor 420 is coupled to memory 410 via bus 430 and database 450 is used to store data.
Computing device 400 also includes access device 440, access device 440 enabling computing device 400 to communicate via one or more networks 460. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 440 may include one or more of any type of network interface (e.g., a Network Interface Card (NIC)) whether wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 400, as well as other components not shown in FIG. 4, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 4 is for purposes of example only and is not limiting as to the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 400 may also be a mobile or stationary server.
The present specification provides a computing device comprising a memory 410, a processor 420, and computer instructions stored on the memory and executable on the processor, the processor 420 being configured to execute the following computer-executable instructions:
acquiring a resource pledge request submitted by a user;
creating a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
executing a pre-freezing operation of the out-of-service operation by calling a resource service, and executing a pre-quota operation of the quota operation by calling a credit service, and executing a first-stage execution on the distributed transaction;
and performing second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit service after the first-stage execution.
Optionally, the performing, according to the execution message returned by the resource service and the credit granting service after the first-stage execution, the second-stage execution on the distributed transaction includes:
if the execution message returned by the resource service and/or the credit service is an execution failure message, calling the resource service to rollback the pre-freezing operation executed in the first stage, and/or calling the credit service to rollback the pre-quota operation executed in the first stage.
Optionally, the performing, according to the execution message returned by the resource service and the credit granting service after the first-stage execution, the second-stage execution on the distributed transaction includes:
and if the execution messages returned by the resource service and the credit service are successful execution messages, calling the resource service to submit the pre-freezing operation, and calling the credit service to submit the pre-quota-submitting operation.
Optionally, the rolling back the pre-freezing operation performed in the first stage includes: releasing the use permission of the resources which are subjected to the pre-freezing processing in the resource account;
and/or the presence of a gas in the gas,
the rolling back the pre-quota operation performed by the first stage comprises: and recovering the credit line of the user to a state before pre-quota processing.
Optionally, the submitting the pre-freezing operation includes: confirming the limitation of the use permission of the resources subjected to the pre-freezing processing in the resource account, and updating the confirmation result into a resource database;
and/or the presence of a gas in the gas,
the submitting the pre-quota operation comprises: and releasing the limitation of the use authority of the newly added credit line of the credit line, and updating the release processing result to the credit database.
Optionally, the pre-freezing operation includes:
judging whether the available amount of the available resources of the resource account of the user under the resource type is larger than or equal to the resource application amount or not according to the resource type and the resource application amount contained in the resource pledge request;
if so, pre-freezing the resources under the resource types in the resource account according to the resource application amount; the usage right of the frozen resource in the resource account after the pre-freezing process is limited;
generating an execution success message that the execution of the pre-freezing operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-freezing operation.
Optionally, the pre-quota operation includes:
checking whether the credit granting state of the user is abnormal or not based on the credit data of the user;
if so, carrying out pre-quota processing on the credit line of the user according to the application line carried in the resource pledge request; the use authority of the new credit line after the pre-quota processing is limited;
generating an execution success message that the execution of the pre-quota operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-quota operation.
Optionally, before the obtaining the resource pledge request command submitted by the user is executed, the processor 420 is further configured to execute the following computer-executable instructions:
receiving a resource pledge request submitted by the user;
reading and displaying account data of the resource account of the user based on the resource pledge request;
acquiring the resource type selected by the user based on the displayed account data and the submitted resource pledge amount;
and calculating a credit line corresponding to the resource pledge amount of the resource type according to the resource pledge amount and the credit conversion ratio corresponding to the resource type, and returning the credit line to the user.
Optionally, after performing the second-stage execution instruction on the distributed transaction according to the execution message returned by the resource service and the credit granting service after the first-stage execution, the processor 420 is further configured to execute the following computer-executable instruction:
and sending a resource pledge success message that the execution of the resource pledge request is successful to the user, or sending a resource pledge failure message that the execution of the resource pledge request is failed to the user.
This specification provides one example of a computer-readable storage medium, comprising:
one embodiment of the present specification provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the distributed transaction-based resource processing method.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the resource processing method based on the distributed transaction, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the resource processing method based on the distributed transaction.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts, but those skilled in the art should understand that the present embodiment is not limited by the described acts, because some steps may be performed in other sequences or simultaneously according to the present embodiment. Further, those skilled in the art should also appreciate that the embodiments described in this specification are preferred embodiments and that acts and modules referred to are not necessarily required for an embodiment of the specification.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are intended only to aid in the description of the specification. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the embodiments. The specification is limited only by the claims and their full scope and equivalents.

Claims (21)

1. A resource processing method based on distributed transaction comprises the following steps:
acquiring a resource pledge request submitted by a user;
creating a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
executing a pre-freezing operation of the out-of-service operation by calling a resource service, and executing a pre-quota operation of the quota operation by calling a credit service, and executing a first-stage execution on the distributed transaction;
and performing second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit service after the first-stage execution.
2. The resource processing method based on the distributed transaction according to claim 1, wherein the performing the second-stage execution on the distributed transaction according to the execution message returned by the resource service and the credit granting service after the first-stage execution comprises:
if the execution message returned by the resource service and/or the credit service is an execution failure message, calling the resource service to rollback the pre-freezing operation executed in the first stage, and/or calling the credit service to rollback the pre-quota operation executed in the first stage.
3. The resource processing method based on the distributed transaction according to claim 1, wherein the performing the second-stage execution on the distributed transaction according to the execution message returned by the resource service and the credit granting service after the first-stage execution comprises:
and if the execution messages returned by the resource service and the credit service are successful execution messages, calling the resource service to submit the pre-freezing operation, and calling the credit service to submit the pre-quota-submitting operation.
4. The distributed transaction-based resource processing method of claim 2, wherein said rolling back the pre-freeze operation performed in the first phase comprises: releasing the use permission of the resources which are subjected to the pre-freezing processing in the resource account;
and/or the presence of a gas in the gas,
the rolling back the pre-quota operation performed by the first stage comprises: and recovering the credit line of the user to a state before pre-quota processing.
5. The distributed transaction based resource processing method of claim 3, said committing said pre-freeze operation comprising: confirming the limitation of the use permission of the resources subjected to the pre-freezing processing in the resource account, and updating the confirmation result into a resource database;
and/or the presence of a gas in the gas,
the submitting the pre-quota operation comprises: and releasing the limitation of the use authority of the newly added credit line of the credit line, and updating the release processing result to the credit database.
6. The distributed transaction based resource processing method of claim 1, the pre-freeze operation comprising:
judging whether the available amount of the available resources of the resource account of the user under the resource type is larger than or equal to the resource application amount or not according to the resource type and the resource application amount contained in the resource pledge request;
if so, pre-freezing the resources under the resource types in the resource account according to the resource application amount; the usage right of the frozen resource in the resource account after the pre-freezing process is limited;
generating an execution success message that the execution of the pre-freezing operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-freezing operation.
7. The distributed transaction based resource processing method of claim 1, the pre-quota operation comprising:
checking whether the credit granting state of the user is abnormal or not based on the credit data of the user;
if so, carrying out pre-quota processing on the credit line of the user according to the application line carried in the resource pledge request; the use authority of the new credit line after the pre-quota processing is limited;
generating an execution success message that the execution of the pre-quota operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-quota operation.
8. The resource processing method based on distributed transaction according to claim 1, wherein before the step of obtaining the resource pledge request submitted by the user is executed, the method comprises:
receiving a resource pledge request submitted by the user;
reading and displaying account data of the resource account of the user based on the resource pledge request;
acquiring the resource type selected by the user based on the displayed account data and the submitted resource pledge amount;
and calculating a credit line corresponding to the resource pledge amount of the resource type according to the resource pledge amount and the credit conversion ratio corresponding to the resource type, and returning the credit line to the user.
9. The resource processing method based on distributed transactions according to claim 8, wherein after performing the second-stage execution step on the distributed transactions according to the execution messages returned by the resource service and the credit granting service after the first-stage execution, the method includes:
and sending a resource pledge success message that the execution of the resource pledge request is successful to the user, or sending a resource pledge failure message that the execution of the resource pledge request is failed to the user.
10. A resource processing apparatus based on distributed transactions, comprising:
the resource pledge request acquisition module is configured to acquire a resource pledge request submitted by a user;
a distributed transaction creation module configured to create a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
the operation execution module is configured to execute a pre-freezing operation of the out-of-quality operation by calling a resource service and execute a pre-quota operation of the quota operation by calling a credit service, and execute a first-stage execution on the distributed transaction;
and the second-stage execution module is configured to perform second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit granting service after the first-stage execution.
11. A distributed transaction based resource processing system comprising:
the system comprises a pledge processing unit, a resource service and a credit granting service;
the pledge processing unit is configured to obtain a resource pledge request submitted by a user and create a distributed transaction based on the resource pledge request; performing first-stage execution on the distributed transaction by sending a calling request to the resource service and the credit service, and generating an execution instruction for performing second-stage execution on the distributed transaction according to an execution message returned by the resource service and the credit service; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
the resource service is configured to execute a pre-freezing operation of the quality-yielding operation, return an execution message to the pledge processing unit, and receive and execute an execution instruction issued by the pledge processing unit;
and the credit granting service is configured to execute a pre-quota operation of the quota operation, return an execution message to the pledge processing unit, and receive and execute an execution instruction issued by the pledge processing unit.
12. The resource processing system based on distributed transaction according to claim 11, wherein if the execution message is an execution failure message, the resource service receives and executes the execution instruction issued by the pledge processing unit, including: receiving and rolling back the pre-freezing operation executed in the first stage according to an execution instruction issued by the pledge processing unit;
the credit granting service receives and executes the execution instruction issued by the pledge processing unit, and the execution instruction comprises: and receiving and rolling back the pre-quota operation executed in the first stage according to an execution instruction issued by the pledge processing unit.
13. The resource processing system based on distributed transaction according to claim 11, wherein if the execution message is a successful execution message, the resource service receives and executes the execution instruction issued by the pledge processing unit, including: receiving and submitting the pre-freezing operation according to an execution instruction issued by the pledge processing unit;
the credit granting service receives and executes the execution instruction issued by the pledge processing unit, and the execution instruction comprises: and receiving and submitting the pre-quota operation according to an execution instruction issued by the pledge processing unit.
14. The distributed transaction based resource processing system of claim 12, said rolling back the pre-freeze operation performed by the first stage, comprising: releasing the use permission of the resources which are subjected to the pre-freezing processing in the resource account;
and/or the presence of a gas in the gas,
the rolling back the pre-quota operation performed by the first stage comprises: and recovering the credit line of the user to a state before pre-quota processing.
15. The distributed transaction based resource processing system of claim 13, said committing said pre-freeze operation comprising: confirming the limitation of the use permission of the resources subjected to the pre-freezing processing in the resource account, and updating the confirmation result into a resource database;
and/or the presence of a gas in the gas,
the submitting the pre-quota operation comprises: and releasing the limitation of the use authority of the newly added credit line of the credit line, and updating the release processing result to the credit database.
16. The distributed transaction based resource processing system of claim 11, the pre-freeze operation comprising:
judging whether the available amount of the available resources of the resource account of the user under the resource type is larger than or equal to the resource application amount or not according to the resource type and the resource application amount contained in the resource pledge request;
if so, pre-freezing the resources under the resource types in the resource account according to the resource application amount; the usage right of the frozen resource in the resource account after the pre-freezing process is limited;
generating an execution success message that the execution of the pre-freezing operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-freezing operation.
17. The distributed transaction based resource processing system of claim 11, the pre-quota operation comprising:
checking whether the credit granting state of the user is abnormal or not based on the credit data of the user;
if so, carrying out pre-quota processing on the credit line of the user according to the application line carried in the resource pledge request; the use authority of the new credit line after the pre-quota processing is limited;
generating an execution success message that the execution of the pre-quota operation is successful;
and if not, generating an execution failure message of the execution failure of the pre-quota operation.
18. The distributed transaction based resource processing system of claim 11, further comprising a credit admission unit configured to:
receiving a resource pledge request submitted by the user;
reading and displaying account data of the resource account of the user based on the resource pledge request;
acquiring the resource type selected by the user based on the displayed account data and the submitted resource pledge amount;
and calculating a credit line corresponding to the resource pledge amount of the resource type according to the resource pledge amount and the credit conversion ratio corresponding to the resource type, and returning the credit line to the user.
19. The distributed transaction based resource processing system of claim 18, further comprising:
and the message center is configured to send a resource pledge success message that the resource pledge request is successfully executed to the user, or send a resource pledge failure message that the resource pledge request is failed to be executed to the user.
20. A computing device, comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
acquiring a resource pledge request submitted by a user;
creating a distributed transaction based on the resource pledge request; the distributed transaction comprises the operation of resource freezing for the resource account of the user and the operation of quota increasing for the credit line of the user;
executing a pre-freezing operation of the out-of-service operation by calling a resource service, and executing a pre-quota operation of the quota operation by calling a credit service, and executing a first-stage execution on the distributed transaction;
and performing second-stage execution on the distributed transaction according to the execution messages returned by the resource service and the credit service after the first-stage execution.
21. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the distributed transaction based resource processing method of any one of claims 1 to 9.
CN202010411803.1A 2020-05-15 2020-05-15 Resource processing method, device and system based on distributed transaction Pending CN111340474A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010411803.1A CN111340474A (en) 2020-05-15 2020-05-15 Resource processing method, device and system based on distributed transaction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010411803.1A CN111340474A (en) 2020-05-15 2020-05-15 Resource processing method, device and system based on distributed transaction

Publications (1)

Publication Number Publication Date
CN111340474A true CN111340474A (en) 2020-06-26

Family

ID=71182946

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010411803.1A Pending CN111340474A (en) 2020-05-15 2020-05-15 Resource processing method, device and system based on distributed transaction

Country Status (1)

Country Link
CN (1) CN111340474A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112884382A (en) * 2021-04-14 2021-06-01 北京百度网讯科技有限公司 Resource quota management method, device, equipment and storage medium of cloud platform
CN113065967A (en) * 2021-05-18 2021-07-02 中国农业银行股份有限公司 Multi-mode service processing method, device and equipment
CN113888309A (en) * 2021-10-09 2022-01-04 支付宝(杭州)信息技术有限公司 Credit-based data processing method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1560772A (en) * 2004-02-24 2005-01-05 杭州东信北邮信息技术有限公司 Petty paying method and system based on intelligent network
CN106372933A (en) * 2015-07-21 2017-02-01 深圳市银信网银科技有限公司 Electronic certificate arrangement method, and data interaction processing method, apparatus and system
CN108762895A (en) * 2018-05-17 2018-11-06 阿里巴巴集团控股有限公司 Handle the method and device of distributed transaction
CN110298644A (en) * 2019-05-27 2019-10-01 阿里巴巴集团控股有限公司 Account recovery method, apparatus, server and readable storage medium storing program for executing
KR20190124384A (en) * 2018-04-26 2019-11-05 김태구 Credit offering based credit dealing method and credit dealing apparatus
CN110675246A (en) * 2019-09-06 2020-01-10 阿里巴巴集团控股有限公司 Credit limit management method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1560772A (en) * 2004-02-24 2005-01-05 杭州东信北邮信息技术有限公司 Petty paying method and system based on intelligent network
CN106372933A (en) * 2015-07-21 2017-02-01 深圳市银信网银科技有限公司 Electronic certificate arrangement method, and data interaction processing method, apparatus and system
KR20190124384A (en) * 2018-04-26 2019-11-05 김태구 Credit offering based credit dealing method and credit dealing apparatus
CN108762895A (en) * 2018-05-17 2018-11-06 阿里巴巴集团控股有限公司 Handle the method and device of distributed transaction
CN110298644A (en) * 2019-05-27 2019-10-01 阿里巴巴集团控股有限公司 Account recovery method, apparatus, server and readable storage medium storing program for executing
CN110675246A (en) * 2019-09-06 2020-01-10 阿里巴巴集团控股有限公司 Credit limit management method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
庄鹏: "阿里巴巴B2B金融账户中心的设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112884382A (en) * 2021-04-14 2021-06-01 北京百度网讯科技有限公司 Resource quota management method, device, equipment and storage medium of cloud platform
CN112884382B (en) * 2021-04-14 2023-07-25 北京百度网讯科技有限公司 Resource quota management method, device and equipment of cloud platform and storage medium
CN113065967A (en) * 2021-05-18 2021-07-02 中国农业银行股份有限公司 Multi-mode service processing method, device and equipment
CN113888309A (en) * 2021-10-09 2022-01-04 支付宝(杭州)信息技术有限公司 Credit-based data processing method and device

Similar Documents

Publication Publication Date Title
US10963400B2 (en) Smart contract creation and monitoring for event identification in a blockchain
US11443324B1 (en) Systems and method for providing card account controls and purchase impact information
CN111340474A (en) Resource processing method, device and system based on distributed transaction
CN113222752A (en) Data processing system, method, computing device and storage medium based on block chain
WO2020154154A1 (en) Blockchain-based service processing system and method, computing device, and storage medium
JP2013037441A (en) Purchase fee settlement method for used cell phone, purchase fee settlement device for used cell phone, purchase fee settlement program for used cell phone, and recording medium for recording the program
CN111178899A (en) Resource processing method and device and transaction processing method and device
US20240281802A1 (en) Digital Currency-Based Payment Method, Platform and System, and Terminal
CN109146488A (en) Assets match method, assets match system, equipment and storage medium
CN113159913A (en) Accounting information processing method and device
CN111242604A (en) Data processing method and device
CN111127189A (en) Fluidity prediction system, method and device
CN111951066A (en) System, method and device for performing synthesis batch processing on order and electronic equipment
CN112990871A (en) Document processing method and related equipment
CN110782310B (en) Method, device and system for asynchronously acquiring user attribute information from third-party platform
US20150193870A1 (en) Generating electronic documents (edocs) for transactions
WO2020063180A1 (en) Transaction processing method and device, electronic device and computer-readable storage medium
CN113487322B (en) Data processing method and system
CN112950355B (en) Transaction data processing method and device
CN113657817A (en) Transaction processing method and device, electronic equipment and readable storage medium
CN110675246A (en) Credit limit management method and device
CN114255127A (en) Accounting consistency processing method and device for distributed system
CN113204395A (en) Service processing method and device
CN110008283B (en) Data processing method and device based on data tag
CN111160916A (en) Risk transaction identification method and device

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200626