CN115907902A - Shopping cart data processing method, device, computing device and storage medium - Google Patents
Shopping cart data processing method, device, computing device and storage medium Download PDFInfo
- Publication number
- CN115907902A CN115907902A CN202211428169.8A CN202211428169A CN115907902A CN 115907902 A CN115907902 A CN 115907902A CN 202211428169 A CN202211428169 A CN 202211428169A CN 115907902 A CN115907902 A CN 115907902A
- Authority
- CN
- China
- Prior art keywords
- shopping cart
- commodity
- target
- group
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Cash Registers Or Receiving Machines (AREA)
Abstract
本发明实施例公开了一种购物车数据的处理方法、装置、计算设备及存储介质。方法包括:从索引表中查询目标用户对应的购物车商品组的商品组信息;购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的;根据商品组信息确定购物车商品组的商品组优先级,基于商品组优先级从目标用户对应的购物车商品组中确定出目标购物车商品组;获取用户端的购物车页面能够展示的购物车商品的第一数量,从目标购物车商品组中的购物车商品中获取第二数量的目标购物车商品的商品数据,第二数量与第一数量相匹配。本方案能够在保障当前购物车页面准确展示的基础上,减少系统的I/O开销,提升响应效率,提高购物车页面的展示效率。
The embodiment of the invention discloses a shopping cart data processing method, device, computing equipment and storage medium. The method includes: querying the commodity group information of the shopping cart commodity group corresponding to the target user from the index table; the shopping cart commodity group is obtained by dividing the shopping cart commodity corresponding to the target user according to a preset division dimension; determining the shopping cart according to the commodity group information; The commodity group priority of the cart commodity group, based on the commodity group priority, determines the target shopping cart commodity group from the shopping cart commodity group corresponding to the target user; obtains the first quantity of shopping cart commodities that can be displayed on the shopping cart page of the client, from Commodity data of a second quantity of the target shopping cart commodity is acquired from the shopping cart commodity in the target shopping cart commodity group, and the second quantity matches the first quantity. This solution can reduce the I/O overhead of the system, improve the response efficiency, and improve the display efficiency of the shopping cart page on the basis of ensuring the accurate display of the current shopping cart page.
Description
技术领域technical field
本发明实施例涉及数据处理技术领域,具体涉及一种购物车数据的处理方法、装置、计算设备及存储介质。The embodiments of the present invention relate to the technical field of data processing, and in particular to a shopping cart data processing method, device, computing device, and storage medium.
背景技术Background technique
随着科技及社会的不断发展,线上购物服务的出现极大丰富了人们的工作与生活。为了提升用户服务体验,线上购物服务通常会为用户提供虚拟购物车,该虚拟购物车中添加有用户欲购买商品的商品数据。With the continuous development of technology and society, the emergence of online shopping services has greatly enriched people's work and life. In order to improve user service experience, online shopping services usually provide users with a virtual shopping cart, and the virtual shopping cart is added with commodity data of commodities that the user wants to purchase.
现有技术的线上服务端在接收到用户的购物车数据展示请求时,是从数据库中获取该用户的所有购物车商品的商品数据,并将该用户对应的所有购物车商品的商品数据发送给用户端,由用户端根据相应的前端展示逻辑展示商品数据。When the online server in the prior art receives the user's shopping cart data display request, it obtains the product data of all the shopping cart products of the user from the database, and sends the product data of all the shopping cart products corresponding to the user to To the user terminal, the user terminal displays product data according to the corresponding front-end display logic.
然而,发明人在实施过程中发现,现有技术中存在如下缺陷:当用户的购物车商品较多时,采用现有技术的该种实施方式,系统的I/O开销大,请求响应效率低,购物车页面展示效率低下。However, the inventor found in the implementation process that there are the following defects in the prior art: when the user has a lot of items in the shopping cart, using this implementation mode of the prior art, the I/O overhead of the system is large, and the request response efficiency is low. Cart page display is inefficient.
发明内容Contents of the invention
鉴于现有技术中存在系统的I/O开销大,请求响应效率低,购物车页面展示效率低下的技术问题,提出了本发明实施例,以便提供一种克服上述问题或者至少部分地解决上述问题的购物车数据的处理方法、装置、计算设备及存储介质。In view of the technical problems of high system I/O overhead, low request response efficiency, and low efficiency of shopping cart page display in the prior art, the embodiments of the present invention are proposed to provide a solution to overcome the above problems or at least partially solve the above problems. A processing method, device, computing device, and storage medium for shopping cart data.
根据本发明实施例的第一方面,提供了一种购物车数据的处理方法,包括:According to a first aspect of an embodiment of the present invention, a method for processing shopping cart data is provided, including:
接收用户端的购物车数据获取请求,确定所述用户端对应的目标用户;receiving a shopping cart data acquisition request from the client, and determining the target user corresponding to the client;
从预先生成的索引表中查询所述目标用户对应的购物车商品组的商品组信息;其中,所述购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的;Querying the commodity group information of the shopping cart commodity group corresponding to the target user from the pre-generated index table; wherein, the shopping cart commodity group is obtained by dividing the shopping cart commodity corresponding to the target user according to a preset division dimension;
根据所述商品组信息确定所述购物车商品组的商品组优先级,并基于所述商品组优先级从所述目标用户对应的购物车商品组中确定出目标购物车商品组;determining a commodity group priority of the shopping cart commodity group according to the commodity group information, and determining a target shopping cart commodity group from shopping cart commodity groups corresponding to the target user based on the commodity group priority;
获取所述用户端的购物车页面能够展示的购物车商品的第一数量,根据所述第一数量从所述目标购物车商品组中的购物车商品中获取第二数量的目标购物车商品的商品数据;其中,所述第二数量与所述第一数量相匹配;Obtain the first quantity of the shopping cart items that can be displayed on the shopping cart page of the client, and acquire the second quantity of the target shopping cart items from the shopping cart items in the target shopping cart item group according to the first quantity data; wherein the second quantity matches the first quantity;
将第二数量的目标购物车商品的商品数据发送给所述用户端。Sending the commodity data of the second quantity of target shopping cart commodities to the client.
在一种可选的实施方式中,所述接收用户端的购物车数据获取请求进一步包括:接收用户端的指定数据分页的购物车数据获取请求;In an optional implementation manner, the receiving the shopping cart data acquisition request of the user terminal further includes: receiving the shopping cart data acquisition request of the user terminal specifying data paging;
则所述基于所述商品组优先级从所述目标用户对应的购物车商品组中确定出目标购物车商品组进一步包括:根据商品组优先级、购物车商品组中购物车商品的商品数量、以及所述第一数量,从所述目标用户对应的购物车商品组中确定出目标购物车商品组。Then, determining the target shopping cart commodity group from the shopping cart commodity group corresponding to the target user based on the commodity group priority further includes: according to the commodity group priority, the number of shopping cart commodities in the shopping cart commodity group, As well as the first quantity, the target shopping cart commodity group is determined from the shopping cart commodity groups corresponding to the target user.
在一种可选的实施方式中,所述根据所述第一数量从所述目标购物车商品组中的购物车商品中获取第二数量的目标购物车商品的商品数据进一步包括:In an optional implementation manner, the obtaining the commodity data of the target shopping cart commodity of the second quantity from the shopping cart commodities in the target shopping cart commodity group according to the first quantity further includes:
根据目标购物车商品组的商品组信息确定目标购物车商品组中购物车商品的商品优先级;Determine the commodity priority of the shopping cart commodities in the target shopping cart commodity group according to the commodity group information of the target shopping cart commodity group;
根据所述商品优先级确定第二数量的目标购物车商品;determining a second quantity of target shopping cart commodities according to the commodity priority;
根据目标购物车商品的商品标识,获取目标购物车商品的商品数据。Obtain the product data of the target shopping cart product according to the product identifier of the target shopping cart product.
在一种可选的实施方式中,所述方法还包括:In an optional embodiment, the method also includes:
接收购物车商品添加请求,确定所述购物车商品添加请求对应的用户以及添加的购物车商品所属的购物车商品组;Receive a shopping cart product addition request, determine the user corresponding to the shopping cart product addition request and the shopping cart product group to which the added shopping cart product belongs;
在所述索引表中更新该用户的所述所属的购物车商品组的商品组信息。The commodity group information of the shopping cart commodity group to which the user belongs is updated in the index table.
在一种可选的实施方式中,所述确定添加的购物车商品所属的购物车商品组进一步包括:In an optional implementation manner, the determining the shopping cart product group to which the added shopping cart product belongs further includes:
判断所述添加的购物车商品是否为预设类型;Determine whether the added shopping cart item is a preset type;
若是,则确定添加的购物车商品所属的购物车商品组;If so, determine the shopping cart product group to which the added shopping cart product belongs;
则所述购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的进一步包括:所述购物车商品组是按照预设划分维度对目标用户对应的预设类型的购物车商品进行划分得到的。Then the shopping cart commodity group is obtained by dividing the shopping cart commodities corresponding to the target user according to the preset division dimension. It is obtained by dividing car products.
在一种可选的实施方式中,所述预设类型通过如下方式确定:In an optional implementation manner, the preset type is determined in the following manner:
获取历史时段内的多个用户对应的购物车商品的商品类型;Obtain the product types of the shopping cart products corresponding to multiple users in the historical period;
针对于任一商品类型,统计隶属该商品类型的购物车商品的商品数量;For any product type, count the number of products in the shopping cart belonging to the product type;
根据各个商品类型对应的商品数量,从商品类型中确定出预设类型。According to the quantity of commodities corresponding to each commodity type, the preset type is determined from the commodity types.
在一种可选的实施方式中,所述方法还包括:In an optional embodiment, the method also includes:
接收所述用户端的针对购物车商品的移除请求,确定移除的购物车商品的第三数量;receiving a removal request from the client for shopping cart items, and determining a third quantity of removed shopping cart items;
基于商品组优先级从目标用户对应的购物车商品组中确定出当前的目标购物车商品组,从所述目标购物车商品组中的购物车商品中获取第三数量的目标购物车商品的商品数据,将第三数量的目标购物车商品的商品数据发送给所述用户端。Determine the current target shopping cart commodity group from the shopping cart commodity group corresponding to the target user based on the priority of the commodity group, and obtain the third quantity of the target shopping cart commodity from the shopping cart commodities in the target shopping cart commodity group data, sending the product data of the third quantity of target shopping cart products to the client.
在一种可选的实施方式中,在所述从预先生成的索引表中查询所述目标用户对应的购物车商品组的商品组信息之前,所述方法还包括:从预先生成的索引表中查询所述目标用户对应的购物车商品的商品总数;判断所述商品总数是否超出预设阈值;若否,则获取所述目标用户对应的所有购物车商品的商品数据,并将所述所有购物车商品的商品数据发送给用户端;In an optional implementation manner, before querying the product group information of the shopping cart product group corresponding to the target user from the pre-generated index table, the method further includes: from the pre-generated index table Query the total number of items in the shopping cart corresponding to the target user; determine whether the total number of items exceeds a preset threshold; if not, obtain the item data of all items in the shopping cart corresponding to the target user, and store all items in the shopping cart The product data of the car product is sent to the client;
则所述从预先生成的索引表中查询所述目标用户对应的购物车商品组的商品组信息进一步包括:若所述商品总数超出预设阈值,则从预先生成的索引表中查询所述目标用户对应的购物车商品组的商品组信息。Then, querying the commodity group information of the shopping cart commodity group corresponding to the target user from the pre-generated index table further includes: if the total number of commodities exceeds a preset threshold, querying the target user from the pre-generated index table Commodity group information of the shopping cart commodity group corresponding to the user.
在一种可选的实施方式中,所述索引表位于系统缓存中;In an optional implementation manner, the index table is located in the system cache;
和/或,所述获取第二数量的目标购物车商品的商品数据进一步包括:针对于任一商品数据,判断系统内存中是否存在所述商品数据,若是则从系统内存中获取所述商品数据;若系统内存中不存在所述商品数据,则判断系统缓存中是否存在所述商品数据,若是,则从系统缓存中获取所述商品数据;若系统缓存中不存在所述商品数据,则从数据库中获取所述商品数据。And/or, the acquiring the commodity data of the second quantity of target shopping cart commodities further includes: for any commodity data, judging whether the commodity data exists in the system memory, and if so, acquiring the commodity data from the system memory ; If the commodity data does not exist in the system memory, it is judged whether the commodity data exists in the system cache, and if so, the commodity data is obtained from the system cache; if the commodity data does not exist in the system cache, then the Obtain the commodity data from the database.
根据本发明实施例的第二方面,提供了一种购物车数据的处理装置,包括:According to a second aspect of the embodiments of the present invention, a shopping cart data processing device is provided, including:
接收模块,用于接收用户端的购物车数据获取请求;The receiving module is used to receive the shopping cart data acquisition request from the client;
用户确定模块,用于确定所述用户端对应的目标用户;a user determination module, configured to determine a target user corresponding to the client;
查询模块,用于从预先生成的索引表中查询所述目标用户对应的购物车商品组的商品组信息;其中,所述购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的;The query module is used to query the commodity group information of the shopping cart commodity group corresponding to the target user from the pre-generated index table; wherein, the shopping cart commodity group is the shopping cart commodity corresponding to the target user according to the preset division dimension obtained by division;
商品组确定模块,用于根据所述商品组信息确定所述购物车商品组的商品组优先级,并基于所述商品组优先级从所述目标用户对应的购物车商品组中确定出目标购物车商品组;The commodity group determination module is configured to determine the commodity group priority of the shopping cart commodity group according to the commodity group information, and determine the target shopping cart from the shopping cart commodity group corresponding to the target user based on the commodity group priority. Car commodity group;
获取模块,用于获取所述用户端的购物车页面能够展示的购物车商品的第一数量,根据所述第一数量从所述目标购物车商品组中的购物车商品中获取第二数量的目标购物车商品的商品数据;其中,所述第二数量与所述第一数量相匹配;An acquisition module, configured to acquire a first quantity of shopping cart items that can be displayed on the shopping cart page of the user terminal, and acquire a second quantity of objects from the shopping cart items in the target shopping cart item group according to the first quantity Commodity data of shopping cart commodities; wherein the second quantity matches the first quantity;
发送模块,用于将第二数量的目标购物车商品的商品数据发送给所述用户端。A sending module, configured to send the commodity data of the second quantity of target shopping cart commodities to the client.
在一种可选的实施方式中,接收模块用于:接收用户端的指定数据分页的购物车数据获取请求;In an optional implementation manner, the receiving module is configured to: receive a shopping cart data acquisition request of a specified data page from the client;
商品组确定模块用于:根据商品组优先级、购物车商品组中购物车商品的商品数量、以及所述第一数量,从所述目标用户对应的购物车商品组中确定出目标购物车商品组。The commodity group determination module is configured to: determine the target shopping cart commodity from the shopping cart commodity group corresponding to the target user according to the priority of the commodity group, the quantity of the shopping cart commodity in the shopping cart commodity group, and the first quantity Group.
在一种可选的实施方式中,获取模块用于:根据目标购物车商品组的商品组信息确定目标购物车商品组中购物车商品的商品优先级;根据所述商品优先级确定第二数量的目标购物车商品;根据目标购物车商品的商品标识,获取目标购物车商品的商品数据。In an optional implementation manner, the obtaining module is configured to: determine the commodity priority of the shopping cart commodities in the target shopping cart commodity group according to the commodity group information of the target shopping cart commodity group; determine the second quantity according to the commodity priority The target shopping cart product; according to the product identifier of the target shopping cart product, obtain the product data of the target shopping cart product.
在一种可选的实施方式中,接收模块用于:接收购物车商品添加请求;In an optional implementation manner, the receiving module is configured to: receive a shopping cart item addition request;
该装置还包括:更新模块,用于确定所述购物车商品添加请求对应的用户以及添加的购物车商品所属的购物车商品组;在所述索引表中更新该用户的所述所属的购物车商品组的商品组信息。The device also includes: an update module, configured to determine the user corresponding to the shopping cart product addition request and the shopping cart product group to which the added shopping cart product belongs; update the user's belonging shopping cart in the index table Product group information for the product group.
在一种可选的实施方式中,更新模块用于:判断所述添加的购物车商品是否为预设类型;若是,则确定添加的购物车商品所属的购物车商品组;In an optional implementation manner, the update module is used to: determine whether the added shopping cart product is a preset type; if so, determine the shopping cart product group to which the added shopping cart product belongs;
则所述购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的进一步包括:所述购物车商品组是按照预设划分维度对目标用户对应的预设类型的购物车商品进行划分得到的。Then the shopping cart commodity group is obtained by dividing the shopping cart commodities corresponding to the target user according to the preset division dimension. It is obtained by dividing car products.
在一种可选的实施方式中,该装置还包括:类型确定模块,用于获取历史时段内的多个用户对应的购物车商品的商品类型;In an optional implementation manner, the device further includes: a type determination module, configured to acquire the item types of the shopping cart items corresponding to multiple users within the historical period;
针对于任一商品类型,统计隶属该商品类型的购物车商品的商品数量;For any product type, count the number of products in the shopping cart belonging to the product type;
根据各个商品类型对应的商品数量,从商品类型中确定出预设类型。According to the quantity of commodities corresponding to each commodity type, the preset type is determined from the commodity types.
在一种可选的实施方式中,接收模块用于:接收所述用户端的针对购物车商品的移除请求;In an optional implementation manner, the receiving module is configured to: receive a removal request from the user terminal for items in the shopping cart;
该装置还包括:移除处理模块,用于确定移除的购物车商品的第三数量;基于商品组优先级从目标用户对应的购物车商品组中确定出当前的目标购物车商品组,从所述目标购物车商品组中的购物车商品中获取第三数量的目标购物车商品的商品数据;The device also includes: a removal processing module, configured to determine the third quantity of removed shopping cart items; determine the current target shopping cart item group from the shopping cart item groups corresponding to the target user based on the priority of the item group, from Acquiring commodity data of a third quantity of target shopping cart commodities among the shopping cart commodities in the target shopping cart commodity group;
发送模块,用于将第三数量的目标购物车商品的商品数据发送给所述用户端。A sending module, configured to send the product data of the third quantity of target shopping cart products to the client.
在一种可选的实施方式中,该装置还包括:判断模块,用于从预先生成的索引表中查询所述目标用户对应的购物车商品的商品总数;判断所述商品总数是否超出预设阈值;In an optional implementation manner, the device further includes: a judging module, configured to query the total number of items in the shopping cart corresponding to the target user from a pre-generated index table; determine whether the total number of items exceeds the preset threshold;
则获取模块用于:在所述判断模块判断结果为否时,获取所述目标用户对应的所有购物车商品的商品数据,并将所述所有购物车商品的商品数据发送给用户端;The acquiring module is used to: when the judgment result of the judging module is No, acquire the commodity data of all the shopping cart commodities corresponding to the target user, and send the commodity data of all the shopping cart commodities to the client;
则查询模块用于:若所述商品总数超出预设阈值,则从预先生成的索引表中查询所述目标用户对应的购物车商品组的商品组信息。The query module is configured to: if the total number of commodities exceeds a preset threshold, query the commodity group information of the shopping cart commodity group corresponding to the target user from the pre-generated index table.
在一种可选的实施方式中,所述索引表位于系统缓存中;In an optional implementation manner, the index table is located in the system cache;
和/或,获取模块用于:针对于任一商品数据,判断系统内存中是否存在所述商品数据,若是则从系统内存中获取所述商品数据;若系统内存中不存在所述商品数据,则判断系统缓存中是否存在所述商品数据,若是,则从系统缓存中获取所述商品数据;若系统缓存中不存在所述商品数据,则从数据库中获取所述商品数据。And/or, the acquisition module is used to: for any commodity data, determine whether the commodity data exists in the system memory, and if so, obtain the commodity data from the system memory; if the commodity data does not exist in the system memory, It is then judged whether the commodity data exists in the system cache, and if so, the commodity data is obtained from the system cache; if the commodity data does not exist in the system cache, the commodity data is obtained from the database.
根据本发明实施例的第三方面,提供了一种计算设备,包括:处理器、存储器、通信接口和通信总线,所述处理器、所述存储器和所述通信接口通过所述通信总线完成相互间的通信;According to a third aspect of the embodiments of the present invention, there is provided a computing device, including: a processor, a memory, a communication interface, and a communication bus, and the processor, the memory, and the communication interface complete the communication through the communication bus. communication between
所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行上述购物车数据的处理方法对应的操作。The memory is used to store at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the above shopping cart data processing method.
根据本发明实施例的第四方面,提供了一种计算机存储介质,所述存储介质中存储有至少一可执行指令,所述可执行指令使处理器执行上述购物车数据的处理方法对应的操作。According to a fourth aspect of the embodiments of the present invention, there is provided a computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction causes the processor to perform operations corresponding to the above shopping cart data processing method .
本发明实施例在接收用户端的购物车数据获取请求后,并未从数据库中获取目标用户对应的所有购物车商品的商品数据,而是通过查找索引表中目标用户对应的购物车商品组的商品组信息,以确定购物车商品组的优先级,进而确定出目标购物车商品组,从该目标购物车商品组中提取出与购物车页面展示的购物车商品数量匹配的目标购物车商品的商品数据,从而在能够保障当前购物车页面准确展示的基础上,减少系统的I/O开销,提升响应效率,提高购物车页面的展示效率。In the embodiment of the present invention, after receiving the shopping cart data acquisition request from the client, the product data of all the shopping cart products corresponding to the target user are not obtained from the database, but the product data of the shopping cart product group corresponding to the target user is searched in the index table. Group information to determine the priority of the shopping cart product group, and then determine the target shopping cart product group, and extract the target shopping cart product that matches the number of shopping cart products displayed on the shopping cart page from the target shopping cart product group Data, so as to ensure the accurate display of the current shopping cart page, reduce the I/O overhead of the system, improve response efficiency, and improve the display efficiency of the shopping cart page.
本发明实施例接收用户端的指定数据分页的购物车数据获取请求,根据商品组优先级、购物车商品组中购物车商品的商品数量、以及第一数量,从目标用户对应的购物车商品组中确定出目标购物车商品组,从而能够准确地获取到在该数据分页中展示的购物车商品的商品数据,提升购物车页面的展示效率。The embodiment of the present invention receives the shopping cart data acquisition request of the specified data pagination from the client, and selects from the shopping cart commodity group corresponding to the target user according to the commodity group priority, the number of shopping cart commodities in the shopping cart commodity group, and the first quantity. The target shopping cart product group is determined, so that the product data of the shopping cart products displayed in the data page can be accurately obtained, and the display efficiency of the shopping cart page is improved.
本发明实施例根据目标购物车商品组的商品组信息确定目标购物车商品组中购物车商品的商品优先级,根据商品优先级确定第二数量的目标购物车商品,根据目标购物车商品的商品标识,获取目标购物车商品的商品数据,从而能够预先确定商品优先级,继而准确地确定出待在购物车页面展示的目标购物车商品,提升购物车页面的展示精度。The embodiment of the present invention determines the commodity priority of the shopping cart commodity in the target shopping cart commodity group according to the commodity group information of the target shopping cart commodity group, determines the second number of target shopping cart commodities according to the commodity priority, and determines the second quantity of target shopping cart commodities according to the commodity of the target shopping cart commodity Identify and obtain the product data of the target shopping cart product, so that the priority of the product can be determined in advance, and then the target shopping cart product to be displayed on the shopping cart page can be accurately determined, and the display accuracy of the shopping cart page can be improved.
本发明实施例接收购物车商品添加请求,确定购物车商品添加请求对应的用户以及添加的购物车商品所属的购物车商品组,同步更新索引表,从而保障后续的商品数据的获取精度。The embodiment of the present invention receives a shopping cart product addition request, determines the user corresponding to the shopping cart product addition request and the shopping cart product group to which the added shopping cart product belongs, and updates the index table synchronously, thereby ensuring the accuracy of subsequent product data acquisition.
本发明实施例判断添加的购物车商品的类型,在为预设类型的情况下才确定添加的购物车商品所属的购物车商品组,从而仅对预设类型的购物车商品进行分组,以及仅获取部分的预设类型的购物车商品,节约系统计算资源。The embodiment of the present invention judges the type of the added shopping cart product, and only determines the shopping cart product group to which the added shopping cart product belongs when it is a preset type, so that only the shopping cart products of the preset type are grouped, and only Obtain some preset types of shopping cart products to save system computing resources.
本发明实施例获取历史时段内的多个用户对应的购物车商品的商品类型,计算隶属各个商品类型的购物车商品的商品数量,根据各个商品类型对应的商品数量,从商品类型中确定出预设类型,从而能够通过大数据分析自动地确定出通常包含的购物车商品数量多的预设类型。The embodiment of the present invention acquires the commodity types of the shopping cart commodities corresponding to multiple users in the historical period, calculates the quantity of the shopping cart commodities belonging to each commodity type, and determines the predetermined value from the commodity types according to the quantity of commodities corresponding to each commodity type. The preset type can automatically determine the preset type that usually contains a large number of items in the shopping cart through big data analysis.
本发明实施例接收用户端的针对购物车商品的移除请求,确定移除的购物车商品的第三数量,并从目标购物车商品组中的购物车商品中获取第三数量的目标购物车商品的商品数据,从而提升数据获取效率以及购物车页面的更新速度。The embodiment of the present invention receives a removal request from a user terminal for shopping cart items, determines a third quantity of removed shopping cart items, and obtains the third quantity of target shopping cart items from the shopping cart items in the target shopping cart item group Product data, thereby improving the efficiency of data acquisition and the update speed of the shopping cart page.
本发明实施例从预先生成的索引表中查询目标用户对应的购物车商品的商品总数,在商品总数超出预设阈值的情况下,获取第二数量的目标购物车商品的商品数据;在商品总数未超出预设阈值的情况下,获取目标用户对应的所有购物车商品的商品数据,从而兼顾系统计算资源以及I/O开销。In this embodiment of the present invention, the total number of items in the shopping cart corresponding to the target user is queried from the pre-generated index table, and when the total number of items exceeds a preset threshold, the item data of the second quantity of target shopping cart items is obtained; If the preset threshold is not exceeded, the product data of all shopping cart products corresponding to the target user is obtained, so as to take into account system computing resources and I/O overhead.
本发明实施例中索引表位于系统缓存中,从而减少对数据库的操作,提升数据获取效率;并且采用系统内存、系统缓存至数据库多级数据查询方式,能够减少从数据库中获取数据的频次,提升商品数据整体的获取效率。In the embodiment of the present invention, the index table is located in the system cache, thereby reducing the operation of the database and improving the efficiency of data acquisition; and adopting the multi-level data query method from the system memory and the system cache to the database can reduce the frequency of obtaining data from the database and improve The overall acquisition efficiency of commodity data.
上述说明仅是本发明实施例技术方案的概述,为了能够更清楚了解本发明实施例的技术手段,而可依照说明书的内容予以实施,并且为了让本发明实施例的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明实施例的具体实施方式。The above description is only an overview of the technical solutions of the embodiments of the present invention. In order to better understand the technical means of the embodiments of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and The advantages can be more obvious and understandable, and the specific implementation manners of the embodiments of the present invention are enumerated below.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明实施例的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating the preferred embodiments and are not considered as limiting the embodiments of the present invention. Also throughout the drawings, the same reference numerals are used to designate the same components. In the attached picture:
图1示出了本发明实施例提供的一种购物车数据的处理方法的流程示意图;FIG. 1 shows a schematic flowchart of a method for processing shopping cart data provided by an embodiment of the present invention;
图2示出了本发明实施例提供的又一种购物车数据的处理方法的流程示意图;Fig. 2 shows a schematic flowchart of another shopping cart data processing method provided by an embodiment of the present invention;
图3示出了本发明实施例提供的再一种购物车数据的处理方法的流程示意图;Fig. 3 shows a schematic flowchart of another shopping cart data processing method provided by an embodiment of the present invention;
图4示出了本发明实施例提供的一种购物车数据的处理装置的结构示意图;Fig. 4 shows a schematic structural diagram of a processing device for shopping cart data provided by an embodiment of the present invention;
图5示出了本发明实施例提供的一种购物车数据的处理系统的结构示意图;FIG. 5 shows a schematic structural diagram of a shopping cart data processing system provided by an embodiment of the present invention;
图6示出了本发明实施例提供的一种计算设备的结构示意图。Fig. 6 shows a schematic structural diagram of a computing device provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将参照附图更详细地描述本发明实施例的示例性实施例。虽然附图中显示了本发明实施例的示例性实施例,然而应当理解,可以以各种形式实现本发明实施例而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本发明实施例,并且能够将本发明实施例的范围完整的传达给本领域的技术人员。Exemplary embodiments of embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While the drawings show exemplary embodiments of the invention, it should be understood that the invention may be embodied in various forms and should not be limited to the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the embodiments of the present invention and to fully convey the scope of the embodiments of the present invention to those skilled in the art.
图1示出了本发明实施例提供的一种购物车数据的处理方法的流程示意图。本发明实施例中的流程图不用于对执行步骤的顺序进行限定。根据需要,还可以对该流程图中的部分步骤进行添加或删减。其中,本实施例所提供的购物车数据的处理方法可以由预设的服务器执行。Fig. 1 shows a schematic flowchart of a method for processing shopping cart data provided by an embodiment of the present invention. The flow charts in the embodiments of the present invention are not used to limit the sequence of execution steps. Some steps in the flow chart can also be added or deleted as needed. Wherein, the shopping cart data processing method provided in this embodiment may be executed by a preset server.
具体地,如图1所示,该方法包括如下步骤:Specifically, as shown in Figure 1, the method includes the following steps:
步骤S110,接收用户端的购物车数据获取请求,确定该用户端对应的目标用户。Step S110, receiving the shopping cart data acquisition request from the client, and determining the target user corresponding to the client.
用户端是指商品购买方所使用的客户端,该客户端包括但不限于:APP、小程序、快应用、公众号等等。用户端为用户提供有虚拟购物车功能,用户可以将欲购买的商品添加至该虚拟购物车,系统也可以将某些商品(如购买某商品的赠品、参与活动抽取得到的奖励商品等)自动添加至该虚拟购物车中。The client refers to the client used by the buyer of the commodity, which includes but is not limited to: APP, applet, quick app, official account, etc. The client side provides users with a virtual shopping cart function. Users can add the products they want to buy to the virtual shopping cart, and the system can also automatically add some products (such as gifts for purchasing a product, reward products for participating in activities, etc.) Add to this virtual shopping cart.
用户在要查看该虚拟购物车中的购物车数据时,可以通过在用户端中的相应触发操作触发购物车数据获取请求的生成。例如,用户可以点击用户端中的“购物车”控件,从而在用户端中生成购物车数据获取请求,还可以通过相应快捷键操作、语音控制操作等等来触发购物车数据获取请求的生成。购物车数据获取请求生成后发送至服务端。When the user wants to view the shopping cart data in the virtual shopping cart, the generation of the shopping cart data acquisition request can be triggered by a corresponding trigger operation in the user terminal. For example, the user can click the "shopping cart" control in the client to generate a shopping cart data acquisition request in the client, and can also trigger the generation of the shopping cart data acquisition request through corresponding shortcut key operations, voice control operations, and the like. The shopping cart data acquisition request is generated and sent to the server.
服务端在接收到用户端的购物车数据获取请求之后,对用户端当前用户进行身份识别,从而确定出该用户端对应的用户,该用户端对应的用户便是目标用户。After receiving the shopping cart data acquisition request from the client, the server identifies the current user of the client to determine the user corresponding to the client, and the user corresponding to the client is the target user.
步骤S120,从预先生成的索引表中查询目标用户对应的购物车商品组的商品组信息;其中,该购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的。Step S120, querying the commodity group information of the shopping cart commodity group corresponding to the target user from the pre-generated index table; wherein, the shopping cart commodity group is obtained by dividing the shopping cart commodity corresponding to the target user according to a preset division dimension.
现有技术中,服务端在接收到用户端的购物车数据获取请求之后,便直接从数据库中获取用户对应的所有的购物车商品的商品数据,并将该所有的购物车商品的商品数据返回给用户端。本发明实施例与现有技术不同的是,本发明实施例中的服务端在接收到用户端的购物车数据获取请求之后,并未从数据库提取目标用户对应的所有的购物车商品的商品数据,而是先获取目标用户对应的部分购物车商品的商品数据,以满足当前购物车页面的展示需求,从而减小I/O开销,提升响应效率。In the prior art, after receiving the shopping cart data acquisition request from the client, the server directly obtains the commodity data of all the shopping cart commodities corresponding to the user from the database, and returns the commodity data of all the shopping cart commodities to the user terminal. The difference between the embodiment of the present invention and the prior art is that the server in the embodiment of the present invention does not extract the product data of all the shopping cart products corresponding to the target user from the database after receiving the shopping cart data acquisition request from the client. Instead, first obtain the product data of some shopping cart products corresponding to the target user to meet the display requirements of the current shopping cart page, thereby reducing I/O overhead and improving response efficiency.
在具体实施过程中,本发明实施例预先生成有索引表,该索引表中包含有至少一个用户对应的购物车商品组的商品组信息。其中,用户对应的购物车商品组是按照预设划分维度对该用户对应的购物车商品进行划分得到的,由此目标用户对应的购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的。其中,用户对应的购物车商品是指添加至该用户虚拟购物车的商品。In a specific implementation process, an index table is pre-generated in the embodiment of the present invention, and the index table includes commodity group information of a shopping cart commodity group corresponding to at least one user. Wherein, the shopping cart commodity group corresponding to the user is obtained by dividing the shopping cart commodity corresponding to the user according to the preset division dimension, so the shopping cart commodity group corresponding to the target user is the shopping cart corresponding to the target user according to the preset division dimension It is obtained by dividing car products. Wherein, the items in the shopping cart corresponding to the user refer to the items added to the user's virtual shopping cart.
例如,可以按照店铺维度对用户对应的购物车商品进行划分,从而每个购物车商品组对应于一个店铺,同一购物车商品组包含的购物车商品隶属于同一店铺。还可以按照活动维度对用户对应的购物车商品进行划分,从而每个购物车商品组对应于一个活动,同一购物车商品组包含的购物车商品隶属于同一活动,等等。本发明实施例对具体的划分维度和划分方式不作限定。For example, the shopping cart items corresponding to the user may be divided according to the store dimension, so that each shopping cart item group corresponds to a store, and the shopping cart items included in the same shopping cart item group belong to the same store. The shopping cart items corresponding to the user can also be divided according to the activity dimension, so that each shopping cart item group corresponds to an activity, and the shopping cart items included in the same shopping cart item group belong to the same activity, and so on. The embodiments of the present invention do not limit specific division dimensions and division methods.
每个商品组具有相应的商品组信息,商品组信息是用于描述该购物车商品组中购物车商品的情况的信息。例如,该商品组信息可以包括:隶属该购物车商品组的购物车商品的商品总数、隶属该购物车商品组的购物车商品的添加购物车时间、隶属该购物车商品组的购物车商品的商品类型、和/或隶属该购物车商品组的购物车商品的商品标识等等。Each commodity group has corresponding commodity group information, and the commodity group information is information used to describe the conditions of the shopping cart commodities in the shopping cart commodity group. For example, the commodity group information may include: the total number of items in the shopping cart belonging to the shopping cart commodity group, the time when the shopping cart commodities belonging to the shopping cart commodity group were added to the shopping cart, the time of the shopping cart commodities belonging to the shopping cart commodity group Commodity type, and/or commodity identifiers of shopping cart commodities belonging to the shopping cart commodity group, etc.
在一种可选的实施方式中,该索引表可以优先存储于系统缓存中,从而减少对数据库的查询次数,降低数据库压力,以及提升本方法的执行效率。In an optional implementation manner, the index table may be preferentially stored in the system cache, thereby reducing the number of queries to the database, reducing pressure on the database, and improving the execution efficiency of the method.
步骤S130,根据目标用户对应的购物车商品组的商品组信息,确定目标用户对应的购物车商品组的商品组优先级,并基于该商品组优先级从目标用户对应的购物车商品组中确定出目标购物车商品组。Step S130, according to the commodity group information of the shopping cart commodity group corresponding to the target user, determine the commodity group priority of the shopping cart commodity group corresponding to the target user, and determine from the shopping cart commodity group corresponding to the target user based on the commodity group priority Exit the target shopping cart product group.
根据商品组信息,可以确定目标用户对应的购物车商品组的商品组优先级。例如,可以根据购物车商品组中最晚添加购物车的购物车商品的添加购物车时间,确定商品组优先级,其中,最晚添加购物车的购物车商品的添加购物车时间越晚,对应的购物车商品组的优先级越高;还可以根据购物车商品组中购物车商品的商品类型的优先级,确定商品组优先级,其中,购物车商品的商品类型的优先级越高,对应的购物车商品组的优先级越高。本发明实施例对具体的优先级确定方式不作限定。According to the commodity group information, the commodity group priority of the shopping cart commodity group corresponding to the target user can be determined. For example, the priority of the product group can be determined according to the adding time of the shopping cart product added to the shopping cart latest in the shopping cart product group, wherein the later the adding time of the shopping cart product added to the shopping cart, the corresponding The higher the priority of the shopping cart product group; the priority of the product group can also be determined according to the priority of the product type of the shopping cart product in the shopping cart product group, wherein the higher the priority of the product type of the shopping cart product, the corresponding The higher the priority of the shopping cart item group. The embodiment of the present invention does not limit the specific way of determining the priority.
基于商品组优先级从目标用户对应的购物车商品组中确定出目标购物车商品组。其中,确定出的目标购物车商品组可以为一个或多个。该目标购物车商品组中的购物车商品是当前购物车页面需要展示的购物车商品。A target shopping cart commodity group is determined from shopping cart commodity groups corresponding to the target user based on commodity group priorities. Wherein, there may be one or more determined target shopping cart commodity groups. The shopping cart items in the target shopping cart item group are the shopping cart items to be displayed on the current shopping cart page.
在一种可选的实施方式中,在目标用户对应的购物车商品较多的情况下,会通过数据分页的形式展示购物车商品的商品数据,即在每个数据分页中展示部分购物车商品的商品数据。则本发明实施例中具体是服务端接收用户端的指定数据分页的购物车数据获取请求。则在确定目标购物车商品组时,具体是根据商品组优先级、购物车商品组中购物车商品的商品数量、以及用户端的购物车页面能够展示的购物车商品的第一数量,从目标用户对应的购物车商品组中确定出目标购物车商品组。其中,用户端的购物车页面能够展示的购物车商品的数量为第一数量,本实施方式中,第一数量具体是指定数据分页所能够展示的购物车商品的数量。例如,每个数据分页能够展示的购物车商品相同,可以均为20个,则第一数量便是20。In an optional implementation, when the target user has many items in the shopping cart, the product data of the shopping cart items will be displayed in the form of data pages, that is, part of the shopping cart items will be displayed in each data page product data. Then in the embodiment of the present invention, specifically, the server receives the shopping cart data acquisition request of the specified data page from the client. Then, when determining the target shopping cart product group, specifically, according to the priority of the product group, the number of shopping cart products in the shopping cart product group, and the first number of shopping cart products that can be displayed on the shopping cart page of the user terminal, the target user The target shopping cart product group is determined from the corresponding shopping cart product group. Wherein, the number of items in the shopping cart that can be displayed on the shopping cart page of the user terminal is the first number, and in this embodiment, the first number is specifically the number of items in the shopping cart that can be displayed on the designated data page. For example, each data page can display the same shopping cart items, which may be 20, and the first quantity is 20.
具体地,确定指定数据分页之前所有数据分页能够展示的购物车商品的数量总和SUM_1以及数据分页能够展示的购物车商品的数量N。进一步地,按照商品组优先级由高至低的顺序对购物车商品组进行排序,针对于位序为i的购物车商品组,其包含的购物车商品的数量为P_i,前i-1个购物车商品组包含的购物车商品的数量总和为SUM_2,若SUM_1≤SUM_2<SUM_1+N,则确定位序为i的购物车商品组为目标购物车商品组;和/或,若SUM_1<SUM_2+P_i≤SUM_1+N,则确定位序为i的购物车商品组为目标购物车商品组;和/或,若SUM_2<SUM_1,并且,SUM_2+P_i>SUM_1+N,则确定位序为i的购物车商品组为目标购物车商品组。Specifically, determine the sum SUM_1 of the number of items in the shopping cart that can be displayed on all data pages before specifying the data page and the number N of items in the shopping cart that can be displayed on the data page. Further, the shopping cart commodity groups are sorted according to the order of commodity group priority from high to low. For the shopping cart commodity group with the order of i, the number of shopping cart commodities contained in it is P_i, and the first i-1 The total quantity of shopping cart items contained in the shopping cart product group is SUM_2, if SUM_1≤SUM_2<SUM_1+N, then determine the shopping cart product group with the order of i as the target shopping cart product group; and/or, if SUM_1<SUM_2 +P_i≤SUM_1+N, determine the shopping cart product group with the order of i as the target shopping cart product group; and/or, if SUM_2<SUM_1, and, SUM_2+P_i>SUM_1+N, determine the order of items as i The shopping cart item group of is the target shopping cart item group.
步骤S140,获取该用户端的购物车页面能够展示的购物车商品的第一数量,根据第一数量从目标购物车商品组中的购物车商品中获取第二数量的目标购物车商品的商品数据;其中,第二数量与第一数量相匹配。Step S140, obtaining the first quantity of shopping cart items that can be displayed on the shopping cart page of the client, and obtaining the commodity data of the second quantity of target shopping cart commodities from the shopping cart commodities in the target shopping cart commodity group according to the first quantity; Wherein, the second quantity matches the first quantity.
从目标购物车商品组中提取出的第二数量的购物车商品为目标购物车商品。本发明实施例中是根据用户端的购物车页面能够展示的购物车商品的第一数量来确定获取的目标购物车商品的第二数量。该第二数量与第一数量相匹配,即该第二数量可以与该第一数量一致,从而后续向用户端发送的目标购物车的商品数据能够完整填充用户端的购物车页面,保障页面显示效果;或者该第二数量可以稍大于该第一数量,例如该第二数量可以是第一数量的二倍,从而后续向用户端发送的目标购物车的商品数据中的一半能够完整填充用户端的购物车页面,另一半可以作为缓存数据,便于用户切换至下一数据分页时,能够利用该数据及时填充页面,提升购物车页面的展示效果。总之,该第二数量小于目标用户对应的购物车商品的总数量,避免一次性将目标用户对应的所有购物车商品提取及发送引起的I/O开销大的技术弊端。The second quantity of shopping cart items extracted from the target shopping cart item group is the target shopping cart item. In the embodiment of the present invention, the acquired second quantity of target shopping cart commodities is determined according to the first quantity of shopping cart commodities that can be displayed on the shopping cart page of the user terminal. The second quantity matches the first quantity, that is, the second quantity can be consistent with the first quantity, so that the product data of the target shopping cart subsequently sent to the client can completely fill the shopping cart page of the client, ensuring page display effect ; or the second quantity may be slightly greater than the first quantity, for example, the second quantity may be twice the first quantity, so that half of the product data of the target shopping cart sent to the user terminal can be completely filled with the shopping at the user terminal The other half of the cart page can be used as cached data, so that when the user switches to the next data page, the data can be used to fill the page in time and improve the display effect of the shopping cart page. In short, the second quantity is smaller than the total quantity of items in the shopping cart corresponding to the target user, so as to avoid the technical drawback of large I/O overhead caused by extracting and sending all the items in the shopping cart corresponding to the target user at one time.
在一种可选的实施方式中,在获取商品数据时,可以先根据目标购物车商品组的商品组信息确定目标购物车商品组中购物车商品的商品优先级,继而根据该商品优先级确定出第二数量的目标购物车商品,根据目标购物车商品的商品标识,获取目标购物车商品的商品数据。例如,商品组信息中包含有隶属该购物车商品组的购物车商品的商品标识以及添加购物车时间,从而可以按照添加购物车时间的先后顺序确定购物车商品的优先级,其中添加购物车时间越晚,其商品优先级越高。继而基于优先级来确定出目标购物车商品,并获取目标购物车商品的商品标识,基于该商品标识提取商品数据。由此获取商品数据时,能够减少数据库的数据筛选时间,提升商品数据的获取效率。In an optional implementation, when acquiring commodity data, the commodity priority of the shopping cart commodities in the target shopping cart commodity group can be determined first according to the commodity group information of the target shopping cart commodity group, and then determined according to the commodity priority The second quantity of the target shopping cart product is produced, and the product data of the target shopping cart product is acquired according to the product identification of the target shopping cart product. For example, the product group information includes the product identifiers of the shopping cart products belonging to the shopping cart product group and the time when they were added to the shopping cart, so that the priority of the shopping cart products can be determined according to the order of the time when the shopping cart was added, and the time when the shopping cart was added The later it is, the higher the priority of its products. Then, the target shopping cart product is determined based on the priority, and the product identifier of the target shopping cart product is obtained, and product data is extracted based on the product identifier. In this way, when product data is obtained, the data screening time of the database can be reduced, and the efficiency of obtaining product data can be improved.
本发明实施例中,该商品数据包括但不限于:商品标识、商品展示图、商品名称、商品所属店铺信息、商品型号、商品描述信息、商品库存、运费信息、以及金额信息等等。本发明实施例中的商品可以为实体商品,也可以为虚拟商品等等。In the embodiment of the present invention, the product data includes, but is not limited to: product identification, product display image, product name, store information of the product, product model, product description information, product inventory, shipping information, and amount information, etc. Commodities in the embodiments of the present invention may be physical commodities, or virtual commodities, and the like.
步骤S150,将第二数量的目标购物车商品的商品数据发送给用户端。Step S150, sending the commodity data of the second quantity of target shopping cart commodities to the client.
将第二数量的目标购物车商品的商品数据发送给用户端,以供用户端在购物车页面中展示目标购物车商品的商品数据。The commodity data of the second quantity of the target shopping cart commodity is sent to the client, so that the client can display the commodity data of the target shopping cart commodity on the shopping cart page.
由此可见,本发明实施例在接收用户端的购物车数据获取请求后,并未从数据库中获取目标用户对应的所有购物车商品的商品数据,而是通过查找索引表中目标用户对应的购物车商品组的商品组信息,以确定购物车商品组的优先级,进而确定出目标购物车商品组,从该目标购物车商品组中提取出与购物车页面展示的购物车商品数量匹配的目标购物车商品的商品数据,从而在能够保障当前购物车页面准确展示的基础上,减少系统的I/O开销,提升响应效率,提高购物车页面的展示效率。It can be seen that, after receiving the shopping cart data acquisition request from the client, the embodiment of the present invention does not obtain the product data of all the shopping cart products corresponding to the target user from the database, but searches the shopping cart corresponding to the target user in the index table. The product group information of the product group is used to determine the priority of the shopping cart product group, and then determine the target shopping cart product group, and extract the target shopping cart product group from the target shopping cart product group that matches the number of shopping cart products displayed on the shopping cart page The product data of the cart product, so as to ensure the accurate display of the current shopping cart page, reduce the I/O overhead of the system, improve the response efficiency, and improve the display efficiency of the shopping cart page.
图2示出了本发明实施例提供的又一种购物车数据的处理方法的流程示意图。本发明实施例中的流程图不用于对执行步骤的顺序进行限定。根据需要,还可以对该流程图中的部分步骤进行添加或删减。其中,本实施例所提供的购物车数据的处理方法可以由预设的服务器执行。Fig. 2 shows a schematic flowchart of another shopping cart data processing method provided by an embodiment of the present invention. The flow charts in the embodiments of the present invention are not used to limit the sequence of execution steps. Some steps in the flow chart can also be added or deleted as needed. Wherein, the shopping cart data processing method provided in this embodiment may be executed by a preset server.
具体地,如图2所示,该方法包括如下步骤:Specifically, as shown in Figure 2, the method includes the following steps:
步骤S210,接收购物车商品添加请求,确定购物车商品添加请求对应的用户以及添加的购物车商品所属的购物车商品组:在索引表中更新该用户的该所属的购物车商品组的商品组信息。Step S210, receiving the shopping cart product addition request, determining the user corresponding to the shopping cart product addition request and the shopping cart product group to which the added shopping cart product belongs: updating the product group of the shopping cart product group to which the user belongs in the index table information.
其中,购物车商品添加请求可以由用户主动发起,也可以由系统自动发起。例如,用户在浏览某商品时,可以通过加入购物车操作而生成针对该商品的购物车商品添加请求;又或者,用户在参加某活动时,系统自动为其分发某商品,从而系统自动生成针对该商品的购物车商品添加请求。Wherein, the request for adding items to the shopping cart may be initiated by the user or automatically by the system. For example, when a user browses a certain product, he can generate a shopping cart product addition request for the product through the operation of adding to the shopping cart; The cart item addition request for this item.
服务端在接收到购物车商品添加请求后,通过对该请求解析能够确定出购物车商品添加请求对应的用户。并确定出该购物车商品添加请求对应的添加的购物车商品,以及添加的购物车商品所属的购物车商品组,在索引表中更新该用户的该所属的购物车商品组的商品组信息。并将添加的购物车商品的商品数据存储至相应的数据库中。例如,在接收到购物车商品添加请求后,确定出该请求对应的用户为U1,对应的添加的购物车商品为S1,若预设划分维度为店铺维度,则确定购物车商品S1所述的店铺D1,并在索引表中更新用户U1下店铺D1的商品组信息,具体可以将商品S1的标识以及商品S1的购物车添加时间记录于该商品组信息中。After receiving the shopping cart item addition request, the server can determine the user corresponding to the shopping cart item addition request by parsing the request. And determine the added shopping cart product corresponding to the shopping cart product adding request, and the shopping cart product group to which the added shopping cart product belongs, and update the product group information of the user's shopping cart product group in the index table. And store the product data of the added shopping cart product in the corresponding database. For example, after receiving a shopping cart product addition request, it is determined that the user corresponding to the request is U1, and the corresponding added shopping cart product is S1. If the preset division dimension is the store dimension, then determine the shopping cart product S1. Store D1, and update the commodity group information of store D1 under user U1 in the index table. Specifically, the logo of commodity S1 and the time when commodity S1 was added to the shopping cart can be recorded in the commodity group information.
步骤S220,接收用户端的购物车数据获取请求,确定用户端对应的目标用户,以及从预先生成的索引表中查询目标用户对应的购物车商品的商品总数。Step S220, receiving the shopping cart data acquisition request from the client, determining the target user corresponding to the client, and querying the total number of items in the shopping cart corresponding to the target user from the pre-generated index table.
本发明实施例中,索引表中还包含有用户对应的购物车商品的商品总数。在确定出用户端对应的目标用户之后,从索引表中获取该目标用户对应的购物车商品的商品总数。In the embodiment of the present invention, the index table also includes the total number of items in the shopping cart corresponding to the user. After the target user corresponding to the user terminal is determined, the total number of items in the shopping cart corresponding to the target user is obtained from the index table.
步骤S230,判断该商品总数是否超出预设阈值;若是,则执行步骤S240;若否,则执行步骤S260。Step S230, judging whether the total number of commodities exceeds a preset threshold; if yes, execute step S240; if not, execute step S260.
若步骤S220确定出的商品总数超出预设阈值,则表明目标用户对应的购物车商品数量较多,则通过后续步骤S240-步骤S250来获取第二数量的目标购物车商品的商品数据,以降低系统开销,提升购物车页面展示效率;若步骤S220确定出的商品总数未超出预设阈值,则表明目标用户对应的购物车商品数量较少,则通过后续步骤S250将目标用户对应的所有购物车商品的商品数据发送给用户端,从而节约系统的计算资源。If the total number of commodities determined in step S220 exceeds the preset threshold, it indicates that the target user has a relatively large number of commodities in the shopping cart, and the commodity data of the second quantity of target shopping cart commodities are obtained through subsequent steps S240-step S250 to reduce the System overhead to improve the display efficiency of the shopping cart page; if the total number of products determined in step S220 does not exceed the preset threshold, it indicates that the number of shopping cart products corresponding to the target user is small, and all shopping carts corresponding to the target user are displayed in the subsequent step S250 The product data of the product is sent to the user end, thereby saving the computing resources of the system.
步骤S240,从预先生成的索引表中查询目标用户对应的购物车商品组的商品组信息,根据商品组信息确定购物车商品组的商品组优先级,基于商品组优先级从目标用户对应的购物车商品组中确定出目标购物车商品组。Step S240, query the commodity group information of the shopping cart commodity group corresponding to the target user from the pre-generated index table, determine the commodity group priority of the shopping cart commodity group according to the commodity group information, and select the shopping cart corresponding to the target user based on the commodity group priority. The target shopping cart commodity group is determined from the cart commodity group.
步骤S250,获取用户端的购物车页面能够展示的购物车商品的第一数量,根据第一数量从目标购物车商品组中的购物车商品中获取第二数量的目标购物车商品的商品数据;将第二数量的目标购物车商品的商品数据发送给用户端。Step S250, obtaining the first quantity of shopping cart items that can be displayed on the shopping cart page of the user terminal, and obtaining the commodity data of the second quantity of target shopping cart commodities from the shopping cart commodities in the target shopping cart commodity group according to the first quantity; Commodity data of the second quantity of target shopping cart commodities are sent to the user terminal.
步骤S240与步骤S250的具体实施过程可参照图1实施例中的描述,在此不作赘述。For the specific implementation process of step S240 and step S250, reference may be made to the description in the embodiment of FIG. 1 , and details are not repeated here.
步骤S260,获取目标用户对应的所有购物车商品的商品数据,并将所有购物车商品的商品数据发送给用户端。Step S260, acquiring commodity data of all shopping cart commodities corresponding to the target user, and sending the commodity data of all shopping cart commodities to the user terminal.
在确定出的商品总数未超出预设阈值的情况下,表明目标用户对应的购物车商品数量较少,则一次性获取目标用户对应的所有购物车商品的商品数据并不会明显增加系统开销,由此本步骤可以将目标用户对应的所有购物车商品的商品数据进行提取并发送,以节约系统计算资源。If the total number of products determined does not exceed the preset threshold, it indicates that the number of items in the shopping cart corresponding to the target user is relatively small, and obtaining the product data of all the items in the shopping cart corresponding to the target user at one time will not significantly increase the system overhead. Therefore, this step can extract and send the commodity data of all shopping cart commodities corresponding to the target user, so as to save system computing resources.
在一种可选的实施方式中,为了提升商品数据的获取效率,在获取任一商品数据时,可以判断系统内存中是否存在该商品数据,若是则从系统内存中获取该商品数据;若系统内存中不存在该商品数据,则判断系统缓存中是否存在该商品数据,若是,则从系统缓存中获取该商品数据;若系统缓存中不存在该商品数据,则从数据库中获取该商品数据。采用该种系统内存、系统缓存至数据库的多级数据查询方式,能够减少从数据库中获取数据的频次,提升商品数据整体的获取效率。In an optional implementation, in order to improve the acquisition efficiency of commodity data, when obtaining any commodity data, it can be judged whether the commodity data exists in the system memory, and if so, the commodity data is obtained from the system memory; if the system If the product data does not exist in the memory, it is judged whether the product data exists in the system cache, and if so, the product data is obtained from the system cache; if the product data does not exist in the system cache, the product data is obtained from the database. Using this multi-level data query method from the system memory and the system cache to the database can reduce the frequency of data acquisition from the database and improve the overall acquisition efficiency of commodity data.
步骤S270,接收用户端的针对购物车商品的移除请求,确定移除的购物车商品的第三数量;基于商品组优先级从目标用户对应的购物车商品组中确定出当前的目标购物车商品组,从目标购物车商品组中的购物车商品中获取第三数量的目标购物车商品的商品数据,将第三数量的目标购物车商品的商品数据发送给用户端。Step S270, receiving a removal request from the client for shopping cart items, determining the third quantity of removed shopping cart items; determining the current target shopping cart item from the shopping cart item group corresponding to the target user based on the priority of the item group group, acquiring the commodity data of the third quantity of target shopping cart commodities from the shopping cart commodities in the target shopping cart commodity group, and sending the commodity data of the third quantity of target shopping cart commodities to the client.
用户可以针对购物车页面中的购物车商品执行移除操作。其中,移除操作可以为单商品操作,即一次移除单个购物车商品;该移除操作也可以为多商品操作,即一次移除多个购物车商品。Users can perform remove actions on cart items in the cart page. Wherein, the removal operation may be a single product operation, that is, a single shopping cart product is removed at one time; the removal operation may also be a multi-product operation, that is, multiple shopping cart products are removed at one time.
该移除操作可以为删除操作,即删除该购物车商品;该移除操作也可以为支付操作,通过支付操作,该购物车商品转换为已支付商品,从而将该购物车商品从虚拟购物车中移除;该移除操作也可以为发货操作,例如针对于某些通过活动抽取的商品,如一番赏商品、魔力赏商品等等,用户无需再进行支付操作,通过发货操作,可以将该购物车商品转换为待发货商品,从而将该购物车商品从虚拟购物车中移除。The removal operation can be a delete operation, that is, delete the shopping cart item; the removal operation can also be a payment operation, through which the shopping cart item is converted into a paid item, thereby removing the shopping cart item from the virtual shopping cart remove; the removal operation can also be a delivery operation, for example, for some products drawn through activities, such as a reward product, a magic reward product, etc., the user does not need to perform a payment operation, and through the delivery operation, you can Convert the cart item to a pending shipment, thereby removing the cart item from the virtual cart.
用户对购物车商品执行移除操作后,用户端中生成了针对购物车商品的移除请求。现有技术中,服务端在接收到移除请求后,会重新获取目标用户当前对应的所有购物车商品的商品数据,并将目标用户当前对应的所有购物车商品的商品数据返回至用户端。A removal request for a cart item is generated in the client after the user performs a remove operation on the cart item. In the prior art, after receiving the removal request, the server will reacquire the commodity data of all shopping cart commodities currently corresponding to the target user, and return the commodity data of all shopping cart commodities currently corresponding to the target user to the client.
本发明实施例与现有技术不同的是,本发明实施例中服务端在接收到移除请求后,通过对移除请求的解析能够确定出移除的购物车商品,继而确定出本次移除的购物车商品的数量,该数量便是第三数量。继而基于商品组优先级从目标用户对应的购物车商品组中重新确定出当前的目标购物车商品组,从当前的目标购物车商品组中的购物车商品中获取第三数量的目标购物车商品的商品数据,将第三数量的目标购物车商品的商品数据发送给用户端。由此提升移除操作后,商品数据的获取效率以及购物车页面的刷新效率。例如,若用户批量删除了3个购物车商品,则服务端重新基于商品组优先级及商品优先级确定出购物车页面需要新增的3个目标购物车商品,并仅获取该3个目标购物车商品的商品数据,从而提升数据获取效率。The embodiment of the present invention is different from the prior art in that in the embodiment of the present invention, after receiving the removal request, the server can determine the removed shopping cart items by analyzing the removal request, and then determine the The quantity of the shopping cart item divided, the quantity is the third quantity. Then re-determine the current target shopping cart product group from the shopping cart product group corresponding to the target user based on the priority of the product group, and obtain the third number of target shopping cart products from the shopping cart products in the current target shopping cart product group The commodity data of the third quantity of the target shopping cart commodity is sent to the user terminal. This improves the efficiency of obtaining product data and refreshing the shopping cart page after the removal operation. For example, if the user deletes 3 shopping cart items in batches, the server will re-determine the 3 target shopping cart items that need to be added to the shopping cart page based on the product group priority and product priority, and only obtain the 3 target shopping items Product data of car products, thereby improving the efficiency of data acquisition.
由此可见,本发明实施例在接收到购物车商品添加请求后,同步更新索引表中该用户的所属的购物车商品组的商品组信息,从而能够保障后续商品数据的获取精度;而且,在接收到用户端的购物车数据获取请求后,从预先生成的索引表中查询目标用户对应的购物车商品的商品总数,在商品总数少的情况下获取全部的购物车商品的商品数据,在商品总数多的情况下获取第二数目的购物车商品的商品数据,从而兼顾系统计算资源以及I/O开销;此外,本发明实施例接收用户端的针对购物车商品的移除请求后,仅获取移除的购物车商品的第三数量的目标购物车商品的商品数据,进一步提升商品数据的获取效率。It can be seen that, in the embodiment of the present invention, after receiving the shopping cart commodity addition request, the commodity group information of the shopping cart commodity group to which the user belongs in the index table is synchronously updated, so as to ensure the acquisition accuracy of subsequent commodity data; moreover, in After receiving the shopping cart data acquisition request from the client, query the total number of items in the shopping cart corresponding to the target user from the pre-generated index table, and obtain the item data of all shopping cart items when the total number of items is small. If there are too many items in the shopping cart, the item data of the second number of items in the shopping cart is acquired, so as to take into account system computing resources and I/O overhead; in addition, after the embodiment of the present invention receives the removal request for the item in the shopping cart from the client, only the removal request is obtained. Commodity data of the third quantity of target shopping cart commodities of the shopping cart commodities, further improving the efficiency of obtaining commodity data.
图3示出了本发明实施例提供的再一种购物车数据的处理方法的流程示意图。本发明实施例中的流程图不用于对执行步骤的顺序进行限定。根据需要,还可以对该流程图中的部分步骤进行添加或删减。其中,本实施例所提供的购物车数据的处理方法可以由预设的服务器执行。Fig. 3 shows a schematic flowchart of another shopping cart data processing method provided by an embodiment of the present invention. The flow charts in the embodiments of the present invention are not used to limit the sequence of execution steps. Some steps in the flow chart can also be added or deleted as needed. Wherein, the shopping cart data processing method provided in this embodiment may be executed by a preset server.
具体地,如图3所示,该方法包括如下步骤:Specifically, as shown in Figure 3, the method includes the following steps:
步骤S310,接收购物车商品添加请求,确定购物车商品添加请求对应的用户。Step S310, receiving a shopping cart item addition request, and determining a user corresponding to the shopping cart item addition request.
步骤S320,判断添加的购物车商品是否为预设类型;若是,则执行步骤S330;若否,则执行步骤S340。Step S320, judging whether the added shopping cart item is a preset type; if yes, execute step S330; if not, execute step S340.
本发明实施例中,为兼顾系统计算资源以及系统开销,仅在索引表中记录预设类型的购物车商品所属的购物车商品组的商品组信息。从而在接收到购物车商品添加请求后,先确定出添加的购物车商品是否为预设类型,若是,则更新索引表;否则无需更新索引表。其中,该预设类型可以为通过活动系统自动分发的商品,例如该预设类型可以为魔力赏类型、一番赏类型等等。In the embodiment of the present invention, in order to take into account system computing resources and system overhead, only the commodity group information of the shopping cart commodity group to which the shopping cart commodity of a preset type belongs is recorded in the index table. Therefore, after receiving the shopping cart product addition request, first determine whether the added shopping cart product is a preset type, and if so, update the index table; otherwise, there is no need to update the index table. Wherein, the preset type may be a product that is automatically distributed through the activity system, for example, the preset type may be a magic reward type, a reward type, and the like.
在一种可选的实施方式中,预设类型可以通过如下方式自动确定:获取历史时段内的多个用户对应的购物车商品的商品类型;针对于任一商品类型,统计隶属该商品类型的购物车商品的商品数量;根据各个商品类型对应的商品数量,从商品类型中确定出预设类型。具体地,可以历史时段内的大量用户对应的购物车商品的商品类型,从而统计出不同商品类型所对应的购物车商品的商品数量,继而将商品数量多的商品类型确定为预设类型。从而后续可以将通过大数据统计出的购物车商品数量多的商品类型进行索引表更新。In an optional implementation, the preset type can be automatically determined in the following manner: obtain the product types of the shopping cart products corresponding to multiple users in the historical period; for any product type, count the The number of items in the shopping cart; according to the number of items corresponding to each item type, the preset type is determined from the item types. Specifically, the product types of the shopping cart products corresponding to a large number of users in the historical period can be used to count the product quantities of the shopping cart products corresponding to different product types, and then the product type with a large number of products is determined as the preset type. In this way, the index table can be updated for the product types with a large number of shopping cart products calculated through big data.
步骤S330,确定添加的购物车商品所属的购物车商品组,在索引表中更新该用户的该所属的购物车商品组的商品组信息,并存储该添加的购物车商品的商品数据。Step S330, determine the shopping cart product group to which the added shopping cart product belongs, update the product group information of the user's belonging shopping cart product group in the index table, and store the product data of the added shopping cart product.
本发明实施例中,仅按照预设划分维度对用户对应的预设类型的购物车商品进行划分,以得到购物车商品组。即本发明实施例中,所有购物车商品组中的购物车商品均隶属于预设类型。换言之,本发明实施例仅对历史对应的购物车商品数量多的商品类型的购物车商品进行了分组,从而减少系统计算量,节约计算资源。In the embodiment of the present invention, only preset types of shopping cart items corresponding to the user are divided according to preset division dimensions to obtain shopping cart item groups. That is, in the embodiment of the present invention, all shopping cart items in the shopping cart item group belong to the preset type. In other words, the embodiment of the present invention only groups the shopping cart products of a product type corresponding to a large number of shopping cart products in history, thereby reducing the amount of calculation of the system and saving computing resources.
在确定出添加的购物车商品是预设类型的情况下,在索引表中更新该用户的该所属的购物车商品组的商品组信息。例如,若预设划分维度为活动维度,预设类型可以为魔力赏类型,则若添加的购物车商品为参与活动1而分发的魔力赏商品S,则在索引表中更新该用户的活动1的商品组信息。If it is determined that the added shopping cart item is of a preset type, update the item group information of the user's belonging shopping cart item group in the index table. For example, if the default division dimension is the activity dimension, and the default type can be the magic reward type, then if the item added to the shopping cart is the magic reward product S distributed by participating in activity 1, update the user's activity 1 in the index table Product group information for .
步骤S340,存储该添加的购物车商品的商品数据。Step S340, storing the product data of the added shopping cart product.
若添加的购物车商品不是预设类型,则无需更新索引表,则仅存储该添加的购物车商品的商品数据。If the added shopping cart product is not a preset type, there is no need to update the index table, and only the product data of the added shopping cart product will be stored.
步骤S350,接收用户端的购物车数据获取请求,确定用户端对应的目标用户。Step S350, receiving a shopping cart data acquisition request from the client, and determining a target user corresponding to the client.
本发明实施例中,根据目标用户对应的购物车商品所属的类型不同,采用了不同的处理方式。即针对于预设类型的购物车商品,通过如下步骤S360获取商品数据;针对于非预设类型的购物车商品,通过如下步骤S370获取商品数据。In the embodiment of the present invention, different processing methods are adopted according to the types of items in the shopping cart corresponding to the target user. That is, for the shopping cart product of the preset type, the product data is obtained through the following step S360; for the shopping cart product of the non-preset type, the product data is obtained through the following step S370.
步骤S360,从预先生成的索引表中查询目标用户对应的购物车商品组的商品组信息;根据商品组信息确定购物车商品组的商品组优先级,基于商品组优先级从目标用户对应的购物车商品组中确定出目标购物车商品组,从目标购物车商品组中获取第二数量的预设类型的目标购物车商品的商品数据,将第二数量的预设类型的目标购物车商品的商品数据发送给用户端。Step S360, querying the commodity group information of the shopping cart commodity group corresponding to the target user from the pre-generated index table; Determine the target shopping cart commodity group from the target shopping cart commodity group, obtain the commodity data of the second quantity of preset types of target shopping cart commodities from the target shopping cart commodity group, and convert the second quantity of preset types of target shopping cart commodities to Commodity data is sent to the client.
针对于目标用户对应的预设类型的购物车商品,由于其数量通常较多,则本步骤仅获取第二数量的预设类型的目标购物车商品的商品数据,从而降低系统开销。Since the number of preset types of shopping cart items corresponding to the target user is usually large, this step only obtains the item data of the second number of preset types of target shopping cart items, thereby reducing system overhead.
具体地,从索引表中查询目标用户对应的购物车商品组的商品组信息,该购物车商品组是按照预设划分维度对目标用户对应的预设类型的购物车商品进行划分得到的。进一步地,根据商品组信息确定购物车商品组的商品组优先级,基于商品组优先级从目标用户对应的购物车商品组中确定出目标购物车商品组。例如,可以将商品组优先级前n的购物车商品组作为目标购物车商品组,继而从目标购物车商品组中获取第二数量的预设类型的目标购物车商品的商品数据。Specifically, the commodity group information of the shopping cart commodity group corresponding to the target user is queried from the index table, and the shopping cart commodity group is obtained by dividing preset types of shopping cart commodities corresponding to the target user according to a preset division dimension. Further, the commodity group priority of the shopping cart commodity group is determined according to the commodity group information, and the target shopping cart commodity group is determined from the shopping cart commodity groups corresponding to the target user based on the commodity group priority. For example, the shopping cart commodity groups with the top n priorities of commodity groups may be used as the target shopping cart commodity groups, and then the commodity data of the second number of preset types of target shopping cart commodities may be acquired from the target shopping cart commodity groups.
步骤S370,获取目标用户对应的非预设类型的购物车商品的商品数据,并将非预设类型的购物车商品的商品数据发送给用户端。In step S370, the product data of the non-preset type of shopping cart product corresponding to the target user is obtained, and the product data of the non-preset type of shopping cart product is sent to the user terminal.
针对于目标用户对应的非预设类型的购物车商品,由于其数量通常较少,则直接获取该类购物车商品的商品数据,并发送给用户端。For non-preset types of shopping cart products corresponding to the target user, since the quantity is usually small, the product data of such shopping cart products are directly obtained and sent to the user terminal.
由此可见,本发明实施例仅对预设类型的购物车商品进行了预设维度的划分,从而简化系统计算量,提升本方法的整体执行效率。并且针对于预设类型的购物车商品,仅获取第二数量的预设类型的购物车商品的商品数据;针对于非预设类型的购物车商品,获取全部的非预设类型的购物车商品的商品数据,从而进一步兼顾系统计算资源以及系统开销。It can be seen that the embodiment of the present invention only divides the preset dimensions of the shopping cart products of the preset type, thereby simplifying the calculation amount of the system and improving the overall execution efficiency of the method. And for the shopping cart products of the preset type, only obtain the product data of the second quantity of the shopping cart products of the preset type; for the shopping cart products of the non-preset type, obtain all the shopping cart products of the non-preset type Commodity data, so as to further take into account system computing resources and system overhead.
图4示出了本发明实施例提供的一种购物车数据的处理装置的结构示意图。如图4所示,该装置400包括:接收模块410、用户确定模块420、查询模块430、商品组确定模块440、获取模块450、以及发送模块460。Fig. 4 shows a schematic structural diagram of an apparatus for processing shopping cart data provided by an embodiment of the present invention. As shown in FIG. 4 , the
接收模块410,用于接收用户端的购物车数据获取请求;A receiving module 410, configured to receive a shopping cart data acquisition request from the client;
用户确定模块420,用于确定所述用户端对应的目标用户;A user determining module 420, configured to determine the target user corresponding to the client;
查询模块430,用于从预先生成的索引表中查询所述目标用户对应的购物车商品组的商品组信息;其中,所述购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的;The
商品组确定模块440,用于根据所述商品组信息确定所述购物车商品组的商品组优先级,并基于所述商品组优先级从所述目标用户对应的购物车商品组中确定出目标购物车商品组;Commodity group determination module 440, configured to determine the commodity group priority of the shopping cart commodity group according to the commodity group information, and determine the target from the shopping cart commodity group corresponding to the target user based on the commodity group priority shopping cart product group;
获取模块450,用于获取所述用户端的购物车页面能够展示的购物车商品的第一数量,根据所述第一数量从所述目标购物车商品组中的购物车商品中获取第二数量的目标购物车商品的商品数据;其中,所述第二数量与所述第一数量相匹配;The acquiring module 450 is configured to acquire a first quantity of shopping cart items that can be displayed on the shopping cart page of the user terminal, and acquire a second quantity of items from the shopping cart items in the target shopping cart item group according to the first quantity. Commodity data of the target shopping cart commodity; wherein the second quantity matches the first quantity;
发送模块460,用于将第二数量的目标购物车商品的商品数据发送给所述用户端。The sending module 460 is configured to send the commodity data of the second quantity of target shopping cart commodities to the client.
在一种可选的实施方式中,接收模块用于:接收用户端的指定数据分页的购物车数据获取请求;In an optional implementation manner, the receiving module is configured to: receive a shopping cart data acquisition request of a specified data page from the client;
商品组确定模块用于:根据商品组优先级、购物车商品组中购物车商品的商品数量、以及所述第一数量,从所述目标用户对应的购物车商品组中确定出目标购物车商品组。The commodity group determination module is configured to: determine the target shopping cart commodity from the shopping cart commodity group corresponding to the target user according to the priority of the commodity group, the quantity of the shopping cart commodity in the shopping cart commodity group, and the first quantity Group.
在一种可选的实施方式中,获取模块用于:根据目标购物车商品组的商品组信息确定目标购物车商品组中购物车商品的商品优先级;根据所述商品优先级确定第二数量的目标购物车商品;根据目标购物车商品的商品标识,获取目标购物车商品的商品数据。In an optional implementation manner, the obtaining module is configured to: determine the commodity priority of the shopping cart commodities in the target shopping cart commodity group according to the commodity group information of the target shopping cart commodity group; determine the second quantity according to the commodity priority The target shopping cart product; according to the product identifier of the target shopping cart product, obtain the product data of the target shopping cart product.
在一种可选的实施方式中,接收模块用于:接收购物车商品添加请求;In an optional implementation manner, the receiving module is configured to: receive a shopping cart item addition request;
该装置还包括:更新模块,用于确定所述购物车商品添加请求对应的用户以及添加的购物车商品所属的购物车商品组;在所述索引表中更新该用户的所述所属的购物车商品组的商品组信息。The device also includes: an update module, configured to determine the user corresponding to the shopping cart product addition request and the shopping cart product group to which the added shopping cart product belongs; update the user's belonging shopping cart in the index table Product group information for the product group.
在一种可选的实施方式中,更新模块用于:判断所述添加的购物车商品是否为预设类型;若是,则确定添加的购物车商品所属的购物车商品组;In an optional implementation manner, the update module is used to: determine whether the added shopping cart product is a preset type; if so, determine the shopping cart product group to which the added shopping cart product belongs;
则所述购物车商品组是按照预设划分维度对目标用户对应的购物车商品进行划分得到的进一步包括:所述购物车商品组是按照预设划分维度对目标用户对应的预设类型的购物车商品进行划分得到的。Then the shopping cart commodity group is obtained by dividing the shopping cart commodities corresponding to the target user according to the preset division dimension. It is obtained by dividing car products.
在一种可选的实施方式中,该装置还包括:类型确定模块,用于获取历史时段内的多个用户对应的购物车商品的商品类型;In an optional implementation manner, the device further includes: a type determination module, configured to acquire the item types of the shopping cart items corresponding to multiple users within the historical period;
针对于任一商品类型,统计隶属该商品类型的购物车商品的商品数量;For any product type, count the number of products in the shopping cart belonging to the product type;
根据各个商品类型对应的商品数量,从商品类型中确定出预设类型。According to the quantity of commodities corresponding to each commodity type, the preset type is determined from the commodity types.
在一种可选的实施方式中,接收模块用于:接收所述用户端的针对购物车商品的移除请求;In an optional implementation manner, the receiving module is configured to: receive a removal request from the user terminal for items in the shopping cart;
该装置还包括:移除处理模块,用于确定移除的购物车商品的第三数量;基于商品组优先级从目标用户对应的购物车商品组中确定出当前的目标购物车商品组,从所述目标购物车商品组中的购物车商品中获取第三数量的目标购物车商品的商品数据;The device also includes: a removal processing module, configured to determine the third quantity of removed shopping cart items; determine the current target shopping cart item group from the shopping cart item groups corresponding to the target user based on the priority of the item group, from Acquiring commodity data of a third quantity of target shopping cart commodities among the shopping cart commodities in the target shopping cart commodity group;
发送模块,用于将第三数量的目标购物车商品的商品数据发送给所述用户端。A sending module, configured to send the product data of the third quantity of target shopping cart products to the client.
在一种可选的实施方式中,该装置还包括:判断模块,用于从预先生成的索引表中查询所述目标用户对应的购物车商品的商品总数;判断所述商品总数是否超出预设阈值;In an optional implementation manner, the device further includes: a judging module, configured to query the total number of items in the shopping cart corresponding to the target user from a pre-generated index table; determine whether the total number of items exceeds the preset threshold;
则获取模块用于:在所述判断模块判断结果为否时,获取所述目标用户对应的所有购物车商品的商品数据,并将所述所有购物车商品的商品数据发送给用户端;The acquiring module is used to: when the judgment result of the judging module is No, acquire the commodity data of all the shopping cart commodities corresponding to the target user, and send the commodity data of all the shopping cart commodities to the client;
则查询模块用于:若所述商品总数超出预设阈值,则从预先生成的索引表中查询所述目标用户对应的购物车商品组的商品组信息。The query module is configured to: if the total number of commodities exceeds a preset threshold, query the commodity group information of the shopping cart commodity group corresponding to the target user from the pre-generated index table.
在一种可选的实施方式中,所述索引表位于系统缓存中;In an optional implementation manner, the index table is located in the system cache;
和/或,获取模块用于:针对于任一商品数据,判断系统内存中是否存在所述商品数据,若是则从系统内存中获取所述商品数据;若系统内存中不存在所述商品数据,则判断系统缓存中是否存在所述商品数据,若是,则从系统缓存中获取所述商品数据;若系统缓存中不存在所述商品数据,则从数据库中获取所述商品数据。And/or, the acquisition module is used to: for any commodity data, determine whether the commodity data exists in the system memory, and if so, obtain the commodity data from the system memory; if the commodity data does not exist in the system memory, It is then judged whether the commodity data exists in the system cache, and if so, the commodity data is obtained from the system cache; if the commodity data does not exist in the system cache, the commodity data is obtained from the database.
由此可见,本发明实施例在接收用户端的购物车数据获取请求后,并未从数据库中获取目标用户对应的所有购物车商品的商品数据,而是通过查找索引表中目标用户对应的购物车商品组的商品组信息,以确定购物车商品组的优先级,进而确定出目标购物车商品组,从该目标购物车商品组中提取出与购物车页面展示的购物车商品数量匹配的目标购物车商品的商品数据,从而在能够保障当前购物车页面准确展示的基础上,减少系统的I/O开销,提升响应效率,提高购物车页面的展示效率。It can be seen that, after receiving the shopping cart data acquisition request from the client, the embodiment of the present invention does not obtain the product data of all the shopping cart products corresponding to the target user from the database, but searches the shopping cart corresponding to the target user in the index table. The product group information of the product group is used to determine the priority of the shopping cart product group, and then determine the target shopping cart product group, and extract the target shopping cart product group from the target shopping cart product group that matches the number of shopping cart products displayed on the shopping cart page The product data of the cart product, so as to ensure the accurate display of the current shopping cart page, reduce the I/O overhead of the system, improve the response efficiency, and improve the display efficiency of the shopping cart page.
图5示出了本发明实施例提供的一种购物车数据的处理系统的结构示意图。如图5所示,该系统包含有基础层、领域层、环境层、应用层以及展现层。Fig. 5 shows a schematic structural diagram of a shopping cart data processing system provided by an embodiment of the present invention. As shown in Figure 5, the system includes the base layer, domain layer, environment layer, application layer and presentation layer.
基础层中包含有cart-common模块以及cart-dal模块,cart-common模块主要用于对数据的基础处理,如数据类型转换等等;cart-dal模块中包含有的数据等。The base layer includes the cart-common module and the cart-dal module. The cart-common module is mainly used for basic data processing, such as data type conversion, etc.; the cart-dal module contains some data.
领域层中包含有cart-entity模块,cart-repository模块,cart-integration模块,其中,cart-entity模块中封装有entity相关的方法,cart-repository模块中封装有repository相关的方法,cart-integration模块中封装有cart-integration相关的方法。cart-entity模块,cart-repository模块,cart-integration模块均为现有模块,在此不作赘述。The domain layer includes the cart-entity module, cart-repository module, and cart-integration module. Among them, the cart-entity module encapsulates entity-related methods, and the cart-repository module encapsulates repository-related methods. The cart-integration module The method related to cart-integration is encapsulated in it. The cart-entity module, cart-repository module, and cart-integration module are all existing modules, and will not be described here.
环境层中包含有cart-manager模块,cart-manager模块主要用于对数据进行聚合,其可以将获取到的各类数据进行拼接,进而便于cart-biz-service模块进行数据处理。The environment layer includes the cart-manager module, which is mainly used to aggregate data, and it can splice various types of data obtained, which is convenient for the cart-biz-service module to process data.
应用层包括cart-biz-service模块以及cart-processor模块。其中,cart-biz-service模块中包含有图4所示的购物车数据的处理装置400。cart-processor模块主要用于对系统定时任务的处理。The application layer includes cart-biz-service module and cart-processor module. Wherein, the cart-biz-service module includes the shopping cart
展现层包括cart-api模块以及cart-web模块。其中,cart-api模块中包含有至少一个接口,每个接口用于与其他系统进行信息交互;cart-web模块用于与展示前端进行信息交互。The presentation layer includes cart-api module and cart-web module. Among them, the cart-api module contains at least one interface, and each interface is used for information interaction with other systems; the cart-web module is used for information interaction with the display front end.
本系统结构简单,并能够在保障当前购物车页面准确展示的基础上,减少系统的I/O开销,提升响应效率,提高购物车页面的展示效率。The structure of this system is simple, and on the basis of ensuring the accurate display of the current shopping cart page, it can reduce the I/O overhead of the system, improve the response efficiency, and improve the display efficiency of the shopping cart page.
图6示出了本发明实施例提供的一种计算设备的结构示意图。本发明实施例具体实施例并不对计算设备的具体实现做限定。Fig. 6 shows a schematic structural diagram of a computing device provided by an embodiment of the present invention. The specific embodiments of the embodiments of the present invention do not limit the specific implementation of the computing device.
如图6所示,该计算设备可以包括:处理器(processor)602、通信接口(Communications Interface)604、存储器(memory)606、以及通信总线608。As shown in FIG. 6 , the computing device may include: a processor (processor) 602, a communication interface (Communications Interface) 604, a memory (memory) 606, and a
其中:处理器602、通信接口604、以及存储器606通过通信总线608完成相互间的通信。通信接口604,用于与其它设备比如客户端或其它服务器等的网元通信。处理器602,用于执行程序610,具体可以执行上述用于购物车数据的处理方法实施例中的相关步骤。Wherein: the processor 602 , the
具体地,程序610可以包括程序代码,该程序代码包括计算机操作指令。Specifically, the program 610 may include program codes including computer operation instructions.
处理器602可能是中央处理器CPU,或者是特定集成电路ASIC(ApplicationSpecific Integrated Circuit),或者是被配置成实施本发明实施例的一个或多个集成电路。计算设备包括的一个或多个处理器,可以是同一类型的处理器,如一个或多个CPU;也可以是不同类型的处理器,如一个或多个CPU以及一个或多个ASIC。The processor 602 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computing device may be of the same type, such as one or more CPUs, or may be different types of processors, such as one or more CPUs and one or more ASICs.
存储器606,用于存放程序610。存储器606可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。程序610具体可以用于使得处理器602执行上述任一方法实施例中的方法。The memory 606 is used for storing the program 610 . The memory 606 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. The program 610 may be specifically configured to enable the processor 602 to execute the method in any one of the foregoing method embodiments.
本发明实施例提供了一种非易失性计算机存储介质,所述计算机存储介质存储有至少一可执行指令,该计算机可执行指令可执行上述任意方法实施例中的购物车数据的处理方法。An embodiment of the present invention provides a non-volatile computer storage medium, the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the shopping cart data processing method in any of the above method embodiments.
在此提供的算法或显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明实施例也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明实施例的内容,并且上面对特定语言所做的描述是为了披露本发明实施例的最佳实施方式。The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, embodiments of the present invention are not directed to any particular programming language. It should be understood that various programming languages can be used to implement the contents of the embodiments of the present invention described herein, and the above description of specific languages is for disclosing the best implementation mode of the embodiments of the present invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明实施例的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.
类似地,应当理解,为了精简本发明实施例并帮助理解各个发明方面中的一个或多个,在上面对本发明实施例的示例性实施例的描述中,本发明实施例的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明实施例要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明实施例的单独实施例。Similarly, it should be understood that in order to simplify the embodiments of the present invention and help understand one or more of the various aspects of the invention, in the above description of the exemplary embodiments of the embodiments of the present invention, various features of the embodiments of the present invention are sometimes grouped together grouped into a single embodiment, figure, or description thereof. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed embodiments of the invention require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of an embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明实施例的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。In addition, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of embodiments of the present invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
本发明实施例的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的一些或者全部部件的一些或者全部功能。本发明实施例还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明实施例的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the embodiments of the present invention may be realized by hardware, or by software modules running on one or more processors, or by a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components according to the embodiments of the present invention. Embodiments of the present invention can also be implemented as a device or apparatus program (eg, computer program and computer program product) for performing a part or all of the methods described herein. Such a program implementing an embodiment of the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本发明实施例进行说明而不是对本发明实施例进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明实施例可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。上述实施例中的步骤,除有特殊说明外,不应理解为对执行顺序的限定。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the execution order.
Claims (12)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211428169.8A CN115907902A (en) | 2022-11-15 | 2022-11-15 | Shopping cart data processing method, device, computing device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211428169.8A CN115907902A (en) | 2022-11-15 | 2022-11-15 | Shopping cart data processing method, device, computing device and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115907902A true CN115907902A (en) | 2023-04-04 |
Family
ID=86475759
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211428169.8A Pending CN115907902A (en) | 2022-11-15 | 2022-11-15 | Shopping cart data processing method, device, computing device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115907902A (en) |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8473370B1 (en) * | 2012-03-26 | 2013-06-25 | Do It Best Corp. | Method and apparatus for generating an order for purchase |
| CN107742250A (en) * | 2017-12-04 | 2018-02-27 | 深圳春沐源控股有限公司 | The display methods and display system of goods browse record |
| CN110348948A (en) * | 2019-06-17 | 2019-10-18 | 阿里巴巴集团控股有限公司 | Merchandise information processing method, device, server, terminal and purchase system |
| CN112184361A (en) * | 2020-09-02 | 2021-01-05 | 珠海格力电器股份有限公司 | Method and device for displaying commodity information in shopping cart in e-commerce shopping platform |
| CN114816164A (en) * | 2022-04-24 | 2022-07-29 | 珠海格力电器股份有限公司 | Commodity information processing method and device, storage medium and electronic device |
-
2022
- 2022-11-15 CN CN202211428169.8A patent/CN115907902A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8473370B1 (en) * | 2012-03-26 | 2013-06-25 | Do It Best Corp. | Method and apparatus for generating an order for purchase |
| CN107742250A (en) * | 2017-12-04 | 2018-02-27 | 深圳春沐源控股有限公司 | The display methods and display system of goods browse record |
| CN110348948A (en) * | 2019-06-17 | 2019-10-18 | 阿里巴巴集团控股有限公司 | Merchandise information processing method, device, server, terminal and purchase system |
| CN112184361A (en) * | 2020-09-02 | 2021-01-05 | 珠海格力电器股份有限公司 | Method and device for displaying commodity information in shopping cart in e-commerce shopping platform |
| CN114816164A (en) * | 2022-04-24 | 2022-07-29 | 珠海格力电器股份有限公司 | Commodity information processing method and device, storage medium and electronic device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP5693746B2 (en) | Product information ranking | |
| CN111506849A (en) | Page generation method and device | |
| CN104065565A (en) | Method, server, client device and system for pushing messages | |
| CN114328632A (en) | User data analysis method and device based on bitmap and computer equipment | |
| US9465881B2 (en) | User displays using N-way paginated merge of information from diverse sources | |
| CN103970870A (en) | Database query method and server | |
| US20220343398A1 (en) | Order management methods, system, terminal and electronic device based on multi-person ordering | |
| CN111639965A (en) | Integral updating method and device | |
| CN111125128B (en) | Cache updating method, device and system | |
| CN110175862A (en) | Commodity price calculation method and system are sold for electric business platform | |
| CN113377289B (en) | Cache management method, system, computing device and readable storage medium | |
| CN113377817A (en) | Data processing method, system, device and storage medium | |
| CN110968765A (en) | Book searching method, computing device and computer storage medium | |
| WO2013004119A1 (en) | Information acquisition method and device | |
| CN106570060B (en) | Random extraction method and device for data in information flow | |
| CN106547751B (en) | Cache data updating method and device | |
| CN104424325A (en) | Data inquiry method and device | |
| US20100332539A1 (en) | Presenting a related item using a cluster | |
| CN112883307B (en) | Cache updating method and device and social network system | |
| CN108721897B (en) | Game material display method and device, computing equipment and computer storage medium | |
| CN115907902A (en) | Shopping cart data processing method, device, computing device and storage medium | |
| CN111444448B (en) | Data processing method, server and system | |
| CN102739562B (en) | Method and device for sending collection information | |
| CN104331823B (en) | It is determined that the method and device for the middle keyword reservation price that releases news | |
| CN106970998A (en) | The update method and device of news data |
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 |