CN110858367A - Sales information storage method and device - Google Patents
Sales information storage method and device Download PDFInfo
- Publication number
- CN110858367A CN110858367A CN201810971777.0A CN201810971777A CN110858367A CN 110858367 A CN110858367 A CN 110858367A CN 201810971777 A CN201810971777 A CN 201810971777A CN 110858367 A CN110858367 A CN 110858367A
- Authority
- CN
- China
- Prior art keywords
- address
- sales
- field
- information
- num
- 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
- 238000003860 storage Methods 0.000 title claims abstract description 223
- 238000000034 method Methods 0.000 title claims abstract description 84
- 230000001174 ascending effect Effects 0.000 claims description 15
- 238000012545 processing Methods 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012790 confirmation Methods 0.000 claims description 4
- 238000012216 screening Methods 0.000 abstract description 6
- 238000010586 diagram Methods 0.000 description 17
- 230000008569 process Effects 0.000 description 15
- 230000000694 effects Effects 0.000 description 12
- 230000009191 jumping Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000001737 promoting effect Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 241000531116 Blitum bonus-henricus Species 0.000 description 1
- 235000008645 Chenopodium bonus henricus Nutrition 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0201—Market modelling; Market analysis; Collecting market data
Landscapes
- Business, Economics & Management (AREA)
- Strategic Management (AREA)
- Engineering & Computer Science (AREA)
- Accounting & Taxation (AREA)
- Development Economics (AREA)
- Finance (AREA)
- Entrepreneurship & Innovation (AREA)
- Game Theory and Decision Science (AREA)
- Data Mining & Analysis (AREA)
- Economics (AREA)
- Marketing (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method and a device for storing sales information, and relates to the technical field of computers. One embodiment of the method comprises: acquiring sales information of an article; the sales information includes: limited address sales information in which the article participates, and a sales address corresponding to each limited address sales information; determining a storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary; and storing the sales information of the article according to the storage mode. The implementation method can dynamically select the storage mode of the sales information, guarantee the correct storage and screening of the limited address sales information, avoid redundant storage, and simultaneously reduce the memory consumption and the query time consumption of the sales information as much as possible.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for storing sales information.
Background
In real life, merchants often stimulate and guide consumption behaviors in a sales promotion mode, and the same is true in the field of e-commerce. In an e-commerce system, in order to facilitate a user to quickly inquire all goods participating in a certain type of promotion, corresponding identification information is provided in the goods dimension by background search data. Therefore, the method can filter the sales promotion types of the recalled commodities under the specific search terms, and only displays the commodities participating in the sales promotion for the user, thereby bringing more humanized experience.
In some application scenarios, some promotional programs may configure black and white lists of areas, specifying that the promotion is only or not in certain areas. The user will specify the address when searching and purchasing the goods, and in order to ensure that the goods displayed on the search page participate in the promotion activity at the address, the information containing the regional promotion needs to be stored in the promotion information of the goods dimension, so as to ensure the accuracy of the data.
At present, fields with a plurality of commodity dimensions are two-dimensional information defined based on addresses, and two parameters of commodity numbers and address numbers are needed to determine unique states, including commodity inventory, distributable addresses, distribution bin numbers and the like. The commodity number is a main key for searching data, so that the information needs to be stored in the commodity dimension, and the states of a plurality of addresses need to be identified through a multi-value field. According to different characteristics of the fields, two storage modes are generally adopted, wherein one mode is to enumerate black lists and white lists in the fields, and the other mode is to store promotion information under all addresses in a multi-value field according to bits based on an address dictionary.
For the fields which only need to be stored in a non-state and have most of a certain state, a black list or a white list is generally enumerated in the fields in sequence, so that the data size is not large and intuitive, binary search is adopted during query, and the address information needing to be queried can be quickly positioned. The second storage method requires numbering addresses to generate a dictionary, and production and analysis are performed through the dictionary when data are produced and inquired. In the multi-value field, a certain number of bits are allocated to each address according to requirements, and the inquiry information of the corresponding address is stored according to the serial number sequence. And when data is inquired, the data position corresponding to the specified address can be quickly positioned according to the dictionary, and then the analysis is completed.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the mode of enumerating the black and white list needs to meet a certain condition, and in an extreme case, too many addresses are enumerated, so that the memory consumption and the query time consumption are increased linearly along with the number of the addresses. When the information under all the addresses is stored based on the address dictionary, the defect can be avoided, and redundant storage of data can be caused.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for storing sales information, which dynamically select a storage manner of the sales information, so as to ensure correct storage and screening of limited-address sales information, avoid redundant storage, and reduce memory consumption and query time consumption of the sales information as much as possible.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a sales information storage method.
The sales information storage method according to the embodiment of the invention comprises the following steps:
acquiring sales information of an article; the sales information includes: limited address sales information in which the article participates, and a sales address corresponding to each limited address sales information;
determining a storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary;
and storing the sales information of the article according to the storage mode.
Optionally, the storage means includes: dictionary storage and enumeration storage; determining a storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in a preset address dictionary, wherein the storage mode comprises the following steps:
carrying out duplicate removal processing on the sales addresses corresponding to all the limited address sales information to obtain effective sales addresses corresponding to the articles;
when the number of the limited address sales information, the number of the effective sales addresses and the total number of the addresses in the preset address dictionary meet the following relational expression, storing the relation between each effective address and each type of limited address sales information in a dictionary-based storage mode, otherwise, storing the relation between each effective address and each type of limited address sales information in an enumeration storage mode:
area_promotion_num×max_dict_num/area_num≤θ
in the formula, area _ motion _ num represents the number of address limited sales information; max _ dit _ num represents the total number of addresses in the preset address dictionary; area _ num represents the number of valid sales addresses; θ represents a constant.
Optionally, the storage mode is dictionary storage; storing sales information for the item according to a storage means, comprising:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of the address-limited sales fields; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of effective sale addresses which can be represented by each integer field as N/area _ movement _ num; determining the number of valid selling addresses that the first multi-valued field can represent as a × (N/area _ movement _ num);
when a (N/area _ movement _ num) is larger than or equal to area _ num, storing the relation between area _ num effective sales addresses and area _ movement _ num limited sales information into a sales address information field of a first multi-valued field;
when a (N/area _ movement _ num) < area _ num, storing the relationship between a (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a sales address information field of a first multi-valued field, and storing the relationship between the remaining (area _ num-a) (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; an integer field of each sales address information field stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information.
Alternatively, when N/area _ movement _ num is a non-integer, N/area _ movement _ num represents a quotient of N divided by area _ movement _ num; when the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited-address sales information is stored in one integer field of each sales address information field, N% of area _ movement _ num bits are left at the preset position of each integer field in the sales address information field.
Optionally, the storage mode is enumeration storage; storing sales information for the item according to a storage means, comprising:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of an address-limited sales field; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of valid sales addresses that each integer field can represent as b; determining the number of valid sale addresses which can be represented by the first multi-value field as a multiplied by b;
when a multiplied by b is larger than or equal to area _ num, storing the relation between area _ num effective sale addresses and the corresponding limited address sale information thereof into a sale address information field of a first multi-valued field;
when a multiplied by b is less than area _ num, storing the relation between a multiplied by b effective selling addresses and the corresponding limited address selling information into a selling address information field of a first multi-valued field, and storing the relation between the remaining (area _ num-a multiplied by b) effective selling addresses and the corresponding limited address selling information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; and one integer field of each sales address information field stores the relationship between b effective sales addresses and the corresponding address-limited sales information.
Optionally, the first multi-valued field further comprises: an identification bit field and/or an unlimited address sales information field; wherein,
the identification bit field comprises an integer field, and the stored content comprises: limiting the number of address sales information, the starting position of a sales address information field, limiting the number of address sales promotion information by using a multi-value field, a storage mode, a non-blacklist, and adopting a value of N/area _ num when a dictionary is stored or a value of area _ num when an enumeration storage is adopted;
the unlimited address sale information field comprises an integer field for storing the unlimited address sale information participated by the article.
Optionally, in the address-limited sales information field, one bit of each integer field corresponds to one address-limited sales information, a value of the bit is 1, which indicates that the article participates in the address-limited sales information, and a value of the bit is 0, which indicates that the article does not participate in the address-limited sales information;
in the unlimited address sale information field, each bit corresponds to unlimited address sale information, the value of the bit is 1, which indicates that the article participates in the unlimited address sale information, and the value of the bit is 0, which indicates that the article does not participate in the unlimited address sale information.
According to still another aspect of an embodiment of the present invention, there is provided a sales information storage apparatus.
The sales information storage apparatus according to an embodiment of the present invention includes:
the acquisition module acquires sales information of the article; the sales information includes: limited address sales information in which the article participates, and a sales address corresponding to each limited address sales information;
the confirmation module is used for determining the storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary;
and the storage module is used for storing the sales information of the article according to the storage mode.
Optionally, the storage means includes: dictionary storage and enumeration storage; the confirming module determines the storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary, and the confirming module comprises the following steps:
carrying out duplicate removal processing on the sales addresses corresponding to all the limited address sales information to obtain effective sales addresses corresponding to the articles;
when the number of the limited address sales information, the number of the effective sales addresses and the total number of the addresses in the preset address dictionary meet the following relational expression, storing the relation between each effective address and each type of limited address sales information in a dictionary-based storage mode, otherwise, storing the relation between each effective address and each type of limited address sales information in an enumeration storage mode:
area_promotion_num×max_dict_num/area_num≤θ
in the formula, area _ motion _ num represents the number of address limited sales information; max _ dit _ num represents the total number of addresses in the preset address dictionary; area _ num represents the number of valid sales addresses; θ represents a constant.
Optionally, the storage mode is dictionary storage; the storage module stores the sales information of the article according to a storage mode, and comprises:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of an address-limited sales field; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of effective sale addresses which can be represented by each integer field as N/area _ movement _ num; determining the number of valid selling addresses that the first multi-valued field can represent as a × (N/area _ movement _ num);
when a (N/area _ movement _ num) is larger than or equal to area _ num, storing the relation between area _ num effective sales addresses and area _ movement _ num limited sales information into a sales address information field of a first multi-valued field;
when a (N/area _ movement _ num) < area _ num, storing the relationship between a (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a sales address information field of a first multi-valued field, and storing the relationship between the remaining (area _ num-a) (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; an integer field of each sales address information field stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information.
Alternatively, when N/area _ movement _ num is a non-integer, N/area _ movement _ num represents a quotient of N divided by area _ movement _ num; when the storage module stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information into one integer field of each sales address information field, N% of area _ movement _ num bits are left at the preset position of each integer field in the sales address information field.
Optionally, the storage mode is enumeration storage; the storage module stores the sales information of the article according to a storage mode, and comprises:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ motion _ num address-limited sales information into area _ num integer fields of the address-limited sales fields; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of valid sales addresses that each integer field can represent as b; determining the number of valid sale addresses which can be represented by the first multi-value field as a multiplied by b;
when a multiplied by b is larger than or equal to area _ num, storing the relation between area _ num effective sale addresses and the corresponding limited address sale information thereof into a sale address information field of a first multi-valued field;
when a multiplied by b is less than area _ num, storing the relation between a multiplied by b effective selling addresses and the corresponding limited address selling information into a selling address information field of a first multi-valued field, and storing the relation between the remaining (area _ num-a multiplied by b) effective selling addresses and the corresponding limited address selling information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; and one integer field of each sales address information field stores the relationship between b effective sales addresses and the corresponding address-limited sales information.
Optionally, the first multi-valued field further comprises: an identification bit field and/or an unlimited address sales information field; wherein,
the identification bit field comprises an integer field, and the stored content comprises: limiting the number of address sales information, the starting position of a sales address information field, limiting the number of address sales promotion information by using a multi-value field, a storage mode, a non-blacklist, and adopting a value of N/area _ num when a dictionary is stored or a value of area _ num when an enumeration storage is adopted;
the unlimited address sale information field comprises an integer field for storing the unlimited address sale information participated by the article.
Optionally, in the address-limited sales information field, one bit of each integer field corresponds to one address-limited sales information, a value of the bit is 1, which indicates that the article participates in the address-limited sales information, and a value of the bit is 0, which indicates that the article does not participate in the address-limited sales information;
in the unlimited address sale information field, each bit corresponds to unlimited address sale information, the value of the bit is 1, which indicates that the article participates in the unlimited address sale information, and the value of the bit is 0, which indicates that the article does not participate in the unlimited address sale information.
According to a third aspect of the embodiments of the present invention, a sales information query method is provided.
The sales information query method according to the embodiment of the invention comprises the following steps:
acquiring an address number of an address to be inquired from an address dictionary;
determining the storage position of the sales information of the address to be inquired in the multi-value field according to the following relation:
X1=Q/(N/area_promotion_num)
X21=(X1-1)×area_promotion_num
X22=X1×area_promotion_num-1
wherein Q represents the address number of the address to be inquired; n represents the number of bits in each integer field; area _ motion _ num represents the number of address limited sales information; x1 represents the number of the integer field in the sales address information field of the multi-valued field; x21, X22 denote bit sequence numbers in the integer field;
acquiring information of the X21 bit to the X22 bit of the X1 integer field in the sales address information field of the multi-value field to obtain the sales information of the address to be inquired;
the sales information is stored in a multi-value field by using a sales information storage method based on dictionary storage provided by the first aspect of the embodiment of the present invention, and the effective sales addresses in the sales address information field of the multi-value field are arranged in an ascending order of address numbers.
According to a fourth aspect of the embodiments of the present invention, there is provided a sales information query apparatus that implements the sales information query method provided by the third aspect of the embodiments of the present invention.
The sales information inquiry apparatus according to an embodiment of the present invention includes:
the first address number acquisition module is used for acquiring the address number of the address to be inquired from the address dictionary;
the first storage position determining module is used for determining the storage position of the sales information of the address to be inquired in the multi-value field according to the following relational expression:
X1=Q/(N/area_promotion_num)
X21=(X1-1)×area_promotion_num
X22=X1×area_promotion_num-1
wherein Q represents the address number of the address to be inquired; n represents the number of bits in each integer field; area _ motion _ num represents the number of address limited sales information; x1 represents the number of the integer field in the sales address information field of the multi-valued field; x21, X22 denote bit sequence numbers in the integer field;
the first sales information query module is used for acquiring information of the X21 bit to the X22 bit of the X1 th integer field in the sales address information field of the multi-value field to obtain the sales information of the address to be queried;
the sales information is stored in a multi-value field by using a sales information storage method based on dictionary storage provided by the first aspect of the embodiment of the present invention, and the effective sales addresses in the sales address information field of the multi-value field are arranged in an ascending order of address numbers.
According to a fifth aspect of the embodiments of the present invention, another sales information query method is provided.
The sales information query method according to the embodiment of the invention comprises the following steps:
acquiring an address number of an address to be inquired from an address dictionary;
determining the position of the address number of the address to be inquired in the sales address information field of the multi-value field by adopting a binary search method:
acquiring the sales information of the address to be inquired according to the position of the address number of the address to be inquired in the sales address information field of the multi-valued field;
the sales information is stored in a multi-value field by using a sales information storage method based on enumeration storage provided by the first aspect of the embodiment of the present invention, and each valid sales address in the sales address information field of the multi-value field is arranged in an ascending order of address numbers.
According to a sixth aspect of the embodiments of the present invention, there is provided a sales information query apparatus that implements the sales information query method provided by the fifth aspect of the embodiments of the present invention.
The sales information inquiry apparatus according to an embodiment of the present invention includes:
the second address number acquisition module is used for acquiring the address number of the address to be inquired from the address dictionary;
the second storage position determining module determines the position of the address number of the address to be inquired in the sales address information field of the multi-value field by adopting a binary search method:
the second sales information inquiry module acquires the sales information of the address to be inquired according to the position of the address number of the address to be inquired in the sales address information field of the multi-value field;
the sales information is stored in a multi-value field by using a sales information storage method based on enumeration storage provided by the first aspect of the embodiment of the present invention, and each valid sales address in the sales address information field of the multi-value field is arranged in an ascending order of address numbers.
According to another aspect of an embodiment of the present invention, there is provided a sales information storage electronic device.
The sales information storage electronic device according to an embodiment of the present invention includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the sales information storage method provided by the first aspect of the embodiment of the present invention.
According to yet another aspect of an embodiment of the present invention, a computer-readable medium is provided.
According to the computer-readable medium of the embodiment of the present invention, a computer program is stored thereon, which when executed by a processor implements the sales information storage method provided by the first aspect of the embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: according to the embodiment of the invention, the storage mode of the sales information of the article is determined according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary, and the storage mode of the sales information is dynamically selected, so that the accurate storage and screening of the limited address sales information can be ensured, the redundant storage is avoided, and meanwhile, the memory consumption and the query time consumption of the sales information are reduced as much as possible.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a sales information storage method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a multi-field for storing sales information by using the sales information storage method according to the embodiment of the present invention;
FIG. 3 is a block diagram of an address limited sales field in some embodiments of the invention;
FIG. 4 is a block diagram of an address limited sales field in accordance with further embodiments of the present invention;
fig. 5 is a schematic diagram of main blocks of a sales information storage apparatus according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
According to an aspect of an embodiment of the present invention, there is provided a sales information storage method.
Fig. 1 is a schematic diagram of a main flow of a sales information storage method according to an embodiment of the present invention. As shown in fig. 1, the sales information storage method includes: step S101, step S102, and step S103.
S101, obtaining sales information of an article; the sales information includes: address-limited sales information in which the item participates, and a sales address corresponding to each address-limited sales information.
The address-limited sales information is sales information for selling only in a part of the areas, whereas the sales information for selling in all the areas is non-address-limited sales information. The participation of a certain article in certain address-limited sales information means that the article participates or does not participate in the address-limited sales activities corresponding to the address-limited sales information. It should be noted that all the regions may be defined according to actual conditions, such as nationwide, asian, world wide, and the like.
Exemplarily, the following steps are carried out:
the information of the promotion activities executed in the regional scope of the country A is the unlimited address sales information; the information of the commodity promotion activities executed in certain provinces (such as A1, A2 and A3) of the country A is address-limited sales information, and the corresponding province addresses A1, A2 and A3 are sales addresses corresponding to the address-limited sales information;
the commodity sales information allowed to be sold worldwide is unlimited address sales information; the commodity sales information which is allowed to be sold only in certain countries or regions (such as B1, B2 and B3) is address-limited sales information, and the corresponding countries or regions B1, B2 and B3 are sales addresses corresponding to the address-limited sales information.
And S102, determining a storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary.
If the address numbers of the sales addresses participating in the limited address sales promotion and the situations that the sales addresses participate in the sales are directly stored, when the list is increased without restriction, the consumption of the memory cannot be predicted, and the time consumption of the query process is serious. If the sales states of all the sales addresses are stored based on the dictionary, the address numbers of the sales addresses do not need to be stored, so that the memory can be saved, and meanwhile, the corresponding promotion information of the specified sales addresses can be quickly positioned during query. However, when the number of black and white lists of addresses is small, a large amount of invalid data is introduced (5000 primary, secondary and tertiary addresses are shared in the whole country at present according to the division of administrative regions). Based on this, the embodiment of the present invention determines the storage manner of the sales information of the item according to the number of the limited address sales information, the number of the sales addresses, and the total number of the addresses in the preset address dictionary, and when the list of the sales addresses participating in the limited address sales promotion is short, stores the sales participation situation of each sales address in an enumeration storage manner (denoted as Z ═ 1); when the list of the sales addresses participating in the limited-address sales promotion is long, the situation that each sales address participates in the sales is stored in a dictionary storage mode (recorded as Z being 0).
If there are only 4 addresses in total across the country: beijing, Tianjin, Shanghai, Chongqing. The merchandise C participates in an address limited promotional campaign D (white list of addresses: beijing and tianjin, i.e. the promotion is only effective in beijing and tianjin). In the way that Z is 0, an address dictionary is needed to give 4 address numbers of the whole country: 1. beijing; 2. tianjin; 3. shanghai; 4. in the Chongqing, the positions corresponding to the 1 st and the 2 nd are set as 1 according to the dictionary sequence and the promotion rule, and the other positions are set as 0; wherein, 1 represents that the address of the position participates in the address-limited promotion D, and 0 represents that the address of the position does not participate in the address-limited promotion D. In the way of Z being 1, an address dictionary is not needed, and other addresses in the whole country are not concerned, and because the limited address promotion activity D is participated in by two cities of Tianjin in Beijing, the address numbers of the two cities are stored in the field (the address numbers are not continuous and can be a large number).
The embodiment of the invention can dynamically select the storage mode of the sales information according to the actual situation, ensure the correct storage and screening of the limited address sales information, avoid redundant storage and simultaneously reduce the memory consumption of the sales information as much as possible. Because the stored information is correct and redundant storage can be avoided, the query times in the process of querying the sales information can be greatly reduced, and the query time is further reduced.
Optionally, the storage means includes: dictionary storage and enumeration storage; determining a storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary, wherein the storage mode comprises the following steps: carrying out duplicate removal processing on the sales addresses corresponding to all the limited address sales information to obtain effective sales addresses corresponding to the articles; when the number of the limited address sales information, the number of the effective sales addresses and the total number of the addresses in the preset address dictionary meet the following relational expression, storing the relation between each effective address and each type of limited address sales information in a dictionary-based storage mode, otherwise, storing the relation between each effective address and each type of limited address sales information in an enumeration storage mode:
area_promotion_num×max_dict_num/area_num≤θ
in the formula, area _ motion _ num represents the number of address limited sales information; max _ dit _ num represents the total number of addresses in the preset address dictionary; area _ num represents the number of valid sales addresses; θ represents a constant.
By adopting the mode to judge the storage mode, the memory consumption of the stored sales information and the time consumption of inquiring the sales information can be further improved. The value of θ in the above relation can be selectively set according to actual conditions, for example, set to 8, 64, etc. The larger the value of θ is, the more tolerant the condition of the storage mode of enumeration storage is, that is, the larger the number of the corresponding sales addresses is when the storage mode of enumeration storage is adopted. Optionally, θ is 32, so that the search performance can be improved as much as possible while the memory consumption of the sales information is reduced, and the query time consumption is reduced.
In some embodiments, the storage means is dictionary storage; storing sales information for the item according to a storage means, comprising:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of the address-limited sales fields; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of effective sale addresses which can be represented by each integer field as N/area _ movement _ num; determining the number of valid selling addresses that the first multi-valued field can represent as a × (N/area _ movement _ num);
when a (N/area _ movement _ num) is larger than or equal to area _ num, storing the relation between area _ num effective sales addresses and area _ movement _ num limited sales information into a sales address information field of a first multi-valued field;
when a (N/area _ movement _ num) < area _ num, storing the relationship between a (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a sales address information field of a first multi-valued field, and storing the relationship between the remaining (area _ num-a) (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; an integer field of each sales address information field stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information.
FIG. 3 is a block diagram of an address limited sales field in some embodiments of the invention. It is assumed that one multi-value field includes only an address-limited sales field and a sales address information field, and one multi-value field includes 255 integer fields int, and each integer field includes 64 bits (bit), denoted as int 64. In the case of the article of merchandise E,
if the commodity E only corresponds to 1 address-limited promotion information, that is, area _ movement _ num is 1, and the address-limited promotion information needs 1 integer in total, the number a of integer fields included in the sales address information field in the first multi-value field (when multiple multi-value fields are mostly used to represent sales information, the first multi-value field is the first multi-value field, the second multi-value field is the second multi-value field, and so on) is 255-1-254; the number of valid sales addresses that each integer field can represent is: 64/1 ═ 64; the number of valid sales addresses that the first multi-valued field can represent is: 254 × 64 ═ 16256;
if the commodity E corresponds to 2 pieces of address-limited promotion information, that is, area _ movement _ num is 2, and the address-limited promotion information needs 2 integers in total, the number a of integer fields included in the sales address information field in the first multi-value field is 255-2, 253; the number of valid sales addresses that each integer field can represent is: 64/2 ═ 32; the number of valid sales addresses that the first multi-valued field can represent is: 253 × 32 ═ 8096;
if the commodity E corresponds to 3 pieces of address-limited promotion information, that is, area _ promotion _ num is 3, and 3 integer types are required in the total of the flag bit, the national promotion and the address-limited promotion information, the number a of integer types included in the sales address information field in the first multi-value field is 255-3 and 252; the number of valid sales addresses that each integer field can represent is: 64/3 ═ 21; the number of valid sales addresses that the first multi-valued field can represent is: 252 × 21 ═ 5292;
if the commodity E corresponds to 6 pieces of address-limited promotion information, that is, area _ movement _ num is 6, the address-limited promotion information totally needs 8 integers, and assuming that two multi-value fields (a first multi-value field and a second multi-value field) are used for representing the sales information of the commodity E, the number of the integer fields included in the sales address information field in the first multi-value field is 255 × 2-6, which is 504; the number of valid sales addresses that each integer field can represent is: 64/6 ═ 10; assume that the number of valid sales addresses that can be represented using two multivalued fields (a first multivalued field and a second multivalued field) is: 504 × 10 ═ 5040.
Alternatively, when N/area _ movement _ num is a non-integer, N/area _ movement _ num represents a quotient of N divided by area _ movement _ num, for example, when N is 64, and area _ movement _ num is 3, a quotient of 64 divided by 3 is 21, and a remainder is 1, N/area _ movement _ num is 21; when the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited address sales information is stored in one integer field of each sales address information field, N% of area _ movement _ num bits are left at the preset position of each integer field in the sales address information field, and the N% of area _ movement _ num represents the remainder of N divided by area _ num. For example, assuming that each sales address only needs 1 bit, when area _ movement _ num is 1, one integer field stores 64 sales addresses; when area _ motion _ num is 3, 64 cannot be divided by 3, the quotient is 21, the remainder is 2, the 2 bits need to be combined with 1 bit of another integer to represent the sale condition of an address, and the reading and writing across the integers are easy to have errors, so that the 2 bits are left empty and no value is stored. Therefore, mistakes in the process of inquiring the sales information can be avoided, and the accuracy of the inquiry result is improved.
In the practical application process, each address can be set with a number through the address dictionary. No matter how many addresses exist, the number B (bit) corresponding to the address A which needs to be inquired can be located by only once looking up the address dictionary (the address dictionary can store each address and the number thereof by adopting a Hash structure), then the information of the position B is directly taken from the multi-value field for storing the sales information, and then the limited address promotion condition participated by the address A is obtained by combining the information with the specific limited address promotion information. Therefore, the query efficiency can be greatly improved, and the effect of reducing the time consumption of query is achieved.
For example: the merchandise participates in two limited-address promotions P1 and P2 (the number of limited-address promotions C is 2), which are 199-100 (i.e., full 199 minus 100 yuan) and 99-50 (i.e., full 99 yuan minus 50 yuan), respectively, and specific addresses are participated in the two limited-address promotions and are stored in the sales address information field. Assuming that the promotion condition of the commodity at the address a is to be checked, firstly, the address dictionary is checked to obtain the number B corresponding to the address a, and since one integer can store 32 addresses (64/C), the promotion condition of the address a is at the (B% 32-1) × C to (B% 32) × C-1 bits of the (B/32) th integer (the index of the array in the computer language starts from 0, so that for example, B ═ 2, that is, the 2 nd to 3 rd bits of the 0(2/32) th integer exist). The C bit is taken out, and is assumed to be 01, which indicates that the product participates in the second promotion at the address A, but does not participate in the first promotion, namely participates in 99-50.
In other embodiments, the storage manner is enumerated storage; storing sales information for the item according to a storage means, comprising:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of an address-limited sales field; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of valid sales addresses that each integer field can represent as b; determining the number of valid sale addresses which can be represented by the first multi-value field as a multiplied by b;
when a x b is larger than or equal to area _ num, storing the relation between area _ num effective sale addresses and the corresponding limited address sale information into the sale address information field of the first multi-valued field. Fig. 4 is a schematic structural diagram of an address-limited sales field in further embodiments of the present invention, and as shown in fig. 4, it is assumed that a multi-value field only includes an address-limited sales field and a sales address information field, and a multi-value field includes 255 integer fields, and if each integer stores 2 sales addresses (for example, the first 12 bits in the integer store whether a first sales address participates in an address-limited sales activity, the next 20 bits store the first sales address, the next 12 bits store whether a second sales address participates in an address-limited sales activity, and the next 20 bits store the second sales address), a total of 510 sales addresses are stored.
When a multiplied by b is less than area _ num, the relation between a multiplied by b effective sales addresses and the corresponding limited address sales information is stored in the sales address information field of the first multi-valued field, and the relation between the remaining (area _ num-a multiplied by b) effective sales addresses and the corresponding limited address sales information is stored in the second multi-valued field. The number of the required multi-value fields can be determined according to the number of the sales addresses in the practical application process.
Wherein the second multi-valued field includes only a sales address information field; and one integer field of each sales address information field stores the relationship between b effective sales addresses and the corresponding address-limited sales information.
In the practical application process, a number can be set for each address through an address dictionary, each address is stored according to the ascending order of the address numbers in the storage process, and the information of the address can be determined according to a binary search method during query. Therefore, the query times can be greatly reduced, the query efficiency is improved, and the effect of reducing the time consumption of query is achieved.
Binary search is also called binary search. The specific process is as follows: firstly, supposing that the elements in the table are arranged in ascending order, comparing the keywords recorded in the middle position of the table with the search keywords, and if the keywords are equal to the search keywords, the search is successful; otherwise, the table is divided into a front sub-table and a rear sub-table by using the middle position record, if the key word of the middle position record is larger than the search key word, the front sub-table is further searched, and if not, the rear sub-table is further searched. The above process is repeated until a record is found that satisfies the condition, such that the lookup is successful, or until a sub-table does not exist, at which point the lookup is unsuccessful.
For example: the address dictionary comprises 10 addresses A1-A10. The commodities participate in two limited-address sales promotions P1 and P2 (the number of limited-address sales promotions C is 2). The former is 199-100 (i.e. full 199 minus 100), the participating addresses are numbered A1, A2, A4 and A7, the latter is 99-50 (i.e. full 99 minus 50), and the participating addresses are numbered A2 and A3. Storing the limited address promotion information of 5 addresses of A1, A2, A3, A4 and A7 participating in promotion according to an enumeration storage mode, wherein the limited address promotion information is stored in an ascending order when being stored, each address occupies 32 bits, the first 12 bits store the promotion participation condition (namely whether participating in the limited address sale event), and the last 20 bits store the number of each address in a multi-value field. For example, the participation in the promotion of address A1 is 10, indicating that address A1 participates in the first limited address promotion P1, and does not participate in the second limited address promotion P2; the A2 address participation case is 11, indicating that two limited address promotions P1 and P2 address A2 are both participating. Assuming that the sales promotion of the product at the address a1 is to be checked, it is known that a total of 5 addresses are stored, and the number of each address in the multi-value field starts from 0. According to binary search, (0+4/2) ═ 2, firstly, the address number of 2 in the multi-value field is checked to be A3, and the address number is larger than the address number of A1 to be checked; then, (0+1)/2 is 0, the address a1 with the number 0 is checked for the second time, the situation that the address a1 participates in the promotion is found, and the limited address promotion information is taken. Assuming that the address number is searched for A5, the situation that the address is not found to participate in the promotion by the binary search indicates that the merchandise does not participate in the limited address promotion at A5.
Fig. 2 is a schematic structural diagram of a multi-field for storing sales information by using the sales information storage method according to the embodiment of the present invention. As shown in fig. 2, the first multi-valued field further includes: an identification bit field and/or an unlimited address sales information field; wherein,
the identification bit field comprises an integer field, and the stored content comprises: limiting the number of address sales information, the starting position of a sales address information field, limiting the number of address sales promotion information by using a multi-value field, a storage mode, a non-blacklist, and adopting a value of N/area _ num when a dictionary is stored or a value of area _ num when an enumeration storage is adopted;
the unlimited address sale information field comprises an integer field for storing the unlimited address sale information participated by the article.
The identification bit field can assist the field value to be correctly analyzed, and the efficiency and the accuracy of inquiring and screening the sales information are improved. And setting an unlimited address sale information field, which is suitable for storing the sale information of the article participating in the unlimited address sale information.
Optionally, in the address-limited sales information field, one bit of each integer field corresponds to one address-limited sales information, a value of the bit is 1, which indicates that the article participates in the address-limited sales information, and a value of the bit is 0, which indicates that the article does not participate in the address-limited sales information;
in the unlimited address sale information field, each bit corresponds to unlimited address sale information, the value of the bit is 1, which indicates that the article participates in the unlimited address sale information, and the value of the bit is 0, which indicates that the article does not participate in the unlimited address sale information.
The sales information storage method according to the embodiment of the present invention is described below with reference to fig. 2 to 4. In this embodiment, the first multi-valued field for storing sales information of an item includes: an identification bit field, an unlimited address sale information field, an limited address sale information field and a sale address information field. The first multi-value field includes 255 integer fields, each of which includes 64 bits of N. In the case of the article of merchandise E,
if the commodity G only corresponds to 1 address-limited sales promotion information, that is, area _ promotion _ num is 1, and 3 integer types are required in all of the identification bit field + the unlimited address sales information field + the limited address sales information field, the number a of the integer types included in the sales address information field in the first multi-valued field is 255-3, 252; the number of valid sales addresses that each integer field can represent is: 64/1 ═ 64; the number of valid sales addresses that the first multi-valued field can represent is: 252 × 64 ═ 16128;
if the commodity G corresponds to 2 pieces of address-limited sales promotion information, that is, area _ promotion _ num is 2, 4 integer types are required in all of the identification bit field + the unlimited address sales information field + the limited address sales information field, and the number a of the integer types included in the sales address information field in the first multi-valued field is 255-4, 251; the number of valid sales addresses that each integer field can represent is: 64/2 ═ 32; the number of valid sales addresses that the first multi-valued field can represent is: 251 × 32 ═ 8032;
if the commodity G corresponds to 3 pieces of address-limited sales promotion information, that is, area _ promotion _ num is 3, and the identification bit field + the unlimited address sales information field + the limited address sales information field totally needs 5 integer types, the number a of the integer types included in the sales address information field in the first multi-valued field is 255-5, which is 250; the number of valid sales addresses that each integer field can represent is: 64/3 ═ 21; the number of valid sales addresses that the first multi-valued field can represent is: 250 × 21 ═ 5250;
if the commodity G corresponds to 6 pieces of address-limited sales promotion information, that is, area _ movement _ num is 6, 8 integers are required in all of the identification bit field + the unlimited address sales information field + the address-limited sales information field, and assuming that two multi-value fields (a first multi-value field and a second multi-value field) are used to represent the sales information of the commodity E, the number of integer fields included in the sales address information field in the first multi-value field is 255 × 2-8, which is 502; the number of valid sales addresses that each integer field can represent is: 64/6 ═ 10; assume that the number of valid sales addresses that can be represented using two multivalued fields (a first multivalued field and a second multivalued field) is: 502 × 10 ═ 5020.
And step S103, storing the sales information of the article according to the storage mode.
The main flow of the sales information storage method according to the embodiment of the present invention is exemplarily described below. Wherein, sales refers to promotions. Before storage, we have obtained: 1) the number of all promotions (including address limited promotions and national promotions) each item participates in; 2) whether each commodity participates in the limited address sales promotion; 3) national promotions for each item; (4) status of each promotional area (i.e., promotional at certain addresses or no promotional at certain addresses). The main flow of the sales information storage method comprises the following steps:
for each commodity:
(1) judging whether the commodity participates in address-limited sales promotion, if not, jumping to (13); if yes, jumping to (2);
(2) all promotions for which the item participates are judged as follows:
a) if the promotion is a national promotion, ending and judging the next promotion participated in by the commodity; otherwise, jumping to b);
b) if the promotion type of the limited-address promotion is included in the national promotion, ending and judging the next promotion participated in by the commodity; otherwise, jumping to c);
c) storing the address number and the mapping relation area _ map of the promotion for all black and white list addresses of the promotion (the black list refers to a list of all addresses not participating in the promotion, and the white list refers to a list of all addresses participating in the promotion);
d) if the commodity needs to store the limited address promotion, setting the identifier area _ flag of the commodity to be 1 so as to mark that the commodity needs to store the limited address promotion;
e) assigning a number n (the number n increases from 0 in sequence, and n is an integer) to the address-limited promotion;
(3) if the area _ flag is 0, jumping to (13);
(4) calculating the number n of address-limited promotions which need to be stored actually and the number m of addresses which need to be stored, calculating whether address information is stored in a mode that Z is 0 according to the method in the step S102, if so, jumping to (5), otherwise, jumping to (8);
(5) calculating identification bits, storing national sales promotion information, and storing n address-limited sales promotion information according to the number;
(6) allocating (n +1) bit positions to all addresses in the country to store information participating in address restriction promotion, and setting all bit positions corresponding to blacklist promotion to be 1;
(7) for all addresses in the area _ map, setting 1 (white list promotion) or 0 (black list promotion) at the position corresponding to the address and the sublevel address thereof, and then jumping to (12);
(8) calculating identification bits, storing national sales promotion information, and storing n address-limited sales promotions according to the numbers;
(9) distributing n bits for each of m addresses needing to be stored to store information participating in address-limited promotion, and setting all bits corresponding to blacklist promotion to be 1;
(10) for all addresses in the area _ map, setting 1 (white list promotion) or 0 (black list promotion) at the position corresponding to the address and the sublevel address thereof;
(11) all address numbers to be stored and data of address participation limited address promotion are spliced together;
(12) obtaining complete promotion field information of the goods participating in the limited address promotion;
(13) promotional field information for the item is obtained.
According to still another aspect of an embodiment of the present invention, there is provided a sales information storage apparatus.
Fig. 5 is a schematic diagram of main blocks of a sales information storage apparatus according to an embodiment of the present invention, as shown in fig. 5, a sales information storage apparatus 500 according to an embodiment of the present invention includes:
an obtaining module 501, which obtains sales information of an article; the sales information includes: limited address sales information in which the article participates, and a sales address corresponding to each limited address sales information;
the confirming module 502 is used for determining the storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary;
the storage module 503 stores the sales information of the item according to the storage method.
Optionally, the storage means includes: dictionary storage and enumeration storage; the confirming module determines the storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary, and the confirming module comprises the following steps:
carrying out duplicate removal processing on the sales addresses corresponding to all the limited address sales information to obtain effective sales addresses corresponding to the articles;
when the number of the limited address sales information, the number of the effective sales addresses and the total number of the addresses in the preset address dictionary meet the following relational expression, storing the relation between each effective address and each type of limited address sales information in a dictionary-based storage mode, otherwise, storing the relation between each effective address and each type of limited address sales information in an enumeration storage mode:
area_promotion_num×max_dict_num/area_num≤θ
in the formula, area _ motion _ num represents the number of address limited sales information; max _ dit _ num represents the total number of addresses in the preset address dictionary; area _ num represents the number of valid sales addresses; θ represents a constant.
Optionally, the storage mode is dictionary storage; the storage module stores the sales information of the article according to a storage mode, and comprises:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of an address-limited sales field; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of effective sale addresses which can be represented by each integer field as N/area _ movement _ num; determining the number of valid selling addresses that the first multi-valued field can represent as a × (N/area _ movement _ num);
when a (N/area _ movement _ num) is larger than or equal to area _ num, storing the relation between area _ num effective sales addresses and area _ movement _ num limited sales information into a sales address information field of a first multi-valued field;
when a (N/area _ movement _ num) < area _ num, storing the relationship between a (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a sales address information field of a first multi-valued field, and storing the relationship between the remaining (area _ num-a) (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; an integer field of each sales address information field stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information.
Alternatively, when N/area _ movement _ num is a non-integer, N/area _ movement _ num represents a quotient of N divided by area _ movement _ num; when the storage module stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information into one integer field of each sales address information field, N% of area _ movement _ num bits are left at the preset position of each integer field in the sales address information field.
Optionally, the storage mode is enumeration storage; the storage module stores the sales information of the article according to a storage mode, and comprises:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of an address-limited sales field; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of valid sales addresses that each integer field can represent as b; determining the number of valid sale addresses which can be represented by the first multi-value field as a multiplied by b;
when a multiplied by b is larger than or equal to area _ num, storing the relation between area _ num effective sale addresses and the corresponding limited address sale information thereof into a sale address information field of a first multi-valued field;
when a multiplied by b is less than area _ num, storing the relation between a multiplied by b effective selling addresses and the corresponding limited address selling information into a selling address information field of a first multi-valued field, and storing the relation between the remaining (area _ num-a multiplied by b) effective selling addresses and the corresponding limited address selling information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; and one integer field of each sales address information field stores the relationship between b effective sales addresses and the corresponding address-limited sales information.
Optionally, the first multi-valued field further comprises: an identification bit field and/or an unlimited address sales information field; wherein,
the identification bit field comprises an integer field, and the stored content comprises: limiting the number of address sales information, the starting position of a sales address information field, the number of multi-value fields, a storage mode, the number of non-blacklist address promotion information, and adopting the value of N/area _ promotion _ num when a dictionary is used for storage or the value of area _ num when enumeration storage is used;
the unlimited address sale information field comprises an integer field for storing the unlimited address sale information participated by the article.
Optionally, in the address-limited sales information field, one bit of each integer field corresponds to one address-limited sales information, a value of the bit is 1, which indicates that the article participates in the address-limited sales information, and a value of the bit is 0, which indicates that the article does not participate in the address-limited sales information;
in the unlimited address sale information field, each bit corresponds to unlimited address sale information, the value of the bit is 1, which indicates that the article participates in the unlimited address sale information, and the value of the bit is 0, which indicates that the article does not participate in the unlimited address sale information.
According to a third aspect of the embodiments of the present invention, a sales information query method is provided.
The sales information query method according to the embodiment of the invention comprises the following steps:
acquiring an address number of an address to be inquired from an address dictionary;
determining the storage position of the sales information of the address to be inquired in the multi-value field according to the following relation:
X1=Q/(N/area_promotion_num)
X21=(X1-1)×area_promotion_num
X22=X1×area_promotion_num-1
wherein Q represents the address number of the address to be inquired; n represents the number of bits in each integer field; area _ motion _ num represents the number of address limited sales information; x1 represents the number of the integer field in the sales address information field of the multi-valued field; x21, X22 denote bit sequence numbers in the integer field;
acquiring information of the X21 bit to the X22 bit of the X1 integer field in the sales address information field of the multi-value field to obtain the sales information of the address to be inquired;
the sales information is stored in a multi-value field by using a sales information storage method based on dictionary storage provided by the first aspect of the embodiment of the present invention, and the effective sales addresses in the sales address information field of the multi-value field are arranged in an ascending order of address numbers.
In the practical application process, each address can be set with a number through the address dictionary. No matter how many addresses exist, the number B (bit) corresponding to the address A which needs to be inquired can be located by only once looking up the address dictionary (the address dictionary can store each address and the number thereof by adopting a Hash structure), then the information of the position B is directly taken from the multi-value field for storing the sales information, and then the limited address promotion condition participated by the address A is obtained by combining the information with the specific limited address promotion information. Therefore, the query efficiency can be greatly improved, and the effect of reducing the time consumption of query is achieved.
For example: the merchandise participates in two limited-address promotions P1 and P2 (the number of limited-address promotions C is 2), which are 199-100 (i.e., full 199 minus 100 yuan) and 99-50 (i.e., full 99 yuan minus 50 yuan), respectively, and specific addresses are participated in the two limited-address promotions and are stored in the sales address information field. Assuming that the promotion condition of the commodity at the address a is to be checked, firstly, the address dictionary is checked to obtain the number B corresponding to the address a, and since one integer can store 32 addresses (64/C), the promotion condition of the address a is at the (B% 32-1) × C to (B% 32) × C-1 bits of the (B/32) th integer (the index of the array in the computer language starts from 0, so that for example, B ═ 2, that is, the 2 nd to 3 rd bits of the 0(2/32) th integer exist). The C bit is taken out, and is assumed to be 01, which indicates that the product participates in the second promotion at the address A, but does not participate in the first promotion, namely participates in 99-50.
According to a fourth aspect of the embodiments of the present invention, there is provided a sales information query apparatus that implements the sales information query method provided by the third aspect of the embodiments of the present invention.
The sales information inquiry apparatus according to an embodiment of the present invention includes:
the first address number acquisition module is used for acquiring the address number of the address to be inquired from the address dictionary;
the first storage position determining module is used for determining the storage position of the sales information of the address to be inquired in the multi-value field according to the following relational expression:
X1=Q/(N/area_promotion_num)
X21=(X1-1)×area_promotion_num
X22=X1×area_promotion_num-1
wherein Q represents the address number of the address to be inquired; n represents the number of bits in each integer field; area _ motion _ num represents the number of address limited sales information; x1 represents the number of the integer field in the sales address information field of the multi-valued field; x21, X22 denote bit sequence numbers in the integer field;
the first sales information query module is used for acquiring information of the X21 bit to the X22 bit of the X1 th integer field in the sales address information field of the multi-value field to obtain the sales information of the address to be queried;
the sales information is stored in a multi-value field by using a sales information storage method based on dictionary storage provided by the first aspect of the embodiment of the present invention, and the effective sales addresses in the sales address information field of the multi-value field are arranged in an ascending order of address numbers.
According to a fourth aspect of the embodiments of the present invention, there is provided another sales information query method.
The sales information query method according to the embodiment of the invention comprises the following steps:
acquiring an address number of an address to be inquired from an address dictionary;
determining the position of the address number of the address to be inquired in the sales address information field of the multi-value field by adopting a binary search method:
acquiring the sales information of the address to be inquired according to the position of the address number of the address to be inquired in the sales address information field of the multi-valued field;
the sales information is stored in a multi-value field by using a sales information storage method based on enumeration storage provided by the first aspect of the embodiment of the present invention, and each valid sales address in the sales address information field of the multi-value field is arranged in an ascending order of address numbers.
In the practical application process, a number can be set for each address through an address dictionary, each address is stored according to the ascending order of the address numbers in the storage process, and the information of the address can be determined according to a binary search method during query. Therefore, the query times can be greatly reduced, the query efficiency is improved, and the effect of reducing the time consumption of query is achieved.
For example: the address dictionary comprises 10 addresses A1-A10. The commodities participate in two limited-address sales promotions P1 and P2 (the number of limited-address sales promotions C is 2). The former is 199-100 (i.e. full 199 minus 100), the participating addresses are numbered A1, A2, A4 and A7, the latter is 99-50 (i.e. full 99 minus 50), and the participating addresses are numbered A2 and A3. Storing the limited address promotion information of 5 addresses of A1, A2, A3, A4 and A7 participating in promotion according to an enumeration storage mode, wherein the limited address promotion information is stored in an ascending order when being stored, each address occupies 32 bits, the first 12 bits store the promotion participation condition (namely whether participating in the limited address sale event), and the last 20 bits store the number of each address in a multi-value field. For example, the participation in the promotion of address A1 is 10, indicating that address A1 participates in the first limited address promotion P1, and does not participate in the second limited address promotion P2; the A2 address participation case is 11, indicating that two limited address promotions P1 and P2 address A2 are both participating. Assuming that the sales promotion of the product at the address a1 is to be checked, it is known that a total of 5 addresses are stored, and the number of each address in the multi-value field starts from 0. According to binary search, (0+4/2) ═ 2, firstly, the address number of 2 in the multi-value field is checked to be A3, and the address number is larger than the address number of A1 to be checked; then, (0+1)/2 is 0, the address a1 with the number 0 is checked for the second time, the situation that the address a1 participates in the promotion is found, and the limited address promotion information is taken. Assuming that the address number is searched for A5, the situation that the address is not found to participate in the promotion by the binary search indicates that the merchandise does not participate in the limited address promotion at A5.
According to a sixth aspect of the embodiments of the present invention, there is provided a sales information query apparatus that implements the sales information query method provided by the fifth aspect of the embodiments of the present invention.
The sales information inquiry apparatus according to an embodiment of the present invention includes:
the second address number acquisition module is used for acquiring the address number of the address to be inquired from the address dictionary;
the second storage position determining module determines the position of the address number of the address to be inquired in the sales address information field of the multi-value field by adopting a binary search method:
the second sales information inquiry module acquires the sales information of the address to be inquired according to the position of the address number of the address to be inquired in the sales address information field of the multi-value field;
the sales information is stored in a multi-value field by using a sales information storage method based on enumeration storage provided by the first aspect of the embodiment of the present invention, and each valid sales address in the sales address information field of the multi-value field is arranged in an ascending order of address numbers.
According to another aspect of an embodiment of the present invention, there is provided a sales information storage electronic device.
The sales information storage electronic device according to an embodiment of the present invention includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the sales information storage method provided by the first aspect of the embodiment of the present invention.
Fig. 6 shows an exemplary system architecture 600 of a sales information storage method or a sales information storage apparatus to which an embodiment of the present invention can be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the sales information storage method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the sales information storage apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprising: the acquisition module acquires sales information of the article; the sales information includes: limited address sales information in which the article participates, and a sales address corresponding to each limited address sales information; the confirmation module is used for determining the storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary; and the storage module is used for storing the sales information of the article according to the storage mode. Where the names of these modules do not in some cases constitute a limitation on the module itself, for example, a confirmation module may also be described as a "module that obtains sales information for an item".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring sales information of an article; the sales information includes: limited address sales information in which the article participates, and a sales address corresponding to each limited address sales information; determining a storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary; and storing the sales information of the article according to the storage mode.
According to the technical scheme of the embodiment of the invention, the storage mode of the sales information of the article is determined according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary, and the storage mode of the sales information is dynamically selected, so that the accurate storage and screening of the limited address sales information can be ensured, the redundant storage is avoided, and the memory consumption and the query time consumption of the sales information are reduced as much as possible.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (18)
1. A sales information storage method, comprising:
acquiring sales information of an article; the sales information includes: the address-limited sale information of the participation of the article and the sale address corresponding to each address-limited sale information;
determining a storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in a preset address dictionary;
and storing the sales information of the article according to the storage mode.
2. The method of claim 1, wherein the storing means comprises: dictionary storage and enumeration storage; determining a storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in a preset address dictionary, wherein the storage mode comprises the following steps:
carrying out duplicate removal processing on the sales addresses corresponding to all the limited address sales information to obtain effective sales addresses corresponding to the articles;
when the number of the limited address sales information, the number of the effective sales addresses and the total number of the addresses in the preset address dictionary meet the following relational expression, storing the relation between each effective address and each type of limited address sales information in a dictionary-based storage mode, otherwise, storing the relation between each effective address and each type of limited address sales information in an enumeration storage mode:
area_promotion_num×max_dict_num/area_num≤θ
in the formula, area _ motion _ num represents the number of address limited sales information; max _ dit _ num represents the total number of addresses in the preset address dictionary; area _ num represents the number of valid sales addresses; θ represents a constant.
3. The method of claim 2, wherein the storage means is dictionary storage; storing the sales information of the article according to the storage mode, comprising:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of the address-limited sales fields; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of effective sale addresses which can be represented by each integer field as N/area _ movement _ num; determining the number of valid selling addresses that the first multi-valued field can represent as a × (N/area _ movement _ num);
when a (N/area _ movement _ num) is larger than or equal to area _ num, storing the relation between area _ num effective sales addresses and area _ movement _ num limited sales information into a sales address information field of a first multi-valued field;
when a (N/area _ movement _ num) < area _ num, storing the relationship between a (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a sales address information field of a first multi-valued field, and storing the relationship between the remaining (area _ num-a) (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; an integer field of each sales address information field stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information.
4. The method of claim 2, wherein when N/area _ motion _ num is a non-integer, N/area _ motion _ num represents a quotient of N divided by area _ motion _ num; when the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited-address sales information is stored in one integer field of each sales address information field, N% of area _ movement _ num bits are left at the preset position of each integer field in the sales address information field.
5. The method of claim 2, wherein the storage manner is an enumeration storage; storing the sales information of the article according to the storage mode, comprising:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of the address-limited sales fields; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of valid sales addresses that each integer field can represent as b; determining the number of valid sale addresses which can be represented by the first multi-value field as a multiplied by b;
when a multiplied by b is larger than or equal to area _ num, storing the relation between area _ num effective sale addresses and the corresponding limited address sale information thereof into a sale address information field of a first multi-valued field;
when a multiplied by b is less than area _ num, storing the relation between a multiplied by b effective selling addresses and the corresponding limited address selling information into a selling address information field of a first multi-valued field, and storing the relation between the remaining (area _ num-a multiplied by b) effective selling addresses and the corresponding limited address selling information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; and one integer field of each sales address information field stores the relationship between b effective sales addresses and the corresponding address-limited sales information.
6. The method of any of claims 3-5, wherein the first multi-valued field further comprises: an identification bit field and/or an unlimited address sales information field; wherein,
the identification bit field comprises an integer field, and the stored content comprises: limiting the number of address sales information, the starting position of a sales address information field, the number of multi-value fields, a storage mode, the number of non-blacklist address promotion information, and adopting the value of N/area _ promotion _ num when a dictionary is used for storage or the value of area _ num when enumeration storage is used;
the unlimited address sale information field comprises an integer field for storing the unlimited address sale information participated by the article.
7. The method of claim 6, wherein in the address-limited sales information field, one bit of each integer field corresponds to address-limited sales information, a value of the bit is 1, which indicates that the article participates in the address-limited sales information, and a value of the bit is 0, which indicates that the article does not participate in the address-limited sales information;
in the unlimited address sale information field, each bit corresponds to unlimited address sale information, the value of the bit is 1, which indicates that the article participates in the unlimited address sale information, and the value of the bit is 0, which indicates that the article does not participate in the unlimited address sale information.
8. A sales information storage apparatus, comprising:
the acquisition module acquires sales information of the article; the sales information includes: the address-limited sale information of the participation of the article and the sale address corresponding to each address-limited sale information;
the confirmation module is used for determining the storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary;
and the storage module is used for storing the sales information of the articles according to the storage mode.
9. The apparatus of claim 8, wherein the means for storing comprises: dictionary storage and enumeration storage; the confirming module determines the storage mode of the sales information of the article according to the number of the limited address sales information, the number of the sales addresses and the total number of the addresses in the preset address dictionary, and the confirming module comprises the following steps:
carrying out duplicate removal processing on the sales addresses corresponding to all the limited address sales information to obtain effective sales addresses corresponding to the articles;
when the number of the limited address sales information, the number of the effective sales addresses and the total number of the addresses in the preset address dictionary meet the following relational expression, storing the relation between each effective address and each type of limited address sales information in a dictionary-based storage mode, otherwise, storing the relation between each effective address and each type of limited address sales information in an enumeration storage mode:
area_promotion_num×max_dict_num/area_num≤θ
in the formula, area _ motion _ num represents the number of address limited sales information; max _ dit _ num represents the total number of addresses in the preset address dictionary; area _ num represents the number of valid sales addresses; θ represents a constant.
10. The apparatus of claim 9, wherein the storage means is dictionary storage; the storage module stores the sales information of the articles according to the storage mode, and comprises the following steps:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of the address-limited sales fields; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of effective sale addresses which can be represented by each integer field as N/area _ movement _ num; determining the number of valid selling addresses that the first multi-valued field can represent as a × (N/area _ movement _ num);
when a (N/area _ movement _ num) is larger than or equal to area _ num, storing the relation between area _ num effective sales addresses and area _ movement _ num limited sales information into a sales address information field of a first multi-valued field;
when a (N/area _ movement _ num) < area _ num, storing the relationship between a (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a sales address information field of a first multi-valued field, and storing the relationship between the remaining (area _ num-a) (N/area _ movement _ num) effective sales addresses and area _ movement _ num limited address sales information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; an integer field of each sales address information field stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information.
11. The apparatus of claim 9, wherein when N/area _ num is a non-integer, N/area _ motion _ num represents a quotient of N divided by area _ motion _ num; when the storage module stores the relation between N/area _ movement _ num effective sales addresses and area _ movement _ num limited sales information into one integer field of each sales address information field, N% of area _ movement _ num bits are left at the preset position of each integer field in the sales address information field.
12. The apparatus of claim 9, wherein the storage manner is an enumeration storage; the storage module stores the sales information of the articles according to the storage mode, and comprises the following steps:
determining the number of integer fields included in the upper address sale field in the first multi-valued field as area _ motion _ num; respectively storing area _ movement _ num address-limited sales information into area _ movement _ num integer fields of the address-limited sales fields; wherein the first multi-valued field comprises M integer fields; each integer field comprises N bits;
determining the number of integer fields included in a sales address information field in a first multi-valued field according to M and area _ movement _ num, wherein the number of integer fields is a; determining the number of valid sales addresses that each integer field can represent as b; determining the number of valid sale addresses which can be represented by the first multi-value field as a multiplied by b;
when a multiplied by b is larger than or equal to area _ num, storing the relation between area _ num effective sale addresses and the corresponding limited address sale information thereof into a sale address information field of a first multi-valued field;
when a multiplied by b is less than area _ num, storing the relation between a multiplied by b effective selling addresses and the corresponding limited address selling information into a selling address information field of a first multi-valued field, and storing the relation between the remaining (area _ num-a multiplied by b) effective selling addresses and the corresponding limited address selling information into a second multi-valued field;
wherein the second multi-valued field includes only a sales address information field; and one integer field of each sales address information field stores the relationship between b effective sales addresses and the corresponding address-limited sales information.
13. The apparatus of any of claims 10-12, wherein the first multi-valued field further comprises: an identification bit field and/or an unlimited address sales information field; wherein,
the identification bit field comprises an integer field, and the stored content comprises: limiting the number of address sales information, the starting position of a sales address information field, limiting the number of address sales promotion information by using a multi-value field, a storage mode, a non-blacklist, and adopting a value of N/area _ num when a dictionary is stored or a value of area _ num when an enumeration storage is adopted;
the unlimited address sale information field comprises an integer field for storing the unlimited address sale information participated by the article.
14. The apparatus of claim 13, wherein in the address-limited sales information field, one bit of each integer field corresponds to an address-limited sales information, a value of 1 for the bit indicates that the article participates in the address-limited sales information, and a value of 0 for the bit indicates that the article does not participate in the address-limited sales information;
in the unlimited address sale information field, each bit corresponds to unlimited address sale information, the value of the bit is 1, which indicates that the article participates in the unlimited address sale information, and the value of the bit is 0, which indicates that the article does not participate in the unlimited address sale information.
15. A method for inquiring sales information is characterized by comprising the following steps:
acquiring an address number of an address to be inquired from an address dictionary;
determining the storage position of the sales information of the address to be inquired in the multi-value field according to the following relation:
X1=Q/(N/area_promotion_num)
X21=(X1-1)×area_promotion_num
X22=X1×area_promotion_num-1
wherein Q represents the address number of the address to be inquired; n represents the number of bits in each integer field; area _ motion _ num represents the number of address limited sales information; x1 represents the number of the integer field in the sales address information field of the multi-valued field; x21, X22 denote bit sequence numbers in the integer field;
acquiring information of the X21 bit to the X22 bit of the X1 th integer field in the sales address information field of the multi-value field to obtain the sales information of the address to be inquired;
wherein the sales information is stored in a multi-valued field by the method of any one of claims 3, 4, 6, and 7, and each valid sales address in the sales address information field of the multi-valued field is arranged in ascending order of address number.
16. A method for inquiring sales information is characterized by comprising the following steps:
acquiring an address number of an address to be inquired from an address dictionary;
determining the position of the address number of the address to be inquired in the sales address information field of the multi-value field by adopting a binary search method:
acquiring the sales information of the address to be inquired according to the position of the address number of the address to be inquired in the sales address information field of the multi-valued field;
wherein the sales information is stored in a multi-valued field using the method of any of claims 5, 6, and 7, and each valid sales address in the sales address information field of the multi-valued field is arranged in ascending order of address number.
17. A sales information storage electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
18. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810971777.0A CN110858367A (en) | 2018-08-24 | 2018-08-24 | Sales information storage method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810971777.0A CN110858367A (en) | 2018-08-24 | 2018-08-24 | Sales information storage method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110858367A true CN110858367A (en) | 2020-03-03 |
Family
ID=69636360
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810971777.0A Pending CN110858367A (en) | 2018-08-24 | 2018-08-24 | Sales information storage method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110858367A (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1495647A (en) * | 2002-09-19 | 2004-05-12 | 索尼英国有限公司 | Information storage and research |
CN101980273A (en) * | 2010-11-04 | 2011-02-23 | 银川市高新电子应用技术研究所 | Radio frequency identification technology-based commodity sales management system and method |
CN102947809A (en) * | 2010-06-11 | 2013-02-27 | 奥林巴斯映像株式会社 | Information storage apparatus and information service system |
CN103177739A (en) * | 2011-11-17 | 2013-06-26 | 索尼公司 | Information processing apparatus, information processing system, information storing device, and program |
CN104715391A (en) * | 2013-12-11 | 2015-06-17 | 东芝泰格有限公司 | Merchandise sales data processing apparatus |
US20150186976A1 (en) * | 2013-12-27 | 2015-07-02 | DeNA Co., Ltd. | Set sales processing system |
CN107315771A (en) * | 2017-05-23 | 2017-11-03 | 中国科学院计算机网络信息中心 | A kind of data collection system customization method based on expanding library table data dictionary |
CN107463557A (en) * | 2016-06-05 | 2017-12-12 | 贵州双龙数联科技有限公司 | A kind of business location information storage system |
CN108280586A (en) * | 2018-02-02 | 2018-07-13 | 万盈摩比科技(深圳)有限公司 | It is a kind of bid, submit a tender and assessment of bids online trading system fragmentation of data processing method |
-
2018
- 2018-08-24 CN CN201810971777.0A patent/CN110858367A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1495647A (en) * | 2002-09-19 | 2004-05-12 | 索尼英国有限公司 | Information storage and research |
CN102947809A (en) * | 2010-06-11 | 2013-02-27 | 奥林巴斯映像株式会社 | Information storage apparatus and information service system |
CN101980273A (en) * | 2010-11-04 | 2011-02-23 | 银川市高新电子应用技术研究所 | Radio frequency identification technology-based commodity sales management system and method |
CN103177739A (en) * | 2011-11-17 | 2013-06-26 | 索尼公司 | Information processing apparatus, information processing system, information storing device, and program |
CN104715391A (en) * | 2013-12-11 | 2015-06-17 | 东芝泰格有限公司 | Merchandise sales data processing apparatus |
US20150186976A1 (en) * | 2013-12-27 | 2015-07-02 | DeNA Co., Ltd. | Set sales processing system |
CN107463557A (en) * | 2016-06-05 | 2017-12-12 | 贵州双龙数联科技有限公司 | A kind of business location information storage system |
CN107315771A (en) * | 2017-05-23 | 2017-11-03 | 中国科学院计算机网络信息中心 | A kind of data collection system customization method based on expanding library table data dictionary |
CN108280586A (en) * | 2018-02-02 | 2018-07-13 | 万盈摩比科技(深圳)有限公司 | It is a kind of bid, submit a tender and assessment of bids online trading system fragmentation of data processing method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110019367B (en) | Method and device for counting data characteristics | |
CN109614402A (en) | Multidimensional data query method and device | |
CN110689268B (en) | Method and device for extracting indexes | |
CN109508361B (en) | Method and apparatus for outputting information | |
CN110737747A (en) | data operation method, device and system | |
CN112884405A (en) | Inquiry system and scheduling method thereof | |
CN112181386B (en) | Code construction method, device and terminal based on software continuous integration | |
CN110895591A (en) | Method and device for positioning self-picking point | |
CN109726295A (en) | Brand knowledge map display methods, device, figure server and storage medium | |
CN112258244A (en) | Method, device, equipment and storage medium for determining task of target object | |
CN111401684A (en) | Task processing method and device | |
CN112784159B (en) | Content recommendation method and device, terminal equipment and computer readable storage medium | |
CN113760521B (en) | Virtual resource allocation method and device | |
CN110688295A (en) | Data testing method and device | |
CN112579673A (en) | Multi-source data processing method and device | |
CN106651408B (en) | Data analysis method and device | |
CN111641690A (en) | Session message processing method and device and electronic equipment | |
CN110930101A (en) | Method, device, electronic equipment and readable medium for determining delivery time of order | |
CN113157695B (en) | Data processing method and device, readable medium and electronic equipment | |
CN112035581B (en) | Model-based task processing method, device, equipment and medium | |
CN115099865A (en) | Data processing method and device | |
CN110858367A (en) | Sales information storage method and device | |
CN111309932B (en) | Comment data query method, comment data query device, comment data query equipment and storage medium | |
CN110555070B (en) | Method and apparatus for outputting information | |
CN113326680A (en) | Method and device for generating table |
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 |