CN111611075B - Virtual resource request processing method and device, electronic equipment and storage medium - Google Patents

Virtual resource request processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111611075B
CN111611075B CN202010424539.5A CN202010424539A CN111611075B CN 111611075 B CN111611075 B CN 111611075B CN 202010424539 A CN202010424539 A CN 202010424539A CN 111611075 B CN111611075 B CN 111611075B
Authority
CN
China
Prior art keywords
virtual resource
value
configuration information
server
allocation
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.)
Active
Application number
CN202010424539.5A
Other languages
Chinese (zh)
Other versions
CN111611075A (en
Inventor
潘朋飞
刘正阳
张吉凯
楼小帆
於林涛
冯世浩
苏杨
沈冠初
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet 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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202010424539.5A priority Critical patent/CN111611075B/en
Publication of CN111611075A publication Critical patent/CN111611075A/en
Application granted granted Critical
Publication of CN111611075B publication Critical patent/CN111611075B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The method obtains a user identifier in a request instruction and a resource identifier of the requested virtual resource, and obtains configuration information corresponding to the virtual resource, so as to calculate an allocation value of the virtual resource according to the configuration information and the user identifier, and further display the virtual resource corresponding to the allocation value and corresponding prompt information. According to the method and the device, the request instruction is processed locally by the client, the allocation value of the virtual resource is calculated for the user initiating the request instruction according to the configuration information of the requested virtual resource, and the allocation value is displayed, so that the problem that service is unavailable due to the fact that the request instruction is sent to the server in a high concurrency mode in the prior art is avoided, and the service performance is greatly improved.

Description

Virtual resource request processing method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of computer networks, and in particular relates to a virtual resource request processing method, a device, electronic equipment and a storage medium.
Background
With the development of computer network technology, various internet Applications (APP) have been increasingly used to request virtual resources (e.g., red packets) in the internet through APP.
In the related art, when a user requests a virtual resource in the internet through an APP, the APP generally sends the corresponding request to a server for processing, for example, the server verifies the request, allocates the corresponding virtual resource to the user after the verification is legal, and displays the allocated virtual new source to the user through the APP.
However, under the condition of high concurrency and occurrence of a large number of requests, due to high instantaneous flow and high peak value, the server may be down due to overlarge pressure, so that the service is not available, and the APP cannot interact with the server at all.
Disclosure of Invention
The disclosure provides a virtual resource request processing method, a device, an electronic device and a storage medium, so as to at least solve the problem that service is unavailable due to overlarge pressure of a service end in the related art. The technical scheme of the present disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided a virtual resource request processing method, including:
Responding to a request instruction of the virtual resource, and acquiring a user identifier in the request instruction and a resource identifier of the requested virtual resource;
acquiring configuration information corresponding to a virtual resource, wherein the virtual resource, a resource identifier and the configuration information have a corresponding relation, and the configuration information is a configuration parameter which is stored in the client in advance and corresponds to the virtual resource;
calculating the allocation value of the virtual resource according to the configuration information and the user identification;
and displaying the virtual resource corresponding to the assigned value and the corresponding prompt information.
In one embodiment, after displaying the virtual resource corresponding to the allocation value and the corresponding hint information, the method further includes: receiving an acquisition instruction of the displayed virtual resource; the data reporting interface is called according to the acquisition instruction, the distribution value is used for indicating the server to verify the acquisition instruction of the virtual resource, when the distribution value is consistent with the distribution value calculated by the server, the server verifies the acquisition instruction of the virtual resource and distributes the distribution value to the user account corresponding to the user identifier, and when the distribution value is inconsistent with the distribution value calculated by the server, the server does not verify the acquisition instruction of the virtual resource and does not distribute the distribution value to the user account corresponding to the user identifier; if the verification result is that the verification of the acquisition instruction of the virtual resource is passed, the display information which is returned by the display server and distributes the distribution value to the user account corresponding to the user identifier; if the verification result is that the verification of the acquisition instruction of the virtual resource fails, the acquisition instruction of the virtual resource returned by the display server is display information of an illegal instruction. .
In one embodiment, before reporting the allocation value to the server, the method further comprises: performing first encryption processing on the distribution value to obtain an encrypted distribution value; reporting the assigned value to the server, including: and reporting the distribution value after encryption processing to a server.
In one embodiment, the configuration information includes a random key corresponding to a resource identification of the virtual resource, an upper value of the virtual resource, and a lower value of the virtual resource; calculating the allocation value of the virtual resource according to the configuration information and the user identification, including: performing second encryption processing on the random key and the user identifier to obtain an encrypted character string; calculating a difference between an upper limit value of the virtual resource and a lower limit value of the virtual resource; performing modular operation on the encrypted character string and the difference value to obtain a module of dividing the encrypted character string by the difference value, wherein the module is the offset of the virtual resource; and determining the sum of the offset of the virtual resource and the lower limit value of the virtual resource as an allocation value of the virtual resource.
In one embodiment, the second encryption processing is performed on the random key and the user identifier to obtain an encrypted string, including: performing exclusive OR processing on the random key and the user identifier to obtain a processed value; and carrying out hash operation on the processed value by adopting cyclic redundancy check to obtain the encrypted character string.
In one embodiment, the request instruction of the virtual resource includes an identifier that whether to obtain configuration information corresponding to the virtual resource locally; after responding to the request instruction for the virtual resource, the method further comprises: if the identification is that the configuration information corresponding to the virtual resource is acquired locally, acquiring the configuration information corresponding to the virtual resource in the request instruction locally; and if the identification is that the configuration information corresponding to the virtual resource is not acquired locally, transmitting a request instruction to the server, wherein the request instruction is used for indicating the server to acquire the configuration information corresponding to the virtual resource in the request instruction.
According to a second aspect of embodiments of the present disclosure, there is provided a virtual resource request verification method, the method including:
receiving a first allocation value of the virtual resource corresponding to the user identifier, wherein the first allocation value is obtained after the client calculates according to a request instruction of the virtual resource, and the request instruction comprises the user identifier and the resource identifier of the requested virtual resource;
acquiring configuration information corresponding to a virtual resource, wherein the virtual resource, a resource identifier and the configuration information have a corresponding relation, and the configuration information is a configuration parameter corresponding to the virtual resource;
Calculating a second allocation value of the virtual resource according to the configuration information and the user identification;
if the second allocation value is the same as the first allocation value, allocating the second allocation value to a client account corresponding to the user identifier; and returning corresponding display information to the client.
In one embodiment, after assigning the second allocation value to the client account corresponding to the user identification, the method further comprises: and updating the total remaining value of the virtual resources of the client account according to the allocated second allocation value.
In one embodiment, after calculating the second allocation value of the virtual resource, the method further comprises: if the second allocation value is different from the first allocation value, determining that the client account corresponding to the user identifier is an illegal user, and freezing the operation of the client account.
In one embodiment, the first allocation value is the first allocation value after the first encryption process is performed; after receiving the first assigned value of the virtual resource corresponding to the user identifier, which is reported by the client, the method further comprises: and decrypting the first distribution value after the first encryption processing by adopting a decryption processing method corresponding to the first encryption processing to obtain the decrypted first distribution value.
In one embodiment, the configuration information includes a random key corresponding to a resource identification of the virtual resource, an upper value of the virtual resource, and a lower value of the virtual resource; calculating a second allocation value of the virtual resource according to the configuration information and the user identification, including: performing second encryption processing on the random key and the user identifier to obtain an encrypted character string; calculating a difference between an upper limit value of the virtual resource and a lower limit value of the virtual resource; performing modular operation on the encrypted character string and the difference value to obtain a module of dividing the encrypted character string by the difference value, wherein the module is the offset of the virtual resource; and determining the sum of the offset of the virtual resource and the lower limit value of the virtual resource as a second allocation value of the virtual resource.
In one embodiment, the second encryption processing is performed on the random key and the user identifier to obtain an encrypted string, including: performing exclusive OR processing on the random key and the user identifier to obtain a processed value; and carrying out hash operation on the processed value by adopting cyclic redundancy check to obtain an encrypted character string.
According to a third aspect of the embodiments of the present disclosure, there is provided a virtual resource request processing apparatus, including:
the information acquisition module is configured to execute a request instruction for responding to the virtual resource and acquire a user identifier in the request instruction and a resource identifier of the requested virtual resource;
The configuration information determining module is configured to acquire configuration information corresponding to the virtual resource, wherein the virtual resource, the resource identifier and the configuration information have a corresponding relation, and the configuration information is a configuration parameter which is stored in the client in advance and corresponds to the virtual resource;
the computing module is configured to execute computing of the allocation value of the virtual resource according to the configuration information and the user identification;
and the display module is configured to display the virtual resources corresponding to the assigned values and the corresponding prompt information.
In one embodiment, the apparatus further comprises: the instruction receiving module is configured to execute and receive an acquisition instruction of the displayed virtual resource; the reporting module is configured to execute calling of a data reporting interface according to the acquisition instruction, report an allocation value to the server, wherein the allocation value is used for indicating the server to verify the acquisition instruction of the virtual resource, when the allocation value is consistent with the allocation value calculated by the server, the server verifies the acquisition instruction of the virtual resource and distributes the allocation value to a user account corresponding to the user identifier, and when the allocation value is inconsistent with the allocation value calculated by the server, the server does not verify the acquisition instruction of the virtual resource and does not distribute the allocation value to the user account corresponding to the user identifier; the display module is configured to execute display information which is returned by the display server and is used for distributing the distribution value to the user account corresponding to the user identifier when the verification result shows that the acquisition instruction of the virtual resource passes the verification; if the verification result is that the verification of the acquisition instruction of the virtual resource fails, the acquisition instruction of the virtual resource returned by the display server is display information of an illegal instruction.
In one embodiment, the apparatus further comprises: the encryption module is configured to execute first encryption processing on the distribution value to obtain an encrypted distribution value; the reporting module is configured to perform: and reporting the distribution value after the encryption processing to a server.
In one embodiment, the configuration information includes a random key corresponding to a resource identification of the virtual resource, an upper value of the virtual resource, and a lower value of the virtual resource; the calculation module includes: an encryption processing unit configured to perform a second encryption process on the random key and the user identifier to obtain an encrypted character string; a difference value calculation unit configured to perform calculation of a difference value between an upper limit value of the virtual resource and a lower limit value of the virtual resource; the offset computing unit is configured to perform modular operation on the encrypted character string and the difference value to obtain a module of dividing the encrypted character string by the difference value, wherein the module is the offset of the virtual resource; and an allocation value calculation unit configured to perform determination of a sum of the offset of the virtual resource and the lower limit value of the virtual resource as an allocation value of the virtual resource.
In one embodiment, the encryption processing unit includes: an exclusive-or processing subunit configured to perform exclusive-or processing on the random key and the user identifier, to obtain a processed value; and the hash operation subunit is configured to perform hash operation on the processed value by adopting cyclic redundancy check to obtain an encrypted character string.
In one embodiment, the request instruction of the virtual resource includes an identifier that whether to obtain configuration information corresponding to the virtual resource locally; the apparatus further comprises: the identifier identifying module is configured to execute the local acquisition of the configuration information corresponding to the virtual resource in the request instruction if the identifier is identified as the configuration information corresponding to the virtual resource acquired locally; and if the identification is that the configuration information corresponding to the virtual resource is not acquired locally, transmitting a request instruction to the server, wherein the request instruction is used for indicating the server to acquire the configuration information corresponding to the virtual resource in the request instruction.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a virtual resource request verification apparatus, including:
the receiving module is configured to execute receiving a first distribution value of the virtual resource corresponding to the user identifier, which is reported by the client, wherein the first distribution value is obtained after the client calculates according to a request instruction of the virtual resource, and the request instruction comprises the user identifier and the resource identifier of the requested virtual resource;
the configuration information acquisition module is configured to perform acquisition of configuration information corresponding to the virtual resource, wherein the virtual resource, the resource identifier and the configuration information have a corresponding relation, and the configuration information is a configuration parameter corresponding to the virtual resource;
A calculation module configured to perform calculating a second allocation value of the virtual resource according to the configuration information and the user identification;
the allocation module is configured to execute allocation of the second allocation value to the client account corresponding to the user identifier if the second allocation value is the same as the first allocation value;
and the return module is configured to return the corresponding presentation information to the client.
In one embodiment, the apparatus further comprises an update module configured to perform: and updating the total remaining value of the virtual resources of the client account according to the allocated second allocation value.
In one embodiment, the apparatus further comprises a freezing module configured to perform: if the second allocation value is different from the first allocation value, determining that the client account corresponding to the user identifier is an illegal user, and freezing the operation of the client account.
In one embodiment, the first allocation value is the first allocation value after the first encryption process is performed; the apparatus further includes a decryption module configured to perform: and decrypting the first distribution value after the first encryption processing by adopting a decryption processing method corresponding to the first encryption processing to obtain the decrypted first distribution value.
In one embodiment, the configuration information includes a random key corresponding to a resource identification of the virtual resource, an upper value of the virtual resource, and a lower value of the virtual resource; the calculation module includes: an encryption processing unit configured to perform a second encryption process on the random key and the user identifier to obtain an encrypted character string; a difference value calculation unit configured to perform calculation of a difference value between an upper limit value of the virtual resource and a lower limit value of the virtual resource; the offset computing unit is configured to perform modular operation on the encrypted character string and the difference value to obtain a module of dividing the encrypted character string by the difference value, wherein the module is the offset of the virtual resource; and a second allocation value calculation unit configured to perform determination of a sum of the offset of the virtual resource and the lower limit value of the virtual resource as a second allocation value of the virtual resource.
In one embodiment, the encryption processing unit includes: an exclusive-or processing subunit configured to perform exclusive-or processing on the random key and the user identifier, to obtain a processed value; and the hash operation subunit is configured to perform hash operation on the processed value by adopting cyclic redundancy check to obtain an encrypted character string.
According to a fifth aspect of embodiments of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to cause the electronic device to perform the virtual resource request processing method as described in any of the embodiments of the first aspect.
According to a sixth aspect of embodiments of the present disclosure, there is provided a server comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions such that the server performs the virtual resource request verification method as described in any one of the embodiments of the second aspect.
According to a seventh aspect of embodiments of the present disclosure, there is provided a storage medium, which when executed by a processor of an electronic device or a server, enables the electronic device or the server to perform the virtual resource request processing method described in any one of the embodiments of the first aspect or to perform the virtual resource request verification method described in any one of the embodiments of the second aspect.
According to an eighth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program stored in a readable storage medium, from which at least one processor of a device reads and executes the computer program, such that the device performs the virtual resource request processing method as described in any of the embodiments of the first aspect or performs the virtual resource request verification method as described in any of the embodiments of the second aspect.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects: the method comprises the steps of responding to a request instruction of a virtual resource, obtaining a user identification in the request instruction and a resource identification of the requested virtual resource, and obtaining configuration information corresponding to the virtual resource, so that an allocation value of the virtual resource is calculated according to the configuration information and the user identification, and further displaying the virtual resource corresponding to the allocation value and corresponding prompt information. According to the method and the device, the request instruction is processed locally by the client, the allocation value of the virtual resource is calculated for the user initiating the request instruction according to the configuration information of the requested virtual resource, and the allocation value is displayed, so that the problem that service is unavailable due to the fact that the request instruction is sent to the server in a high concurrency mode in the prior art is avoided, and the service performance is greatly improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 is an application environment diagram illustrating a virtual resource request processing method according to an exemplary embodiment.
FIG. 2 is a flowchart illustrating a method of virtual resource request processing, according to an example embodiment.
FIG. 3 is a flowchart illustrating another virtual resource request processing method according to an example embodiment.
FIG. 4 is a schematic diagram illustrating steps for calculating assigned values of virtual resources, according to an example embodiment.
FIG. 5 is a flowchart illustrating a method of virtual resource request validation, according to an example embodiment.
FIG. 6 is a schematic diagram illustrating steps for calculating a second allocation value of a virtual resource, according to an example embodiment.
Fig. 7 is a schematic diagram illustrating interactions in a redbag scenario in accordance with an example embodiment.
Fig. 8 is a block diagram illustrating a virtual resource request processing apparatus according to an example embodiment.
Fig. 9 is a block diagram illustrating a virtual resource request verification apparatus according to an exemplary embodiment.
Fig. 10 is an internal structural diagram of an electronic device, which is shown according to an exemplary embodiment.
Fig. 11 is an internal structural diagram of a server according to an exemplary embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
The virtual resource request processing method provided by the disclosure can be applied to an application environment as shown in fig. 1. The terminal 110 interacts with the server 120 through a network, and specifically, the terminal 110 may be, but not limited to, various personal computers, notebook computers, smartphones, tablet computers and portable wearable devices, and the server 120 may be implemented by a separate server or a server cluster formed by a plurality of servers.
In this embodiment, the terminal 110 is provided with a client terminal with an application program, where the application program may be any one of a shopping APP, a short video APP, a live APP, a video playing APP, and a social application APP. The server 120 is a background server corresponding to a client of the application program. The terminal 110 may request a virtual resource (e.g., a red packet) in a client of the installed application program, and the client responds to a request instruction of the terminal 110 for the virtual resource, and obtains a user identifier in the request instruction and a resource identifier of the requested virtual resource to determine configuration information corresponding to the resource identifier of the virtual resource, further calculate an allocation value of the virtual resource according to the configuration information and the user identifier, and display the virtual resource corresponding to the allocation value and corresponding prompt information; when the client receives the instruction for acquiring the displayed virtual resource from the terminal 110, the server 120 reports the allocation value of the virtual resource corresponding to the user identifier, the server 120 recalculates the allocation value in a mode agreed with the client, and verifies the allocation value sent by the client according to the recalculated allocation value, further processes according to the verification result, and returns the verification result to the client of the terminal 110.
Fig. 2 is a flowchart illustrating a virtual resource request processing method according to an exemplary embodiment, and as shown in fig. 2, the method is applied to a client of the terminal in fig. 1, for example, and includes the following steps.
In step S210, in response to a request instruction for a virtual resource, a user identification in the request instruction and a resource identification of the requested virtual resource are acquired.
Wherein the request instruction is an indication or command to request a virtual resource from the client. The user identifier refers to a unique identity of the user initiating the request instruction, and may be, for example, an account number used by the user to log in to the client. The resource identifier is a unique identifier corresponding to the requested virtual resource, that is, different virtual resources correspond to different resource identifiers, for example, the resource identifier may be a serial number automatically generated when the virtual resource is generated, or an ID (Identity document, identity number) allocated to the virtual resource according to a certain rule. In this embodiment, when a user wants to obtain a virtual resource in a client, the user clicks an entry corresponding to the virtual resource in the client to initiate a request instruction for the virtual resource to the client, and the client responds to the request instruction for the virtual resource and obtains, based on the request instruction, a user identifier corresponding to the user initiating the request instruction and a resource identifier of the requested virtual resource.
In step S220, configuration information corresponding to the virtual resource is acquired.
The virtual resource, the resource identifier and the configuration information have a corresponding relationship, and the virtual resource and the configuration information can be generally associated through the resource identifier. The configuration information is a configuration parameter set for the virtual resource in advance, and the configuration parameter is stored locally at the client, and the configuration parameters set for different virtual resources can be different, so that the configuration information can be mapped through the resource identifier of the virtual resource when the configuration information is set. In this embodiment, after the resource identifier of the requested virtual resource is obtained through the above steps, the configuration information having a mapping relationship with the resource identifier of the requested virtual resource may be obtained.
In step S230, an allocation value of the virtual resource is calculated according to the configuration information and the user identification.
Wherein the allocation value is a partial value in the requested virtual resource for allocation to the user initiating the request instruction. Specifically, the configuration information may include a preset calculation rule, and in this embodiment, the client calculates, according to the configuration information of the requested virtual resource and the user identifier, an allocation value of the virtual resource corresponding to the user identifier by using the preset calculation rule.
In step S240, virtual resources corresponding to the allocation values and corresponding hint information are displayed.
The prompt information includes information for prompting the user initiating the request instruction, where the virtual resource corresponding to the allocation value may delay allocation, and of course, the prompt information may include other information according to actual situations, which is not limited in this embodiment. Specifically, the client displays the calculated allocation value of the virtual resource corresponding to the user identifier, and displays corresponding prompt information to prompt the user initiating the request instruction.
According to the virtual resource request processing method, the user identification in the request instruction and the resource identification of the requested virtual resource are obtained in response to the request instruction of the virtual resource, and the configuration information corresponding to the virtual resource is obtained, so that the allocation value of the virtual resource is calculated according to the configuration information and the user identification, and the virtual resource corresponding to the allocation value and the corresponding prompt information are displayed. According to the method and the device, the request instruction is processed locally by the client, the allocation value of the virtual resource is calculated for the user initiating the request instruction according to the configuration information of the requested virtual resource, and the allocation value is displayed, so that the problem that service is unavailable due to the fact that the request instruction is sent to the server in a high concurrency mode in the prior art is avoided, and the service performance is greatly improved.
In an exemplary embodiment, as shown in fig. 3, after displaying the virtual resource corresponding to the allocation value and the corresponding hint information in step S240, the method for processing a virtual resource request further includes the following steps:
in step S250, an acquisition instruction for the exposed virtual resource is received.
The acquiring instruction is an instruction or command sent by the user through the terminal to acquire the virtual resource, for example, the instruction may be to click on the virtual resource displayed in the client to send the instruction to acquire the virtual resource to the client.
In step S260, the data reporting interface is called according to the acquisition instruction, and the allocation value is reported to the server.
The data reporting interface is an interface for outputting data to the data connecting line when the client transmits the data to the server. The allocation value is used for indicating the server to verify the acquisition instruction of the virtual resource. In this embodiment, after the client receives the acquisition instruction of the displayed virtual resource, a corresponding data reporting interface is called to report the locally calculated allocation value to the server, and the server checks the acquisition instruction of the virtual resource according to the reported allocation value, namely, checks whether the acquisition instruction of the virtual resource is valid or not. Specifically, when the reported allocation value is consistent with the allocation value calculated by the server, the acquisition instruction of the virtual resource is considered to be effective, so that the server checks the acquisition instruction of the virtual resource, and allocates the allocation value to the user account corresponding to the user identifier; when the reported allocation value is inconsistent with the allocation value calculated by the server, the corresponding client is possibly tampered maliciously, so that the acquisition instruction of the virtual resource is considered to be invalid, and therefore, the server does not pass the verification of the acquisition instruction of the virtual resource and does not allocate the allocation value to the user account corresponding to the user identifier.
In step S270, the receiving server returns the display information according to the verification result.
The verification result comprises a result that the verification of the acquisition instruction of the virtual resource is passed and a result that the verification is not passed, if the verification result is that the verification of the acquisition instruction of the virtual resource is passed, the display server returns display information which is returned by the display server and distributes an assigned value to a user account corresponding to the user identifier, and if the display information is displayed that the assigned value is in charge, the display information indicates that the virtual resource is successfully acquired; if the verification result is that the verification of the acquisition instruction of the virtual resource fails, the acquisition instruction of the virtual resource returned by the display server is display information of an illegal instruction, such as displaying an illegal instruction, an illegal user and the like, namely, indicating that the acquisition instruction of the virtual resource is invalid or indicating that a corresponding client is maliciously tampered and identified as the illegal user.
In the above embodiment, the client side receives the acquisition instruction of the displayed virtual resource, and invokes the data reporting interface according to the acquisition instruction, so as to report the allocation value to the server, so that the server can verify the acquisition instruction of the virtual resource according to the reported allocation value, and receive the display information returned by the server according to the verification result, thereby improving the security of the service.
In an exemplary embodiment, before reporting the allocation value to the server, the client may further perform a first encryption process on the allocation value to obtain an encrypted allocation value, where the first encryption process changes original information data by using a specific algorithm, so that an unauthorized user cannot know the content of the information even if the encrypted information is obtained by not knowing the decryption method. In the present embodiment, the algorithm employed by the first encryption process includes, but is not limited to, a symmetric encryption process. Therefore, the client can report the distribution value after encryption processing to the server so as to improve the security of data transmission.
In an exemplary embodiment, the configuration information includes a random key corresponding to a resource identification of the virtual resource, an upper limit value of the virtual resource, and a lower limit value of the virtual resource. Wherein the random key may be a random seed, which is a key value generated by a specified random number generation algorithm. The upper limit value of the virtual resource is the highest value that can be allocated in the virtual resource, and the lower limit value of the virtual resource is the lowest value that can be allocated in the virtual resource.
As shown in fig. 4, in step S230, the allocation value of the virtual resource is calculated according to the configuration information and the user identifier, which may be specifically implemented by the following steps:
In step S231, a second encryption process is performed on the random key and the user identifier, to obtain an encrypted string.
The second encryption processing is to change the original information data by a special algorithm, so that even if an unauthorized user obtains the encrypted information, the unauthorized user still cannot know the content of the information because of not knowing the decryption method. In the present embodiment, the second encryption process includes, but is not limited to, one or more of symmetric encryption, exclusive-or processing, hash operation, and the like. For example, the second encryption process may be performed on the random key and the user identifier, specifically, the random key and the user identifier are subjected to an exclusive-or process to obtain an exclusive-or processed value, and then a cyclic redundancy check (A cyclic redundancy check, abbreviated as CRC 32) is used to perform a hash operation on the exclusive-or processed value, so as to obtain an encrypted string.
In step S232, a difference between the upper limit value of the virtual resource and the lower limit value of the virtual resource is calculated.
Specifically, according to the upper limit value of the virtual resource and the lower limit value of the virtual resource in the configuration information, the upper limit value of the virtual resource is subtracted from the lower limit value of the virtual resource by adopting mathematical operation, and a difference value between the upper limit value and the lower limit value of the virtual resource is obtained.
In step S233, the modulus of the difference is obtained by performing a modulus operation on the encrypted string and the difference.
Specifically, the encryption string obtained in step S231 is used to perform a modulo operation on the difference value obtained in step S232, so as to obtain a modulus of dividing the encryption string by the difference value, where in this embodiment, the obtained modulus represents the offset of the virtual resource. Since the user identification is used in the calculation, the offset is related to the user corresponding to the user identification.
In step S234, the sum of the offset amount of the virtual resource and the lower limit value of the virtual resource is determined as the allocation value of the virtual resource.
In the above embodiment, the client calculates the allocation value of the virtual resource for the requesting user through the configuration information of the virtual resource, so as to process the request instruction of the user locally, thereby greatly relieving the pressure of the server and avoiding the problem that the service is not available due to the high concurrent request.
In an exemplary embodiment, the request instruction of the virtual resource includes an identifier that whether to obtain the configuration information corresponding to the virtual resource locally, and specifically, when the identifier is that the configuration information corresponding to the virtual resource is obtained locally, it indicates that the request instruction of the virtual resource can be processed locally at the client, so that, after responding to the request instruction of the virtual resource, the client can obtain the configuration information corresponding to the virtual resource in the request instruction locally, so as to facilitate local processing; when the identifier is that the configuration information corresponding to the virtual resource is not acquired locally, the request instruction of the virtual resource cannot be processed locally at the client, and the request instruction of the virtual resource needs to be processed through the server.
In the above embodiment, by identifying whether the identifier of the configuration information corresponding to the virtual resource is locally acquired in the request instruction of the virtual resource, the client may determine whether to process the request instruction or in what manner to process the request instruction according to the identified identifier, thereby greatly improving flexibility of service.
Fig. 5 is a flowchart illustrating a virtual resource request verification method according to an exemplary embodiment, and as shown in fig. 5, the method is applied to the server in fig. 1, for example, and includes the following steps.
In step S510, a first allocation value of a virtual resource corresponding to a user identifier, which is reported by a client, is received.
The first allocation value is obtained after the client calculates according to a request instruction of the virtual resource, and the request instruction comprises a user identifier and a resource identifier of the requested virtual resource. Specifically, when a user wants to acquire a virtual resource in a client, the user clicks an entry corresponding to the virtual resource in the client to initiate a request instruction for the virtual resource to the client, the client responds to the request instruction for the virtual resource, acquires a user identifier corresponding to the user initiating the request instruction and a resource identifier of the requested virtual resource based on the request instruction, calculates and displays a first allocation value of the virtual resource corresponding to the user identifier by adopting a method shown in fig. 2, wherein the first allocation value is a value of the virtual resource allocated to the user initiating the request instruction, and when the user initiates the acquisition instruction according to the virtual resource displayed by the client, the client invokes a data reporting interface to report the first allocation value of the virtual resource corresponding to the user identifier to a server, and the server receives the first allocation value and verifies the first allocation value through subsequent steps.
In step S520, configuration information corresponding to the virtual resource is acquired.
The configuration information is a configuration parameter set for the virtual resource in advance, and for different virtual resources, the set configuration parameters can be different, so that mapping can be performed through the resource identifier of the virtual resource when the configuration information is set, and a corresponding mapping relation is formed among the virtual resource, the resource identifier and the configuration information. In this embodiment, the server obtains, according to the resource identifier of the virtual resource, configuration information having a mapping relationship with the resource identifier. It should be noted that, the configuration information may be stored locally in the server in advance, or may be shared by a separate configuration server to the server, which is not limited in this embodiment.
In step S530, a second allocation value of the virtual resource is calculated according to the configuration information and the user identification.
The second distribution value is calculated by the server by adopting the same calculation rule as the client, and is used for checking the first distribution value calculated by the client, namely checking whether the first distribution value calculated by the client is valid or not, so that the loss of the client caused by malicious tampering is avoided.
In step S540, if the second allocation value is the same as the first allocation value, the second allocation value is allocated to the client account corresponding to the user identifier.
Specifically, the server checks the first allocation value calculated by the client according to the locally calculated second allocation value, and in this embodiment, if the second allocation value is the same as the first allocation value, the verification passes, so that the second allocation value is allocated to the client account corresponding to the user identifier.
In step S550, the corresponding presentation information is returned to the client.
Specifically, after the second allocation value is allocated to the client account corresponding to the user identifier, the server may further return corresponding display information to the client, where the display information is used to instruct the client to display specific display content. In this embodiment, the presentation information may be information that has assigned an assigned value to a user account to which the user identification corresponds.
According to the virtual resource request verification method, the first distribution value of the virtual resource corresponding to the user identifier, which is reported by the client, is received, the second distribution value of the virtual resource corresponding to the user identifier is calculated by adopting the same calculation rule as the client, and the first distribution value calculated by the client is verified according to the second distribution value calculated locally, when the first distribution value and the second distribution value are the same, the second distribution value is distributed to the client account corresponding to the user identifier, and corresponding display information is returned to the client, so that the problem that service is not available due to the fact that a request instruction is sent to a server in a high concurrency mode in the prior art is avoided, and service performance and safety are greatly improved.
In an exemplary embodiment, after assigning the second allocation value to the client account corresponding to the user identifier, the virtual resource request verification method of the present application further includes: and updating the total residual value of the virtual resources of the client account according to the allocated second allocation value. Specifically, if the second allocation value is the same as the first allocation value, verification is indicated to pass, so that the server allocates the second allocation value to the client account corresponding to the user identifier, and updates the total remaining value of the total virtual resource corresponding to the client according to the allocated second allocation value, thereby realizing service completion under the condition that the server is decoupled from the client, and ensuring the security of the service.
In an exemplary embodiment, after the server calculates the second allocation value of the virtual resource, the virtual resource request verification method of the present application further includes: if the second allocation value is different from the first allocation value, determining that the client account corresponding to the user identifier is an illegal user, and freezing the operation of the client account. Specifically, if the second allocation value is different from the first allocation value, the risk of malicious tampering of the corresponding client is indicated, so that the client account corresponding to the user identifier is determined to be an illegal user, and all operations of the client account are frozen, namely, service is not provided for the client account.
In an exemplary embodiment, the first distribution value is a first distribution value after the first encryption processing, that is, the first distribution value received by the server is encrypted information after the first encryption processing is performed by the client, so in this embodiment, when the server receives the first distribution value after the first encryption processing, the server decrypts the first distribution value after the first encryption processing by using a decryption processing method corresponding to the first encryption processing, thereby obtaining a decrypted first distribution value. The embodiment encrypts the first distribution value and then transmits the encrypted first distribution value, so that the safety of data transmission is improved.
In an exemplary embodiment, the configuration information includes a random key corresponding to a resource identification of the virtual resource, an upper limit value of the virtual resource, and a lower limit value of the virtual resource. Wherein the random key may be a random seed, which is a key value generated by a specified random number generation algorithm. The upper limit value of the virtual resource is the highest value that can be allocated in the virtual resource, and the lower limit value of the virtual resource is the lowest value that can be allocated in the virtual resource.
As shown in fig. 6, in step S530, the second allocation value of the virtual resource is calculated according to the configuration information and the user identifier, which may be specifically implemented by the following steps:
In step S531, the random key and the user identifier are subjected to a second encryption process, and an encrypted character string is obtained.
The second encryption processing is to change the original information data by a special algorithm, so that even if an unauthorized user obtains the encrypted information, the unauthorized user still cannot know the content of the information because of not knowing the decryption method. In the present embodiment, the second encryption process includes, but is not limited to, one or more of symmetric encryption, exclusive-or processing, hash operation, and the like. For example, the second encryption process may be performed on the random key and the user identifier, specifically, the random key and the user identifier are subjected to an exclusive-or process to obtain an exclusive-or processed value, and then a cyclic redundancy check (A cyclic redundancy check, abbreviated as CRC 32) is used to perform a hash operation on the exclusive-or processed value, so as to obtain an encrypted string.
In step S532, a difference between the upper limit value of the virtual resource and the lower limit value of the virtual resource is calculated.
Specifically, according to the upper limit value of the virtual resource and the lower limit value of the virtual resource in the configuration information, the upper limit value of the virtual resource is subtracted from the lower limit value of the virtual resource by adopting mathematical operation, and a difference value between the upper limit value and the lower limit value of the virtual resource is obtained.
In step S533, the encryption string and the difference value are subjected to modulo operation, to obtain a modulus of dividing the encryption string by the difference value.
Specifically, the encryption string obtained in step S531 is used to perform a modulo operation on the difference obtained in step S532, so as to obtain a modulus of dividing the encryption string by the difference, where in this embodiment, the obtained modulus represents the offset of the virtual resource. Since the user identification is used in the calculation, the offset is related to the user corresponding to the user identification.
In step S534, the sum of the offset of the virtual resource and the lower limit value of the virtual resource is determined as the second allocation value of the virtual resource.
In the above embodiment, the server calculates the second allocation value of the virtual resource corresponding to the user identifier by adopting the same calculation rule as the client so as to verify the first allocation value locally calculated by the client, thereby ensuring the security of the service.
In an exemplary embodiment, taking a robbed red packet scenario as an example to further describe the scheme of the present application, in this embodiment, the virtual resource corresponding to the resource identifier is a certain red packet service, as shown in fig. 7, specifically may include the following steps:
In step S701, configuration information of the red packet service is issued through the configuration server.
The configuration server is used for storing and setting configuration information, and can be deployed in an independent machine room to be decoupled from the server of the red packet service in order to ensure smooth development of the service, so that the configuration server is not influenced by the server of the red packet service. Specifically, the configuration information includes an identifier, a random key, an upper limit of the amount of the red packet and a lower limit of the amount of the red packet, which are processed locally or not, corresponding to the request of the red packet service.
In step S702, a user initiates a request instruction for a red packet service through a client.
Specifically, the request instruction may be an instruction or a command for requesting to enter a page corresponding to the red packet service, for example, by clicking an entry of the page corresponding to the red packet service, and the request instruction is initiated to the client, where the client responds to the request instruction for the virtual resource, and obtains a user identifier in the request instruction, a resource identifier of the requested virtual resource, and an identifier of whether the request is processed locally, and in this embodiment, the description is given by taking the identifier obtained by the client as an example of the request to be processed locally, and then the subsequent steps are sequentially executed.
In step S703, the client searches for configuration information according to the request instruction, and calculates a first allocation value of the red packet corresponding to the requested user identification.
In step S704, the client displays the red packet corresponding to the first allocation value and the prompt message to the user.
In step S705, the user transmits an acquisition request for the presented red packet to the client.
In step S706, the client reports the first assigned value of the red packet to the server.
In step S707, the server calculates a second distribution value of the red packet using the same calculation method as the client.
In step S708, the server checks the first allocation value according to the second allocation value of the red packet.
And when the second distribution value is the same as the first distribution value, the verification is passed, so that the second distribution value of the red packet is distributed to the user corresponding to the user identification of the request, and the total residual amount of the red packet corresponding to the user is updated. When the second assigned value is different from the first assigned value, it indicates that the verification is not passed, thereby freezing all operations of the user corresponding to the requested user identification.
In step S709, the server returns corresponding presentation information to the client according to the verification result.
Specifically, if the verification result is that the verification is passed, the server returns display information of the user account corresponding to the assigned value assigned to the user identifier, so that the client performs corresponding display, and if the display indicates that the assigned value is checked out, the server indicates that the virtual resource is successfully acquired; if the verification result is that the verification fails, the server returns display information that the acquisition instruction of the virtual resource is an illegal instruction, for example, displaying "illegal instruction", "illegal user", and the like, that is, indicating that the acquisition instruction of the virtual resource is invalid, or indicating that the corresponding client is maliciously tampered and identified as an illegal user.
It should be understood that, although the steps in the flowcharts of fig. 1-7 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in FIGS. 1-7 may include multiple steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the steps or stages in other steps or other steps.
FIG. 8 is a block diagram of a virtual resource request processing apparatus, according to an example embodiment. Referring to fig. 8, the apparatus includes an information acquisition module 801, a configuration information determination module 802, a calculation module 803, and a presentation module 804.
An information obtaining module 801 configured to perform obtaining a user identifier in a request instruction and a resource identifier of a requested virtual resource in response to the request instruction for the virtual resource;
a configuration information determining module 802 configured to perform obtaining configuration information corresponding to the virtual resource, where the virtual resource, the resource identifier, and the configuration information have a correspondence relationship, and the configuration information is a configuration parameter that is stored locally at the client in advance and corresponds to the virtual resource;
a calculation module 803 configured to perform calculation of an allocation value of the virtual resource according to the configuration information and the user identification;
the display module 804 is configured to perform displaying the virtual resource corresponding to the assigned value and the corresponding hint information.
In one embodiment, the apparatus further comprises: the instruction receiving module is configured to execute and receive an acquisition instruction of the displayed virtual resource; the reporting module is configured to execute calling of a data reporting interface according to the acquisition instruction, report an allocation value to the server, wherein the allocation value is used for indicating the server to verify the acquisition instruction of the virtual resource, when the allocation value is consistent with the allocation value calculated by the server, the server verifies the acquisition instruction of the virtual resource and distributes the allocation value to a user account corresponding to the user identifier, and when the allocation value is inconsistent with the allocation value calculated by the server, the server does not verify the acquisition instruction of the virtual resource and does not distribute the allocation value to the user account corresponding to the user identifier; the display module is configured to execute display information which is returned by the display server and is used for distributing the distribution value to the user account corresponding to the user identifier when the verification result shows that the acquisition instruction of the virtual resource passes the verification; if the verification result is that the verification of the acquisition instruction of the virtual resource fails, the acquisition instruction of the virtual resource returned by the display server is display information of an illegal instruction.
In one embodiment, the apparatus further comprises: the encryption module is configured to execute first encryption processing on the distribution value to obtain an encrypted distribution value; the reporting module is configured to perform: and reporting the distribution value after the encryption processing to a server.
In one embodiment, the configuration information includes a random key corresponding to a resource identification of the virtual resource, an upper value of the virtual resource, and a lower value of the virtual resource; the calculation module 803 includes: an encryption processing unit configured to perform a second encryption process on the random key and the user identifier to obtain an encrypted character string; a difference value calculation unit configured to perform calculation of a difference value between an upper limit value of the virtual resource and a lower limit value of the virtual resource; the offset calculating unit is configured to perform modular operation on the encrypted character string and the difference value to obtain a module of dividing the encrypted character string by the difference value, wherein the module is the offset of the virtual resource; and an allocation value calculation unit configured to perform determination of a sum of the offset of the virtual resource and the lower limit value of the virtual resource as an allocation value of the virtual resource.
In one embodiment, the encryption processing unit includes: an exclusive-or processing subunit configured to perform exclusive-or processing on the random key and the user identifier, to obtain a processed value; and the hash operation subunit is configured to perform hash operation on the processed value by adopting cyclic redundancy check to obtain an encrypted character string.
In one embodiment, the request instruction of the virtual resource includes an identifier that whether to obtain configuration information corresponding to the virtual resource locally; the apparatus further comprises: the identifier identifying module is configured to execute the local acquisition of the configuration information corresponding to the virtual resource in the request instruction if the identifier is identified as the configuration information corresponding to the virtual resource acquired locally; and if the identification is that the configuration information corresponding to the virtual resource is not acquired locally, transmitting a request instruction to the server, wherein the request instruction is used for indicating the server to acquire the configuration information corresponding to the virtual resource in the request instruction.
The specific manner in which the respective modules perform the operations in the apparatus of the above embodiments has been described in detail in the embodiments related to the virtual resource request processing method, and will not be described in detail herein.
Fig. 9 is a block diagram illustrating a virtual resource request verification apparatus, according to an example embodiment. Referring to fig. 9, the apparatus includes a receiving module 901, a configuration information acquiring module 902, a calculating module 903, an allocating module 904, and a returning module 905.
The receiving module 901 is configured to execute receiving a first allocation value of a virtual resource corresponding to a user identifier, which is reported by a client, wherein the first allocation value is obtained after the client calculates according to a request instruction of the virtual resource, and the request instruction comprises the user identifier and a resource identifier of the requested virtual resource;
A configuration information obtaining module 902, configured to obtain configuration information corresponding to a virtual resource, where the virtual resource, the resource identifier, and the configuration information have a corresponding relationship, and the configuration information is a configuration parameter corresponding to the virtual resource;
a calculation module 903 configured to perform calculating a second allocation value of the virtual resource according to the configuration information and the user identification;
an allocation module 904 configured to perform allocating the second allocation value to the client account corresponding to the user identification if the second allocation value is the same as the first allocation value;
the return module 905 is configured to perform a return of the corresponding presentation information to the client.
In one embodiment, the apparatus further comprises an update module configured to perform: and updating the total remaining value of the virtual resources of the client account according to the allocated second allocation value.
In one embodiment, the apparatus further comprises a freezing module configured to perform: if the second allocation value is different from the first allocation value, determining that the client account corresponding to the user identifier is an illegal user, and freezing the operation of the client account.
In one embodiment, the first assigned value is the first assigned value after the first encryption process is performed; the apparatus further includes a decryption module configured to perform: and decrypting the first distribution value after the first encryption processing by adopting a decryption processing method corresponding to the first encryption processing to obtain the decrypted first distribution value.
In one embodiment, the configuration information includes a random key corresponding to a resource identification of the virtual resource, an upper value of the virtual resource, and a lower value of the virtual resource; the calculation module 903 comprises: an encryption processing unit configured to perform a second encryption process on the random key and the user identifier to obtain an encrypted character string; a difference value calculation unit configured to perform calculation of a difference value between an upper limit value of the virtual resource and a lower limit value of the virtual resource; the offset calculating unit is configured to perform modular operation on the encrypted character string and the difference value to obtain a module of dividing the encrypted character string by the difference value, wherein the module is the offset of the virtual resource; and a second allocation value calculation unit configured to perform determination of a sum of the offset of the virtual resource and the lower limit value of the virtual resource as a second allocation value of the virtual resource.
In one embodiment, the encryption processing unit includes: an exclusive-or processing subunit configured to perform exclusive-or processing on the random key and the user identifier, to obtain a processed value; and the hash operation subunit is configured to perform hash operation on the processed value by adopting cyclic redundancy check to obtain an encrypted character string.
The specific manner in which the respective modules perform the operations in the apparatus of the above embodiments has been described in detail in the embodiments related to the virtual resource request verification method, and will not be described in detail herein.
Fig. 10 is a block diagram illustrating an apparatus Z00 for a virtual resource request processing method according to an exemplary embodiment. For example, device Z00 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 10, device Z00 may include one or more of the following components: a processing component Z02, a memory Z04, a power component Z06, a multimedia component Z08, an audio component Z10, an input/output (I/O) interface Z12, a sensor component Z14, and a communication component Z16.
The processing component Z02 generally controls overall operation of the device Z00, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component Z02 may include one or more processors Z20 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component Z02 may include one or more modules that facilitate interactions between the processing component Z02 and other components. For example, the processing component Z02 may include a multimedia module to facilitate interaction between the multimedia component Z08 and the processing component Z02.
The memory Z04 is configured to store various types of data to support operations at the device Z00. Examples of such data include instructions for any application or method operating on device Z00, contact data, phonebook data, messages, pictures, video, and the like. The memory Z04 may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
The power supply component Z06 provides power to the various components of the device Z00. Power component Z06 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for device Z00.
The multimedia component Z08 comprises a screen between said device Z00 and the user providing an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component Z08 includes a front camera and/or a rear camera. The front camera and/or the rear camera may receive external multimedia data when the device Z00 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component Z10 is configured to output and/or input an audio signal. For example, the audio component Z10 includes a Microphone (MIC) configured to receive external audio signals when the device Z00 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may be further stored in the memory Z04 or transmitted via the communication component Z16. In some embodiments, the audio component Z10 further comprises a speaker for outputting audio signals.
The I/O interface Z12 provides an interface between the processing component Z02 and a peripheral interface module, which may be a keyboard, click wheel, button, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
Sensor assembly Z14 includes one or more sensors for providing status assessment of various aspects of device Z00. For example, sensor assembly Z14 may detect the on/off state of device Z00, the relative positioning of the assemblies, such as the display and keypad of device Z00, the sensor assembly Z14 may also detect the change in position of device Z00 or a component of device Z00, the presence or absence of user contact with device Z00, the orientation or acceleration/deceleration of device Z00, and the change in temperature of device Z00. The sensor assembly Z14 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly Z14 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly Z14 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component Z16 is configured to facilitate wired or wireless communication between the device Z00 and other devices. Device Z00 may access a wireless network based on a communication standard, such as WiFi, an operator network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In one exemplary embodiment, the communication component Z16 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component Z16 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, device Z00 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory Z04, comprising instructions executable by processor Z20 of device Z00 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
Fig. 11 is a block diagram illustrating a device S00 for a virtual resource request verification method according to an exemplary embodiment. For example, device S00 may be a server. Referring to FIG. 11, device S00 includes a processing component S20 that further includes one or more processors, and memory resources represented by memory S22, for storing instructions, such as applications, that are executable by processing component S20. The application program stored in the memory S22 may include one or more modules each corresponding to a set of instructions. Further, the processing component S20 is configured to execute instructions to perform the above-described method of virtual resource request validation.
Device S00 can also include a power component S24 configured to perform power management of device S00, a wired or wireless network interface S26 configured to connect device S00 to a network, and an input/output (I/O) interface S28. Device S00 may operate based on an operating system stored in memory S22, such as Windows Server, mac OS X, unix, linux, freeBSD, or the like.
In an exemplary embodiment, a storage medium is also provided, such as a memory S22, comprising instructions executable by a processor of the device S00 to perform the above method. The storage medium may be a non-transitory computer readable storage medium, which may be, for example, ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (24)

1. A method for processing a virtual resource request, wherein the method is applied to a client, and the method comprises:
responding to a request instruction of a virtual resource, and acquiring a user identifier in the request instruction and a resource identifier of the requested virtual resource;
acquiring configuration information corresponding to the virtual resource, wherein the virtual resource, the resource identifier and the configuration information have a corresponding relation, and the configuration information is a configuration parameter which is stored in the client in advance and corresponds to the virtual resource;
Calculating the allocation value of the virtual resource according to the configuration information and the user identification;
displaying virtual resources corresponding to the allocation values and corresponding prompt information;
the configuration information comprises a random key corresponding to the resource identifier of the virtual resource, an upper limit value of the virtual resource and a lower limit value of the virtual resource; and calculating the allocation value of the virtual resource according to the configuration information and the user identifier, wherein the method comprises the following steps:
performing second encryption processing on the random key and the user identifier to obtain an encrypted character string;
calculating a difference between the upper limit value of the virtual resource and the lower limit value of the virtual resource;
performing modular operation on the encrypted character string and the difference value to obtain a module of dividing the encrypted character string by the difference value, wherein the module is the offset of the virtual resource;
and determining the sum of the offset of the virtual resource and the lower limit value of the virtual resource as the allocation value of the virtual resource.
2. The method of claim 1, wherein after the presenting the virtual resource corresponding to the allocation value and the corresponding hint information, the method further comprises:
Receiving an acquisition instruction of the displayed virtual resource;
the data reporting interface is called according to the acquisition instruction, the distribution value is used for indicating the server to verify the acquisition instruction of the virtual resource, when the distribution value is consistent with the distribution value calculated by the server, the server verifies the acquisition instruction of the virtual resource and distributes the distribution value to the user account corresponding to the user identifier, and when the distribution value is inconsistent with the distribution value calculated by the server, the server does not verify the acquisition instruction of the virtual resource and does not distribute the distribution value to the user account corresponding to the user identifier;
if the verification result is that the verification of the acquisition instruction of the virtual resource is passed, displaying information returned by the server and used for distributing the distribution value to the user account corresponding to the user identifier; and if the verification result is that the verification of the acquisition instruction of the virtual resource fails, displaying that the acquisition instruction of the virtual resource returned by the server is the display information of the illegal instruction.
3. The method of claim 2, wherein prior to reporting the assigned value to the server, the method further comprises:
performing first encryption processing on the distribution value to obtain an encrypted distribution value;
the reporting the allocation value to the server includes:
and reporting the distribution value after encryption processing to the server.
4. The method of claim 1, wherein performing a second encryption process on the random key and the user identifier to obtain an encrypted string comprises:
performing exclusive-or processing on the random key and the user identifier to obtain a processed value;
and carrying out hash operation on the processed value by adopting cyclic redundancy check to obtain the encrypted character string.
5. The method according to any one of claims 1 to 4, wherein the request instruction of the virtual resource includes an identifier that indicates whether to obtain configuration information corresponding to the virtual resource locally; after the responding to the request instruction for the virtual resource, the method further comprises:
if the identification is identified as locally acquiring the configuration information corresponding to the virtual resource, locally acquiring the configuration information corresponding to the virtual resource in the request instruction;
And if the identification is that the configuration information corresponding to the virtual resource is not acquired locally, sending the request instruction to a server, wherein the request instruction is used for indicating the server to acquire the configuration information corresponding to the virtual resource in the request instruction.
6. A virtual resource request validation method, wherein the method is applied to a server, the method comprising:
receiving a first allocation value of a virtual resource corresponding to a user identifier, wherein the first allocation value is obtained by the client after calculation according to a request instruction of the virtual resource, and the request instruction comprises the user identifier and the resource identifier of the requested virtual resource;
acquiring configuration information corresponding to the virtual resource, wherein the virtual resource, the resource identifier and the configuration information have a corresponding relation, and the configuration information is a configuration parameter corresponding to the virtual resource;
calculating a second allocation value of the virtual resource according to the configuration information and the user identification;
if the second allocation value is the same as the first allocation value, allocating the second allocation value to a client account corresponding to the user identifier;
Returning corresponding display information to the client;
the configuration information comprises a random key corresponding to the resource identifier of the virtual resource, an upper limit value of the virtual resource and a lower limit value of the virtual resource; and calculating a second allocation value of the virtual resource according to the configuration information and the user identifier, wherein the second allocation value comprises the following steps:
performing second encryption processing on the random key and the user identifier to obtain an encrypted character string;
calculating a difference between the upper limit value of the virtual resource and the lower limit value of the virtual resource;
performing modular operation on the encrypted character string and the difference value to obtain a module of dividing the encrypted character string by the difference value, wherein the module is the offset of the virtual resource;
and determining the sum of the offset of the virtual resource and the lower limit value of the virtual resource as a second allocation value of the virtual resource.
7. The method of claim 6, wherein after assigning the second allocation value to the client account corresponding to the user identification, the method further comprises:
and updating the total remaining value of the virtual resources of the client account according to the allocated second allocation value.
8. The method of claim 6, wherein after the calculating the second allocation value of the virtual resource, the method further comprises:
and if the second distribution value is different from the first distribution value, determining that the client account corresponding to the user identifier is an illegal user, and freezing the operation of the client account.
9. The method of claim 6, wherein the first assigned value is a first assigned value after the first encryption process; after receiving the first assigned value of the virtual resource corresponding to the user identifier, which is reported by the client, the method further comprises:
and decrypting the first distribution value after the first encryption processing by adopting a decryption processing method corresponding to the first encryption processing to obtain the decrypted first distribution value.
10. The method of claim 6, wherein performing a second encryption process on the random key and the user identifier to obtain an encrypted string comprises:
performing exclusive-or processing on the random key and the user identifier to obtain a processed value;
and carrying out hash operation on the processed value by adopting cyclic redundancy check to obtain the encrypted character string.
11. A virtual resource request processing apparatus, comprising:
the information acquisition module is configured to execute a request instruction for responding to the virtual resource and acquire a user identifier in the request instruction and a resource identifier of the requested virtual resource;
the configuration information determining module is configured to acquire configuration information corresponding to the virtual resource, wherein the virtual resource, the resource identifier and the configuration information have a corresponding relation, and the configuration information is a configuration parameter which is stored in a client in advance and corresponds to the virtual resource;
a calculation module configured to perform calculation of an allocation value of the virtual resource according to the configuration information and the user identification;
the display module is configured to display the virtual resources corresponding to the distribution value and the corresponding prompt information;
the configuration information comprises a random key corresponding to the resource identifier of the virtual resource, an upper limit value of the virtual resource and a lower limit value of the virtual resource; the calculation module includes:
an encryption processing unit configured to perform a second encryption process on the random key and the user identifier to obtain an encrypted string;
A difference value calculation unit configured to perform calculation of a difference value between an upper limit value of the virtual resource and a lower limit value of the virtual resource;
an offset calculating unit configured to perform modulo operation on the encrypted string and the difference value, to obtain a modulus of dividing the encrypted string by the difference value, where the modulus is an offset of the virtual resource;
an allocation value calculation unit configured to perform determination of a sum of an offset amount of the virtual resource and a lower limit value of the virtual resource as an allocation value of the virtual resource.
12. The apparatus of claim 11, wherein the apparatus further comprises:
the instruction receiving module is configured to execute and receive an acquisition instruction of the displayed virtual resource;
the reporting module is configured to execute calling a data reporting interface according to the acquisition instruction, report the allocation value to a server, wherein the allocation value is used for indicating the server to verify the acquisition instruction of the virtual resource, when the allocation value is consistent with the allocation value calculated by the server, the server verifies the acquisition instruction of the virtual resource and distributes the allocation value to a user account corresponding to the user identifier, and when the allocation value is inconsistent with the allocation value calculated by the server, the server does not verify the acquisition instruction of the virtual resource and does not distribute the allocation value to the user account corresponding to the user identifier;
The display module is configured to execute display information returned by the server and used for distributing the distribution value to the user account corresponding to the user identifier if the verification result is that the verification of the acquisition instruction of the virtual resource is passed; and if the verification result is that the verification of the acquisition instruction of the virtual resource fails, displaying that the acquisition instruction of the virtual resource returned by the server is the display information of the illegal instruction.
13. The apparatus of claim 12, wherein the apparatus further comprises:
the encryption module is configured to execute first encryption processing on the distribution value to obtain an encrypted distribution value;
the reporting module is configured to perform: and reporting the distribution value after encryption processing to the server.
14. The apparatus of claim 11, wherein the encryption processing unit comprises:
an exclusive-or processing subunit configured to perform exclusive-or processing on the random key and the user identifier, to obtain a processed value;
and the hash operation subunit is configured to perform hash operation on the processed value by adopting cyclic redundancy check to obtain the encrypted character string.
15. The apparatus according to any one of claims 11 to 14, wherein the request instruction of the virtual resource includes an identifier that indicates whether to obtain configuration information corresponding to the virtual resource locally; the apparatus further comprises:
the identifier identifying module is configured to execute the local acquisition of the configuration information corresponding to the virtual resource in the request instruction if the identifier is identified as the configuration information corresponding to the virtual resource acquired locally;
and if the identification is that the configuration information corresponding to the virtual resource is not acquired locally, sending the request instruction to a server, wherein the request instruction is used for indicating the server to acquire the configuration information corresponding to the virtual resource in the request instruction.
16. A virtual resource request verification apparatus, comprising:
the receiving module is configured to execute receiving a first allocation value of the virtual resource corresponding to the user identifier, which is reported by the client, wherein the first allocation value is obtained after the client calculates according to a request instruction of the virtual resource, and the request instruction comprises the user identifier and the resource identifier of the requested virtual resource;
The configuration information acquisition module is configured to acquire configuration information corresponding to the virtual resource, wherein the virtual resource, the resource identifier and the configuration information have a corresponding relation, and the configuration information is a configuration parameter corresponding to the virtual resource;
a calculation module configured to perform calculating a second allocation value of the virtual resource according to the configuration information and the user identification;
an allocation module configured to perform allocation of the second allocation value to a client account corresponding to the user identification if the second allocation value is the same as the first allocation value;
the return module is configured to return corresponding display information to the client;
the configuration information comprises a random key corresponding to the resource identifier of the virtual resource, an upper limit value of the virtual resource and a lower limit value of the virtual resource; the calculation module includes:
an encryption processing unit configured to perform a second encryption process on the random key and the user identifier to obtain an encrypted string;
a difference value calculation unit configured to perform calculation of a difference value between an upper limit value of the virtual resource and a lower limit value of the virtual resource;
An offset calculating unit configured to perform modulo operation on the encrypted string and the difference value, to obtain a modulus of dividing the encrypted string by the difference value, where the modulus is an offset of the virtual resource;
and a second allocation value calculation unit configured to perform determination of a sum of the offset of the virtual resource and the lower limit value of the virtual resource as a second allocation value of the virtual resource.
17. The apparatus of claim 16, further comprising an update module configured to perform:
and updating the total remaining value of the virtual resources of the client account according to the allocated second allocation value.
18. The apparatus of claim 16, further comprising a freezing module configured to perform:
and if the second distribution value is different from the first distribution value, determining that the client account corresponding to the user identifier is an illegal user, and freezing the operation of the client account.
19. The apparatus of claim 16, wherein the first assigned value is a first assigned value after the first encryption process; the apparatus further includes a decryption module configured to perform:
And decrypting the first distribution value after the first encryption processing by adopting a decryption processing method corresponding to the first encryption processing to obtain the decrypted first distribution value.
20. The apparatus of claim 16, wherein the encryption processing unit comprises:
an exclusive-or processing subunit configured to perform exclusive-or processing on the random key and the user identifier, to obtain a processed value;
and the hash operation subunit is configured to perform hash operation on the processed value by adopting cyclic redundancy check to obtain the encrypted character string.
21. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the virtual resource request processing method of any of claims 1 to 5.
22. A storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform the virtual resource request processing method of any one of claims 1 to 5.
23. A server, comprising:
A processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the virtual resource request validation method of any of claims 6 to 10.
24. A storage medium, which when executed by a processor of a server, enables the server to perform the virtual resource request validation method of any one of claims 6 to 10.
CN202010424539.5A 2020-05-19 2020-05-19 Virtual resource request processing method and device, electronic equipment and storage medium Active CN111611075B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010424539.5A CN111611075B (en) 2020-05-19 2020-05-19 Virtual resource request processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010424539.5A CN111611075B (en) 2020-05-19 2020-05-19 Virtual resource request processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111611075A CN111611075A (en) 2020-09-01
CN111611075B true CN111611075B (en) 2024-03-05

Family

ID=72203358

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010424539.5A Active CN111611075B (en) 2020-05-19 2020-05-19 Virtual resource request processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111611075B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256424A (en) * 2020-09-22 2021-01-22 北京达佳互联信息技术有限公司 Virtual resource processing method, device and system, electronic equipment and storage medium
CN112769715B (en) * 2020-12-31 2023-04-07 北京达佳互联信息技术有限公司 Resource allocation method, device, electronic equipment and storage medium
CN113077280A (en) * 2021-02-05 2021-07-06 北京达佳互联信息技术有限公司 Electronic resource allocation method and device, electronic equipment and storage medium
CN113691587B (en) * 2021-07-20 2023-05-23 北京达佳互联信息技术有限公司 Virtual resource processing method and device, electronic equipment and storage medium
CN114596117A (en) * 2022-03-10 2022-06-07 百果园技术(新加坡)有限公司 Virtual gift package issuing method, system, device, storage medium and product

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104796380A (en) * 2014-01-16 2015-07-22 腾讯科技(深圳)有限公司 Safety verification method, safety verification system, terminal and verification server
RU2626664C1 (en) * 2016-06-15 2017-07-31 Федеральное государственное автономное образовательное учреждение высшего образования "Белгородский государственный национальный исследовательский университет" (НИУ "БелГУ") Method of access granting to distributed data and computational resources as corporate portals via protected virtual environment
CN107038619A (en) * 2017-02-09 2017-08-11 阿里巴巴集团控股有限公司 Virtual resource management method and device
CN107329834A (en) * 2017-07-04 2017-11-07 北京百度网讯科技有限公司 Method and apparatus for performing calculating task
CN107480980A (en) * 2016-06-08 2017-12-15 阿里巴巴集团控股有限公司 A kind of method of virtual resource allocation, server and system
CN108984266A (en) * 2018-06-15 2018-12-11 华为技术有限公司 A kind of management method of virtual machine, apparatus and system
CN109146437A (en) * 2018-07-25 2019-01-04 腾讯科技(深圳)有限公司 Processing method, client and the storage medium of virtual resource
CN109997345A (en) * 2017-10-25 2019-07-09 深圳市互盟科技股份有限公司 Virtual machine control system and its method based on cloud computing
CN110585698A (en) * 2019-09-29 2019-12-20 腾讯科技(深圳)有限公司 Virtual asset transaction method and related device
CN110688215A (en) * 2019-08-23 2020-01-14 咪咕文化科技有限公司 Virtual resource allocation method, server, and computer-readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060106802A1 (en) * 2004-11-18 2006-05-18 International Business Machines Corporation Stateless methods for resource hiding and access control support based on URI encryption

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104796380A (en) * 2014-01-16 2015-07-22 腾讯科技(深圳)有限公司 Safety verification method, safety verification system, terminal and verification server
CN107480980A (en) * 2016-06-08 2017-12-15 阿里巴巴集团控股有限公司 A kind of method of virtual resource allocation, server and system
RU2626664C1 (en) * 2016-06-15 2017-07-31 Федеральное государственное автономное образовательное учреждение высшего образования "Белгородский государственный национальный исследовательский университет" (НИУ "БелГУ") Method of access granting to distributed data and computational resources as corporate portals via protected virtual environment
CN107038619A (en) * 2017-02-09 2017-08-11 阿里巴巴集团控股有限公司 Virtual resource management method and device
CN107329834A (en) * 2017-07-04 2017-11-07 北京百度网讯科技有限公司 Method and apparatus for performing calculating task
CN109997345A (en) * 2017-10-25 2019-07-09 深圳市互盟科技股份有限公司 Virtual machine control system and its method based on cloud computing
CN108984266A (en) * 2018-06-15 2018-12-11 华为技术有限公司 A kind of management method of virtual machine, apparatus and system
CN109146437A (en) * 2018-07-25 2019-01-04 腾讯科技(深圳)有限公司 Processing method, client and the storage medium of virtual resource
CN110688215A (en) * 2019-08-23 2020-01-14 咪咕文化科技有限公司 Virtual resource allocation method, server, and computer-readable storage medium
CN110585698A (en) * 2019-09-29 2019-12-20 腾讯科技(深圳)有限公司 Virtual asset transaction method and related device

Also Published As

Publication number Publication date
CN111611075A (en) 2020-09-01

Similar Documents

Publication Publication Date Title
CN111611075B (en) Virtual resource request processing method and device, electronic equipment and storage medium
CN109146470B (en) Method and device for generating payment code
WO2020215568A1 (en) Communication number changing method, apparatus and system, computer device and storage medium
CN109039990B (en) Behavior verification method and device based on verification code
CN103914520B (en) Data query method, terminal device and server
CN107766701B (en) Electronic equipment, dynamic library file protection method and device
CN111368232A (en) Password sharing reflux method and device, electronic equipment and storage medium
US20160021067A1 (en) Methods, devices and systems for anti-counterfeiting authentication
CN108900553B (en) Communication method, device and computer readable storage medium
CN111756820A (en) Access processing method and device, electronic equipment and storage medium
CN113282951B (en) Application program security verification method, device and equipment
CN110705985A (en) Method and apparatus for storing information
CN112784243A (en) Authorization management method and device, electronic equipment and storage medium
CN112434339A (en) Information processing method and device
CN110532324B (en) Block chain-based bulletin information display method, device, equipment and storage medium
CN109885360B (en) Data processing method, device and storage medium
CN110008668B (en) Data processing method, device and storage medium
CN114386008A (en) Information processing method and device, equipment and storage medium
CN109614114B (en) License file acquisition method and device, readable storage medium and electronic equipment
CN115706993A (en) Authentication method, readable medium, and electronic device
CN108924136B (en) Authorization authentication method, device and storage medium
US10091236B2 (en) Methods apparatuses, and storage mediums for acquiring legitimate installation packages
CN111371563A (en) Password verification method and device, electronic equipment and storage medium
CN116708044B (en) Application management system, application management method, server, terminal and medium
CN114978742B (en) Verification information generation method, verification 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
GR01 Patent grant
GR01 Patent grant