Commodity List Access Method and Its Device, Equipment, Medium, Product
By receiving list execution instructions, matching the subclass access interface derived from template classes, building an asynchronous message processing mechanism and message queue, it solves the problem of standardized and efficient call of product list access in e-commerce platforms, and improves development efficiency and system stability.
Patent Information
- Application Number
- CN202111315792.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-08
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-11-08
AI Technical Summary
In existing e-commerce platforms, the access calls of product lists lack standardized and efficient implementation solutions, resulting in inconvenient development process and inconsistent runtime calls.
By receiving list execution instructions, matching the subclass access interface derived from template classes, calling the product list address, executing the import or export process, and using inheritance to build an asynchronous message processing mechanism and message queue to achieve efficient access to the product list.
It realizes quick and easy access to product lists, solves the coupling problems caused by inheritance, provides a variety of access methods, and improves the development efficiency of software engineering and the robustness of the backend system.
Smart Images

Figure CN114185977B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to data access technology, and in particular to a method for accessing and storing a product list, and a corresponding device, computer device, computer-readable storage medium, and computer program product therefor. Background Art
[0002] In the back-end system of an e-commerce platform, a large number of online services are integrated, and it is often necessary to provide product information for each online service. Therefore, the product information in the product list is often accessed and called. Usually, in an e-commerce system, there are multiple import and export scenarios, such as a recommended product list, a search result product list, a purchased product list, an import and export of a shopping cart product list, etc. In fact, these are all general and can be abstracted out to implement specific business logics for imports and exports in different fields, and the common parts are uniformly managed.
[0003] However, to achieve such abstraction, it is necessary to consider the convenience of calls between various online services in the e-commerce platform, so that during the development process, efficient development can be carried out according to a certain template or certain standardized rules, and as much standardized calls as possible can be achieved during the operation process. At present, the relevant middleware technologies in the e-commerce field fail to provide corresponding implementation solutions for such requirements, so it is necessary to explore separately. Summary of the Invention
[0004] The primary object of the present application is to solve at least one of the above problems and provide a method for accessing and storing a product list, and a corresponding device, computer device, computer-readable storage medium, and computer program product therefor.
[0005] To meet the various objects of the present application, the present application adopts the following technical solutions:
[0006] A method for accessing and storing a product list provided to meet one of the objects of the present application includes the following steps:
[0007] Receive a list execution instruction, where the list execution instruction includes an execution action type and a product list address, and the product list corresponding to the product list address stores product information corresponding to multiple product objects;
[0008] Match the access interface of an instantiated object of a corresponding subclass among multiple subclasses derived from a template class according to the execution action type of the list execution instruction;
[0009] Call the access interface and transmit the product list address thereto for it to access the product list;
[0010] The access interface performs an import or export process corresponding to the execution action type on the product list.
[0011] In a further embodiment, the execution action type of executing an instruction according to the list matches the access interface of an instantiated object of a corresponding subclass among multiple subclasses derived from a template class, and includes the following steps:
[0012] Judge the execution action type in the list execution instruction, and determine that the execution action type is an import type or an export type;
[0013] Determine a corresponding import access interface or export access interface according to the execution action type, where the import access interface and the export access interface are interfaces in instantiated objects of different subclasses derived from the same model class.
[0014] In an extended embodiment, before receiving the list execution instruction, the following pre-steps are included:
[0015] Push a template class for rewriting subclasses to the terminal device;
[0016] Obtain a subclass that has rewritten the import access interface or export access interface therein based on the template class;
[0017] Instantiate the subclass to obtain its corresponding instantiated object.
[0018] In a further embodiment, the access interface performs an import or export process corresponding to the execution action type for the commodity list, and the import process includes:
[0019] Parse the commodity list into an intermediate state data file, and the intermediate state data file is a comma-separated value file;
[0020] Pass the intermediate state data file to the data sharing storage service for processing;
[0021] The data sharing storage service transfers the intermediate state data file to the commodity database.
[0022] In a further embodiment, the access interface performs an import or export process corresponding to the execution action type for the commodity list, and the export process includes:
[0023] Parse the commodity list into an intermediate state data file, and the commodity list contains index information in the commodity database;
[0024] Pass the intermediate state data file to the data sharing storage service for processing;
[0025] The data sharing storage service transfers the intermediate state data file to a preset target storage address for third-party invocation.
[0026] In a preferred embodiment, the method is implemented as a computer process and executed concurrently in response to instructions for the plurality of lists, the list execution instructions being triggered by an online service in an e-commerce service system.
[0027] A commodity list access device provided to meet one of the purposes of the present application includes:
[0028] An instruction receiving module for receiving list execution instructions, the list execution instructions including an execution action type and a commodity list address, and commodity information corresponding to a plurality of commodity objects being stored in the commodity list corresponding to the commodity list address; an interface matching module for matching, according to the execution action type of the list execution instructions, access interfaces of instantiated objects of corresponding subclasses among a plurality of subclasses derived from a template class; an interface calling module for calling the access interfaces and transmitting the commodity list address thereto for it to access the commodity list; and an interface execution module for the access interfaces to execute an import or export process corresponding to the execution action type for the commodity list.
[0029] In a further embodiment, the interface matching module includes: an execution type judgment sub-module for judging the execution action type in the list execution instructions to determine that the execution action type is an import type or an export type; and an interface confirmation sub-module for determining a corresponding import access interface or export access interface according to the execution action type, the import access interface and the export access interface being interfaces in instantiated objects of different subclasses derived from the same model class.
[0030] In an extended embodiment, the instruction receiving module further includes: a push sub-module for pushing a template class for rewriting subclasses to a terminal device; an acquisition sub-module for acquiring a subclass in which the import access interface or the export access interface in the template class is rewritten; and an instantiation sub-module for instantiating the subclass to obtain its corresponding instantiated object.
[0031] In a further embodiment, the interface execution module includes: a parsing sub-module for parsing the commodity list into an intermediate state data file, the intermediate state data file being a comma-separated value file; a transfer sub-module for transferring the intermediate state data file to a data sharing storage service for processing; and a transfer and storage sub-module for the data sharing storage service to transfer and store the intermediate state data file in a commodity database.
[0032] In a further embodiment, the interface execution module includes: a parsing sub-module for parsing the product list into an intermediate data file, where the product list contains index information in the product database; a transmission sub-module for transmitting the intermediate data file to the data sharing storage service for processing; and a transfer and storage sub-module for the data sharing storage service to transfer and store the intermediate data file to a preset target storage address for third-party invocation.
[0033] In a preferred embodiment, the list execution instruction is triggered by an online service in the e-commerce service system.
[0034] A computer device provided to meet one of the purposes of the present application includes a central processing unit and a memory. The central processing unit is used to call and run a computer program stored in the memory to execute the steps of the product list access method described in the present application.
[0035] A computer-readable storage medium provided to meet another purpose of the present application stores, in the form of computer-readable instructions, a computer program implemented according to the product list access method. When the computer program is called and run by a computer, it executes the steps included in the method.
[0036] A computer program product provided to meet another purpose of the present application includes a computer program / instructions. When the computer program / instructions are executed by a processor, they implement the steps of the method described in any embodiment of the present application.
[0037] Compared with the prior art, the advantages of the present application are as follows:
[0038] The present application can quickly and simply implement an access interface for product list access in an inheritance manner, facilitating the rapid implementation of the business logic for accessing product lists in a standardized manner in software engineering. Moreover, it can solve the coupling problem caused by inheritance by deriving different subclasses to adapt to different requirements, realizing multiple different access methods with the same template class, and facilitating the high-performance and orderly import and export processing of product data according to execution instructions through the same class object. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The above and / or additional aspects and advantages of the present application will become apparent and be readily understood from the following description of embodiments in conjunction with the drawings, where:
[0040] Figure 1 is a schematic flowchart of a typical embodiment of the product list access method of the present application;
[0041] Figure 2 is a schematic flowchart of the execution of the import and export access interfaces in the embodiments of the present application;
[0042] Figure 3 A schematic flowchart for obtaining the corresponding instantiated object by rewriting a subclass in an embodiment of the present application;
[0043] Figure 4 A schematic flowchart for the import process in an embodiment of the present application;
[0044] Figure 5 A schematic flowchart for the export process in an embodiment of the present application;
[0045] Figure 6 A principle block diagram of a commodity list access device of the present application;
[0046] Figure 7 A schematic structural diagram of a computer device adopted by the present application. Detailed implementation manners
[0047] The embodiments of the present application will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described by referring to the accompanying drawings are exemplary and are only used to explain the present application and should not be construed as a limitation to the present application.
[0048] Those skilled in the art of the present technology can understand that, unless specifically stated, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present application means the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or their groups. It should be understood that when we say an element is "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, or there may also be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The phrase "and / or" used herein includes all or any unit and all combinations of one or more related listed items.
[0049] Those skilled in the art of the present technology can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as the general understanding of those of ordinary skill in the art to which the present application belongs. It should also be understood that terms such as those defined in a general dictionary should be understood to have a meaning consistent with the meaning in the context of the prior art, and will not be interpreted with an idealized or overly formal meaning unless specifically defined as here.
[0050] Those skilled in the art can understand that the "client", "terminal", and "terminal device" used herein include both devices with wireless signal receivers that only have the ability to receive and do not have the ability to transmit, and devices with both receiving and transmitting hardware that have the receiving and transmitting hardware capable of two-way communication on a two-way communication link. Such devices may include: cellular or other communication devices such as personal computers, tablet computers, etc., which have a single-line display or a multi-line display or cellular or other communication devices without a multi-line display; PCS (Personal Communications Service), which can combine voice, data processing, fax, and / or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, pager, Internet / intranet access, web browser, notepad, calendar, and / or GPS (Global Positioning System) receiver; conventional laptop and / or palm computers or other devices, which are conventional laptop and / or palm computers or other devices with and / or including a radio frequency receiver. The "client", "terminal", and "terminal device" used herein can be portable, transportable, installed in a vehicle (air, sea, and / or land), or suitable for and / or configured to run locally, and / or run in a distributed form at any other location on the earth and / or in space. The "client", "terminal", and "terminal device" used herein can also be a communication terminal, an Internet access terminal, a music / video playback terminal, such as a PDA, MID (Mobile Internet Device), and / or a mobile phone with music / video playback function, or can also be devices such as a smart TV, a set-top box, etc.
[0051] The hardware referred to by names such as "server", "client", and "service node" in this application is essentially an electronic device with the equivalent capabilities of a personal computer, and is a hardware device with the necessary components disclosed by the von Neumann principle, including a central processing unit (including an arithmetic unit and a controller), a memory, an input device, and an output device. The computer program is stored in its memory, and the central processing unit loads the program stored in the external memory into the memory for execution, executes the instructions in the program, and interacts with the input / output devices to complete specific functions.
[0052] It should be noted that the concept of "server" in this application can similarly be extended to apply to server clusters. According to the network deployment principles understood by those skilled in the art, the servers should be logically divided. Physically, these servers can either be independent of each other but can be invoked through interfaces, or integrated into a physical computer or a set of computer clusters. Those skilled in the art should understand this flexibility and should not be restricted by this when implementing the network deployment method of this application.
[0053] One or several technical features of this application, unless expressly specified, can either be deployed on a server for implementation and accessed by a client remotely invoking the online service interface provided by the server, or directly deployed and run on the client for implementation and access.
[0054] The neural network models cited or possibly cited in this application, unless expressly specified, can either be deployed on a remote server and remotely invoked by the client, or deployed on a client capable of handling the device for direct invocation. In some embodiments, when it runs on the client, its corresponding intelligence can be obtained through transfer learning to reduce the requirements for the client's hardware operating resources and avoid excessive occupation of the client's hardware operating resources.
[0055] All kinds of data involved in this application, unless expressly specified, can either be remotely stored on a server or stored on a local terminal device, as long as it is suitable for being invoked by the technical solution of this application.
[0056] Those skilled in the art should be aware that although the various methods of this application are described based on the same concept and thus show commonality with each other, unless otherwise specified, these methods can all be executed independently. Similarly, for the various embodiments disclosed in this application, they are all proposed based on the same inventive concept. Therefore, for the same expressed concepts, as well as concepts that are only appropriately transformed for convenience although the concept expressions are different, they should be equivalently understood.
[0057] For the various embodiments to be disclosed in this application, unless expressly pointed out that there is a mutually exclusive relationship between them, the relevant technical features involved in each embodiment can be cross-combined to flexibly construct new embodiments, as long as this combination does not deviate from the creative spirit of this application and can meet the requirements in the prior art or solve certain deficiencies in the prior art. Those skilled in the art should be aware of this flexibility.
[0058] A method for accessing and storing a product list in this application can be programmed into a computer program product and deployed to run in a service cluster, so as to perform this method through human-computer interaction with the computer program product through a graphical user interface by accessing the interface opened after the computer program product runs.
[0059] Please refer to Figure 1 , in a typical embodiment of the method for accessing a product list of the present application, the following steps are included:
[0060] Step S1100: Receive a list execution instruction, where the list execution instruction includes an execution action type and a product list address, and product information corresponding to multiple product objects is stored in the product list corresponding to the product list address;
[0061] The product list is a list stored in a product database that stores product objects and their corresponding product information. The product list can be stored in a network storage medium, so each product list has a corresponding storage address, that is, a product list address.
[0062] In a preferred embodiment, the product list address is the storage path of the product information corresponding to its multiple product objects in the product database. By accessing the product list address, the product information corresponding to multiple product objects in the product list in the product database can be obtained, and the corresponding interface can be called to perform corresponding data operations on it.
[0063] The product information includes, but is not limited to, various types of multiple data such as product titles, product details, product pictures, product prices, product attributes, etc. After entering the background system, for example, it can be constructed into a computer data object so as to implement operations such as adding, modifying, deleting, updating, and calling the product information through the data object. The various data in the product information are embodied as multiple attribute fields and their corresponding attribute data.
[0064] In one embodiment, when a user shelves a new product on the front-end system and submits the product information, the online service triggers an update request for the product list corresponding to the background user and a list instruction initiated by the front-end system. The background system receives the list execution instruction and identifies that in this scenario, the execution action type adopted is the import type. Therefore, according to this execution action type and the product list address corresponding to the user, an operation corresponding to this execution action type is performed on the product information of the product objects in the product list, in response to the product information update event of the product list.
[0065] In another embodiment, when a user swipes the product list on the front-end system and swipes to a specified recommended product display position, the online service triggers a request for pushing the corresponding recommended product list in the background and a list instruction initiated by the front-end system. The background system receives the list execution instruction and identifies that in this scenario, the execution action type adopted is the export type. Therefore, according to this execution action type and the corresponding product list address, an operation corresponding to this execution action type is performed on the product information of the product objects in the recommended product list, in response to the event of pushing the product information in the recommended product list.
[0066] Step S1200: Match the access interfaces of the instantiated objects of the corresponding subclasses among multiple subclasses derived from the template class according to the execution action type of the instruction executed based on the said list.
[0067] The template class is a class that encapsulates the Handler asynchronous message processing mechanism and is used for the asynchronous processing of operation request messages for importing and exporting product lists. In software engineering, the business logics corresponding to two execution action types of import type and export type are pre-abstracted and implemented as a template class, so that when the template class or its derived subclasses are instantiated, the common business logics abstracted can be executed.
[0068] As for the subclasses corresponding to different execution action types, they can be derived by inheriting from the said template class, and the access interfaces corresponding to them can be overridden for the derived subclasses, so that different subclasses can serve different execution action types. Accordingly, when the access interfaces are called correspondingly according to the execution action type corresponding to the instruction executed based on the list, different instantiated objects can be correspondingly matched, and the corresponding access interfaces can be called using the corresponding instantiated objects.
[0069] Among multiple subclasses derived from the said template class, the subclasses are derived from the template class, and the methods and variables of the template class for asynchronous message processing are also inherited by the subclasses, and the subclasses can override the methods or add preprocessing methods before asynchronous message processing. The preprocessing method is to declare import and export verification methods and batch processing methods for the corresponding import and export types using annotations.
[0070] The corresponding instantiated objects inherit from the template class that encapsulates the Handler mechanism. Therefore, similarly, asynchronous message processing is implemented according to the mechanism of the template class. The asynchronous message processing is manifested as follows: after a product list import / export request operation message is sent, it first enters a message queue MQ (Message Queue). After the function that sends the operation request message corresponding to the product list import / export request returns immediately, another part takes out the operation request messages corresponding to import and export one by one from the message queue, and then processes the messages, that is, the processing of sending the operation request message of the product list import / export request and receiving the operation request message of the product list import / export request is not synchronous.
[0071] The MQ (Message Queue) message queue is a "first in, first out" data structure in the data structure and is used to store the information sent by the Handler.
[0072] Step S1300: Invoke the access interface and transmit the product list address to it for accessing the product list.
[0073] When a corresponding access interface needs to be invoked, an event mechanism can be used for triggering. Therefore, different execution action types in the list execution instruction will trigger the invocation of different access interfaces and pass parameters to the corresponding access interfaces. Thus, the access interface receives the product list address and the execution action type in the list execution instruction. Further, it verifies the execution action type in the execution instruction and correspondingly invokes the corresponding data acquisition method in the access interface, and accesses the product list according to the product list address.
[0074] Step S1400: The access interface performs an import or export process corresponding to the execution action type for the product list.
[0075] The access interface receives the action type in the list execution instruction, verifies the annotation of the action type to obtain whether it corresponds to an export type or an import type. Further, the access interface obtains the corresponding product list according to the product list address transmitted by the received list execution instruction, calls the method in the corresponding instantiated object that inherits from the template class and corresponds to the common business logic to implement the asynchronous message processing mechanism, sends an operation request message corresponding to the product list import / export request to the message queue and directly returns. After the message queue receives the operation request message corresponding to the product list import / export request, it dequeues the message according to the first-in-first-out execution order. The dequeued message is received by the access interface again, and the access interface can then perform the import / export operation of the product list to respond to the corresponding request. The request related to the list execution instruction and its corresponding execution action type is triggered by the online service in the e-commerce service system.
[0076] The process of the import operation is as follows: The access interface receives the product list import request of the corresponding import type triggered by the online service, and obtains the download link of the imported product list file in the request to perform the download operation. It calls the batch processing method of the import type in the access interface to format the data of each batch of imported product list files, and sequentially writes the data of each batch into the product list corresponding to the product list address to complete the update of the product information in the product list.
[0077] The process of the export operation is as follows: the access interface receives a commodity list export request of the corresponding export type triggered by the online service, obtains the commodity information of the commodity list according to the commodity list address, formats the commodity information, and then calls the batch processing method of the export type in the access interface to export the commodity information in each batch in pages, and then writes the pages into the export file in pages, and uploads the export file to the server to complete the export of the commodity information of the commodity list.
[0078] Through the disclosure of this exemplary embodiment, it can be seen that the present application can quickly and simply implement the access interface for accessing and storing the commodity list in an inheritance manner, which is convenient for quickly implementing the business logic of accessing the commodity list in a standardized manner in software engineering, and can solve the coupling problem brought by inheritance by deriving different subclasses to adapt to different requirements, and realize multiple different access methods with the same template class, which is convenient for high-performance and orderly import and export processing of commodity data according to execution instructions through the same class object.
[0079] Furthermore, by introducing an asynchronous message processing mechanism, it is possible to solve the conflict operations of importing and exporting the same commodity list, and the data structure of the message queue is used to solve the coupling problem brought by inheritance, and finally, the import and export processing of the corresponding commodity information is performed in a high-performance and orderly manner according to the execution instructions.
[0080] In addition, the derived subclasses of the template class inherit the methods and variables of the template class, and extend and implement the verification methods for import and export and the batch processing methods for the corresponding import and export information, and accurately perform batch operations on the import and export information according to the verification results, so as to avoid the server paralysis caused by excessive amount of information processed at one time.
[0081] Please refer to Figure 2 , in a further embodiment, matching the access interface of the instantiated object of the corresponding subclass among multiple subclasses derived from the template class according to the execution action type of the list execution instruction includes the following steps:
[0082] Step S1210: Judge the execution action type in the list execution instruction to determine that the execution action type is an import type or an export type;
[0083] Call the verification import and export methods in the access interface, and confirm that the execution action type is an import type or an export type by matching the execution action type and the annotation declaration in the access interface.
[0084] Step S1220: Determine the corresponding import access interface or export access interface according to the execution action type, and the import access interface and the export access interface are interfaces in the instantiated objects of different subclasses derived from the same model class.
[0085] The template class is a class that performs data operations on the product information in the product list. The data operations are specifically manifested as Getter and Setter methods. In one embodiment, by passing a specified parameter to the Getter method, the product list can be recursively traversed according to the specified parameter to obtain the product information corresponding to the parameter in the product list. Alternatively, by passing the specified parameter and its corresponding product information to the Setter method, the product information corresponding to the specified parameter in the product list can be set to the product information corresponding to the specified parameter.
[0086] The subclass is a subclass constructed by inheriting the template class. The subclass has the variables of the template class and Getter and Setter methods. One subclass adds an import type annotation declaration and overrides the inherited Getter method. The specified parameter in the Getter method is the product list address. The method is specifically implemented to obtain the corresponding product information according to the product list address. An object is constructed by instantiating the aforementioned subclass, and an import access interface is constructed according to the object. Another subclass adds an export type annotation declaration and overrides the inherited Setter method. The specified parameter in the Setter method is the product list address, and the product information corresponding to the specified parameter is the product information passed in during specific implementation. The method is specifically implemented to obtain the corresponding product list according to the product list address, traverse the product list according to the passed-in product information to find the corresponding position, and loop and update or add the product information in place. An object is constructed by instantiating the aforementioned subclass, and an export access interface is constructed according to the object.
[0087] In this embodiment, by further constructing the import and export access interfaces through subclass inheritance of the template class, the redundancy of code and data can be effectively reduced, and the import and export division of labor can be realized, which not only greatly increases the reusability of the code but also facilitates individual corresponding development.
[0088] Please refer to Figure 3 , in an extended embodiment, before receiving the list execution instruction, the following pre - steps are included:
[0089] Step S1000: Push the template class for overriding the subclass to the terminal device;
[0090] This embodiment meets the needs of the development scenario. When it is necessary to override the subclass, a pre - customized template class can be pushed to the terminal device where the developer is located for development reference. When the development of the template class is completed, it can be submitted to the server for processing. The server corresponding to the e - commerce system receives the template class, constructs the corresponding subclass by inheriting the template class, constructs the corresponding import and export classes for the overridden methods in the subclass, and temporarily stores the import and export classes in the thread cache for subsequent interface construction implementation.
[0091] Step S1010: Obtain a subclass that has rewritten the import access interface or export access interface based on the template class.
[0092] Obtain the import and export subclasses in the thread cache, and construct the import access interface and export access interface based on their corresponding instantiated objects. Specifically, it is implemented by receiving the execution action type and the commodity list address in the execution instruction, and passing them as parameters into the import and export verification methods and import and export execution methods, namely the corresponding Getter and Sertter methods, to implement the import and export functions of the commodity list.
[0093] Step S1020: Instantiate the subclass to obtain its corresponding instantiated object.
[0094] Instantiate the import and export subclasses to obtain their respective import objects and export objects. The import object and export object implement the methods for the import and export functions. By calling these methods, the import and export functions of the corresponding commodity list can be achieved.
[0095] Please refer to Figure 4 , in a further embodiment, the access interface performs the import or export process corresponding to the execution action type for the commodity list. The import process includes:
[0096] Step S1410: Parse the commodity list into an intermediate state data file, and the intermediate state data file is a comma-separated value file.
[0097] The access interface calls the import and export verification methods to verify that the execution action type in the received execution instruction is the import type, obtains the commodity list according to the commodity list address therein, and calls the import batching method of the instantiated object corresponding to the class encapsulated in the access interface to perform the corresponding import operation, and batch processes the commodity list, that is, sets the number of commodity objects corresponding to the commodity list in each batch, so as to split the commodity list. Specifically, the number is flexibly set by those skilled in the art according to the actual operating environment.
[0098] According to the commodity list of each batch, call the method for constructing the intermediate state data file of the instance object corresponding to the class in the access interface, parse the commodity list, and obtain the corresponding intermediate state data file. Specifically, the implementation is as follows: parse the commodity information corresponding to the commodity list of each batch. For each attribute field corresponding to the commodity information, it is usually specified by the data structure of the e-commerce platform. Accordingly, define a header structure unit for each attribute field, so that each header structure unit is used to map an attribute field. According to each of the attribute fields, traverse the commodity information of the commodity objects in the commodity list, read the attribute content corresponding to each attribute field, successively read out the full amount of information of each commodity object, use a comma to separate the attribute content under the same commodity object, construct all the attribute content of the same commodity object into a single-line data, and then, for the single-line data corresponding to each commodity object, write it into the intermediate state data file. The intermediate state data file can be stored as a CSV file, and the commodity information of each commodity object is stored as a row in the CSV file.
[0099] Step S1411: Pass the intermediate state data file to the data sharing storage service for processing;
[0100] The data sharing storage service uploads the intermediate state data file to the server as a backup of the original data cache and generates a corresponding download link. Until the transfer process of the data sharing storage service is completed, the server destroys the original data cache backup according to the recycling mechanism and reclaims the cache space occupied by the original data cache backup.
[0101] Since the download link of the intermediate state data file is provided, during the processing of the data sharing storage service, other online services can obtain the intermediate state data file through the download interface to perform operations such as file data reading, modification, and update without affecting the original intermediate state data file, ensuring the response to the request of other online services to obtain the intermediate state data file when the processing of the data sharing storage service is delayed or even fails.
[0102] Step S1412: The data sharing storage service transfers the intermediate state data file to the commodity database.
[0103] In one embodiment, the data sharing storage service quickly completes the operation of transferring the intermediate state data file. The data sharing storage service initiates a request to transfer the intermediate state data file from the cache to the product database. The server responds to the request and sends an allowed request status code to the data sharing storage service. After the data sharing storage service obtains the allowed request status code and verifies that the allowed request status code is the target status code, it obtains the intermediate state data file in the cache and stores it associated with the product list in the product database. Thus, the import operation of importing the product list into the product database is completed.
[0104] In another embodiment, the data sharing storage service delays the operation of transferring the intermediate state data file. When the data sharing storage service initiates a request to transfer the intermediate state data file and sends it to the server, at the same time, the server faces multiple other online services also initiating requests to operate on the product database. Therefore, the server performs an online service response priority ranking on the other online services and the data sharing storage service according to a certain scheduling rule. According to the current running memory situation and the priority ranking, it responds to the corresponding online services and returns an allowed request status code, and performs a blocking operation, returning a waiting status code to the other online services until the online service with a relatively higher priority has completed, and then returns an allowed request status code to the other online services in the waiting state. Therefore, the data sharing storage service may be blocked by the server. After the online service with a higher priority than it has completed, it then receives the allowed request status code returned by the server, and then completes the transfer of the intermediate state data file from the cache to the product database.
[0105] In this embodiment, by constructing the corresponding intermediate state data file for the same product list, the product lists in various different formats are effectively converted into intermediate state data files in a unified format, which is convenient for importing the product list using the same data structure corresponding to a data sharing storage service, saving the need for multiple online services corresponding to different data structure product lists for import operations, improving the software engineering development efficiency, and being beneficial to enhancing the robustness of the background system.
[0106] Please refer to Figure 5 , in a further embodiment, the access interface performs the import or export process corresponding to the execution action type for the product list, and the export process includes:
[0107] Step S1420: Parse the product list into an intermediate state data file, where the product list contains index information in the product database;
[0108] The access interface calls the import and export verification method to verify that the execution action type in the received execution instruction is the export type, obtains the product list according to the product list address therein, calls the export batching method of the instantiated object corresponding to the class encapsulated in the access interface to perform the corresponding export operation, and batches the product list, that is, sets the number of product objects corresponding to the product list in each batch, so as to split the product list. Specifically, the number is flexibly set by those skilled in the art according to the actual operating environment.
[0109] The product information in the product list can be sourced from the database. To make it correspond to the database, corresponding index information can be included in the product information so as to quickly locate the position of the product information in the database through the index information, facilitating subsequent access to the product information in the product list through the index information.
[0110] According to the product lists of each batch, call the method of constructing the intermediate state data file of the instantiated object corresponding to the class in the access interface, parse the product list and obtain the corresponding intermediate state data file. Specifically, it is implemented as follows: parse the product information corresponding to the product lists of each batch. For each attribute field corresponding to the product information, it is usually regulated by the data structure of the e-commerce platform. Accordingly, define a header structure unit for each attribute field, so that each header structure unit is used to map an attribute field. According to each of the attribute fields, traverse the product information of the product objects in the product list, read the attribute content corresponding to each attribute field therein. If the attribute content is empty, annotate and mark the header structure unit as an empty mark. Successively read out all the information of each product object, separate the attribute content under the same product object with commas, and construct all the attribute content of the same product object into a single-line data. Then, for the single-line data corresponding to each product object, write it into the intermediate state data file. The intermediate state data file can be stored as a CSV file, and the product information of each product object is stored as a line in the CSV file.
[0111] Step S1421: Pass the intermediate state data file to the data sharing storage service for processing;
[0112] The access interface passes the intermediate state data file constructed for the exported product list to the data sharing storage service. The data sharing storage service uploads the intermediate state data file to the server cache area as a raw data backup and generates a corresponding download link. Until the transfer processing of the data sharing storage service is completed, the server destroys the raw data cache backup according to the recycling mechanism and reclaims the cache space occupied by the raw data cache backup.
[0113] Since the download link of the intermediate state data file is provided, during the processing of the data sharing storage service, other online services can obtain the intermediate state data file through the download interface to perform operations such as file data reading, modification, and update without affecting the original intermediate state data file, ensuring the response to the request of other online services to obtain the intermediate state data file when the data sharing storage service processing is delayed or even fails.
[0114] Step S1422: The data sharing storage service transfers the intermediate state data file to a preset target storage address for third-party invocation.
[0115] The data public storage service obtains the intermediate state data file and can directly store the intermediate state data file at a preset target storage address for third-party invocation, thereby realizing data sharing and facilitating batch reference of data in software engineering.
[0116] In this embodiment, it can be seen that most of the processing logics of calling the corresponding access interfaces in the import and export processes are the same. Since the corresponding encapsulated classes are subclasses derived from the template class, the methods for batch processing and constructing the intermediate state data file have been implemented in the template class. Therefore, the subclass will inherit and rewrite the methods of the template class, reset the parameters passed into the methods to the corresponding parameters, and the corresponding method execution logics can be directly obtained through inheritance. The import and export access interfaces are quickly constructed through the instantiated objects of the class, improving the software engineering development efficiency.
[0117] Please refer to Figure 6 , a commodity list access device provided to meet one of the purposes of the present application, includes: an instruction receiving module 1100, an interface matching module 1200, an interface calling module 1300, and an interface execution module 1400. Among them, the instruction receiving module 1100 is used to receive a list execution instruction, and the list execution instruction includes an execution action type and a commodity list address. The commodity list corresponding to the commodity list address stores commodity information corresponding to multiple commodity objects; the interface matching module 1200 is used to match the access interface of the instantiated object of the corresponding subclass among multiple subclasses derived from the template class according to the execution action type of the list execution instruction; the interface calling module 1300 is used to call the access interface and transmit the commodity list address to it for accessing the commodity list; the interface execution module 1400 is used to execute the import or export process corresponding to the execution action type on the commodity list by the access interface.
[0118] In a further embodiment, the interface matching module includes: an execution type judgment sub-module, configured to judge the execution action type in the list execution instruction and determine that the execution action type is an import type or an export type; an interface confirmation sub-module, configured to determine a corresponding import access interface or export access interface according to the execution action type, where the import access interface and the export access interface are interfaces in instantiation objects of different subclasses derived from the same model class.
[0119] In an extended embodiment, the instruction receiving module further includes: a push sub-module, configured to push a template class for rewriting a subclass to a terminal device; an acquisition sub-module, configured to acquire a subclass in which the import access interface or the export access interface in the template class is rewritten; an instantiation sub-module, configured to instantiate the subclass to obtain its corresponding instantiation object.
[0120] In a further embodiment, the interface execution module includes: a parsing sub-module, configured to parse the product list into an intermediate state data file, where the intermediate state data file is a comma-separated value file; a transmission sub-module, configured to transmit the intermediate state data file to a data sharing storage service for processing; a transfer and storage sub-module, configured to transfer and store the intermediate state data file to a product database by the data sharing storage service.
[0121] In a further embodiment, the interface execution module includes: a parsing sub-module, configured to parse the product list into an intermediate state data file, where the product list includes index information in a product database; a transmission sub-module, configured to transmit the intermediate state data file to a data sharing storage service for processing; a transfer and storage sub-module, configured to transfer and store the intermediate state data file to a preset target storage address for third-party invocation by the data sharing storage service.
[0122] In a preferred embodiment, the list execution instruction is triggered by an online service in an e-commerce service system.
[0123] To solve the above technical problems, an embodiment of the present application further provides a computer device. As Figure 7As shown, it is a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. Among them, the computer-readable storage medium of the computer device stores an operating system, a database, and computer-readable instructions. The database can store a control information sequence. When the computer-readable instructions are executed by the processor, the processor can implement a method for accessing and storing a product list. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device can store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute the method for accessing and storing a product list of this application. The network interface of the computer device is used to connect and communicate with a terminal. Those skilled in the art can understand that Figure 7 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0124] In this embodiment, the processor is used to execute Figure 6 the specific functions of each module and its sub-modules in. The memory stores the program codes and various types of data required to execute the above-mentioned modules or sub-modules. The network interface is used for data transmission between the user terminal or the server. The memory in this embodiment stores the program codes and data required to execute all modules / sub-modules in the product list access device of this application. The server can call the program codes and data of the server to execute the functions of all sub-modules.
[0125] This application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors are caused to execute the steps of the method for accessing and storing a product list according to any embodiment of this application.
[0126] This application also provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by one or more processors, the steps of the method according to any embodiment of this application are implemented.
[0127] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments of the present application can be completed by instructing relevant hardware through a computer program. This computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the aforementioned storage medium can be a computer-readable storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0128] In summary, in the present application, since most of the processing logics are the same when calling the corresponding interfaces during the import and export processes, the classes corresponding to the encapsulation of the interfaces are subclasses derived from and constructed with template classes. For the methods of batching and constructing intermediate state data files, they have been implemented in the template class. Therefore, the subclass will inherit and rewrite the methods of the template class, reset the parameters passed into the methods to the corresponding parameters, and the corresponding method execution logics can be directly obtained through inheritance. Then, through the instantiated objects of the class, the import and export access interfaces can be quickly constructed, improving the software engineering development efficiency.
[0129] Those skilled in the art of the present technology can understand that the steps, measures, and solutions in the various operations, methods, and processes discussed in the present application can be alternated, changed, combined, or deleted. Further, the other steps, measures, and solutions in the various operations, methods, and processes discussed in the present application can also be alternated, changed, rearranged, decomposed, combined, or deleted. Further, the steps, measures, and solutions in the prior art that are the same as those disclosed in the various operations, methods, and processes in the present application can also be alternated, changed, rearranged, decomposed, combined, or deleted.
[0130] The above are only some implementation manners of the present application. It should be noted that for those of ordinary skill in the art of the present technology, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.
Claims
1. A method for accessing a commodity list, characterized in that, Including the following steps: Receiving a list execution instruction, where the list execution instruction includes an execution action type and a commodity list address, and commodity information corresponding to multiple commodity objects is stored in the commodity list corresponding to the commodity list address; Matching, according to the execution action type of the list execution instruction, the access interface of the instantiated object of the corresponding subclass among multiple subclasses derived from the template class, where the template class is used for asynchronous message processing of commodity list import and export operation requests, and the asynchronous message processing completes the import and export requests of the commodity list through a message queue; and the subclasses corresponding to different execution action types inherit the template class to implement derivation and override the access interfaces corresponding to the derived subclasses; Invoking the access interface and transmitting the commodity list address thereto for it to access the commodity list; The access interface performs the import or export process corresponding to the execution action type on the commodity list, where the import process includes: parsing the commodity list into an intermediate state data file, and the intermediate state data file is a comma-separated value file; passing the intermediate state data file to the data sharing storage service for processing; and the data sharing storage service transferring the intermediate state data file to a commodity database; the export process includes: parsing the commodity list into an intermediate state data file, and the commodity list includes index information in the commodity database; passing the intermediate state data file to the data sharing storage service for processing; and the data sharing storage service transferring the intermediate state data file to a preset target storage address for third-party invocation.
2. The method for accessing a commodity list according to claim 1, wherein Matching, according to the execution action type of the list execution instruction, the access interface of the instantiated object of the corresponding subclass among multiple subclasses derived from the template class includes the following steps: Judging the execution action type in the list execution instruction to determine that the execution action type is an import type or an export type; Determining the corresponding import access interface or export access interface according to the execution action type, and the import access interface and the export access interface are interfaces in instantiated objects of different subclasses derived from the same model class.
3. The method for accessing a product list according to claim 1, wherein Before receiving the list execution instruction, including the following pre-steps: Pushing a template class for overriding the subclass to the terminal device; Obtaining a subclass that overrides the import access interface or the export access interface therein based on the template class; Instantiating the subclass to obtain its corresponding instantiated object.
4. The method for accessing a product list according to any one of claims 1 to 3, characterized in that This method is implemented as a computer process and executed concurrently in response to multiple list execution instructions, and the list execution instructions are triggered by an online service in an e-commerce service system.
5. A commodity list access device, characterized in that, Including: An instruction receiving module for receiving a list execution instruction, where the list execution instruction includes an execution action type and a commodity list address, and commodity information corresponding to multiple commodity objects is stored in the commodity list corresponding to the commodity list address; An interface matching module, which is used to match the access interfaces of instantiated objects of corresponding subclasses among multiple subclasses derived from a template class according to the execution action type of the instruction in the list. The template class is used for asynchronous message processing of operation request messages for importing and exporting a product list. The asynchronous message processing completes the import and export requests of the product list through a message queue. Different subclasses corresponding to different execution action types inherit the template class to achieve derivation and override the corresponding access interfaces of the derived subclasses. An interface calling module, which is used to call the access interface and transmit the product list address to it for accessing the product list. An interface execution module, which is used to execute the corresponding import or export process for the product list by the access interface. The import process includes: parsing the product list into an intermediate state data file, where the intermediate state data file is a comma-separated value file; passing the intermediate state data file to the data sharing storage service for processing; and having the data sharing storage service transfer the intermediate state data file to a product database. The export process includes: parsing the product list into an intermediate state data file, where the product list contains index information in the product database; passing the intermediate state data file to the data sharing storage service for processing; and having the data sharing storage service transfer the intermediate state data file to a preset target storage address for third-party calling.
6. The merchandise list access device according to claim 5, wherein, The interface matching module includes: An execution type judgment sub-module, which is used to judge the execution action type in the list execution instruction and determine that the execution action type is an import type or an export type. An interface confirmation sub-module, which is used to determine the corresponding import access interface or export access interface according to the execution action type. The import access interface and the export access interface are interfaces in instantiated objects of different subclasses derived from the same model class.
7. The merchandise list access device according to claim 5, characterized in that, The instruction receiving module further includes: A push sub-module, which is used to push the template class for overriding the subclass to a terminal device. An acquisition sub-module, which is used to acquire the subclass that overrides the import access interface or the export access interface based on the template class. An instantiation sub-module, which is used to instantiate the subclass to obtain its corresponding instantiated object.
8. A computer device, comprising a central processing unit and a memory, characterized in that, The central processing unit is used to call and run the computer program stored in the memory to execute the steps of the method according to any one of claims 1 to 4.
9. A computer-readable storage medium, characterized in that, It stores in the form of computer-readable instructions a computer program implemented according to the method according to any one of claims 1 to 4. When the computer program is called and run by a computer, it executes the steps included in the corresponding method.
10. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Data loading method, device and equipment and storage medium thereof
CN111259047A
Data processing method and device, equipment and storage medium
CN112965694A