CN112948674A - Redis-based intelligent push service method and device and computer equipment - Google Patents

Redis-based intelligent push service method and device and computer equipment Download PDF

Info

Publication number
CN112948674A
CN112948674A CN202110220345.8A CN202110220345A CN112948674A CN 112948674 A CN112948674 A CN 112948674A CN 202110220345 A CN202110220345 A CN 202110220345A CN 112948674 A CN112948674 A CN 112948674A
Authority
CN
China
Prior art keywords
geohash
user
longitude
latitude coordinates
redis
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110220345.8A
Other languages
Chinese (zh)
Inventor
梁昭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202110220345.8A priority Critical patent/CN112948674A/en
Publication of CN112948674A publication Critical patent/CN112948674A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9537Spatial or temporal dependent retrieval, e.g. spatiotemporal queries

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Telephone Function (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention discloses a method, a device and computer equipment for intelligent pushing service based on Redis, wherein the method comprises the following steps: receiving a query request of a user for a current area and acquiring a query radius; geohash coding is carried out on the longitude and latitude coordinates of the current position of the user to obtain a Geohash value of the longitude and latitude coordinates, the grade of a Geohash grid of the current area is calculated through the query radius, and the Geohash grid of the current area is obtained from a position set of Redis Geo; acquiring a target user matched with the user from a Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates; and pushing the service information matched with the query request to the user according to the target user. The method and the device are based on the intelligent recommendation technology, and the target user matched with the user is obtained to carry out intelligent pushing service on the user, so that the accuracy of the pushing service is improved.

Description

Redis-based intelligent push service method and device and computer equipment
Technical Field
The invention relates to the technical field of data analysis, in particular to a method and a device for intelligent push service based on Redis and computer equipment.
Background
The push service is a new service based on the development of the push technology, and the personalized active information service is realized by using the push technology, namely the push service is a reappearance of the traditional topic-determination service in a network environment, so that the way of acquiring information by human beings is changed. In the push service in the prior art, when a user has a certain requirement and needs to query, a service provider often adopts a wild bombing mode to push the user, and the push accuracy is not high, so that the effect of the push service is reduced, and the expected purpose cannot be achieved.
Disclosure of Invention
The embodiment of the invention provides a method and a device for intelligent push service based on Redis and computer equipment, aiming at solving the problem of low accuracy of push service in the related technology.
In a first aspect, an embodiment of the present invention provides a method for intelligent push service based on Redis, where the method includes:
if a query request of a user for a current area is received, acquiring a query radius of the user for the current area according to the query request;
performing Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates;
calculating the grade of the Geohash grid of the current area according to the query radius;
acquiring the Geohash grid of the current region from a position set of Redis Geo according to the grade of the Geohash grid of the current region;
acquiring a target user matched with the user from the Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates;
and pushing service information matched with the query request to the user according to the target user.
In a second aspect, an embodiment of the present invention provides an apparatus for intelligent push service based on Redis, including:
the device comprises a receiving unit, a searching unit and a judging unit, wherein the receiving unit is used for acquiring the searching radius of a user to a current area according to a searching request if the searching request of the user to the current area is received;
the first coding unit is used for carrying out Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates;
a calculating unit, configured to calculate a rank of the Geohash grid of the current region according to the query radius;
a first obtaining unit, configured to obtain the Geohash grid of the current region from a location set of Redis Geo according to a level of the Geohash grid of the current region;
a second obtaining unit, configured to obtain, according to the Geohash value of the latitude and longitude coordinate, a target user matched with the user from the Geohash grid of the current area;
and the pushing unit is used for pushing the service information matched with the query request to the user according to the target user.
In a third aspect, an embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor, when executing the computer program, implements the method for intelligent Redis-based push service according to the first aspect.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, causes the processor to execute the method for intelligent Redis-based push service according to the first aspect.
The embodiment of the invention provides a method, a device and computer equipment for intelligent push service based on Redis, which are used for receiving a query request of a user for a current area and acquiring a query radius; geohash coding is carried out on the longitude and latitude coordinates of the current position of the user to obtain a Geohash value of the longitude and latitude coordinates, the grade of a Geohash grid of the current area is calculated through the query radius, and the Geohash grid of the current area is obtained from a position set of Redis Geo; acquiring a target user matched with the user from a Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates; and pushing the service information matched with the query request to the user according to the target user. By the method, the target user matched with the user can be obtained, and the target user can be used for carrying out intelligent pushing service on the user, so that the accuracy of the pushing service is improved, and the service quality is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for intelligent push service based on Redis according to an embodiment of the present invention;
fig. 2 is a schematic view of an application scenario of a method for intelligent push service based on Redis according to an embodiment of the present invention;
fig. 3 is a sub-flow diagram of a method for intelligent push service based on Redis according to an embodiment of the present invention;
fig. 4 is another sub-flow diagram of a method for intelligent Redis-based push service according to an embodiment of the present invention;
fig. 5 is another sub-flow diagram of a method for intelligent Redis-based push service according to an embodiment of the present invention;
fig. 6 is another sub-flow diagram of a method for intelligent Redis-based push service according to an embodiment of the present invention;
fig. 7 is another sub-flow diagram of a method for intelligent Redis-based push service according to an embodiment of the present invention;
fig. 8 is another sub-flow diagram of a method for intelligent Redis-based push service according to an embodiment of the present invention;
FIG. 9 is a schematic block diagram of an apparatus for Redis-based Smart push services provided by an embodiment of the present invention;
FIG. 10 is a schematic block diagram of sub-units of a Redis-based intelligent push service apparatus according to an embodiment of the present invention;
FIG. 11 is a schematic block diagram of sub-units of a Redis-based intelligent push service apparatus according to an embodiment of the present invention
FIG. 12 is a schematic block diagram of sub-units of a Redis-based intelligent push service apparatus according to an embodiment of the present invention;
FIG. 13 is a schematic block diagram of sub-units of a Redis-based intelligent push service apparatus according to an embodiment of the present invention;
FIG. 14 is a schematic block diagram of sub-units of a Redis-based intelligent push service apparatus according to an embodiment of the present invention;
FIG. 15 is a schematic block diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1, fig. 1 is a schematic flowchart of a method for intelligent push service based on Redis according to an embodiment of the present invention; fig. 2 is a schematic view of an application scenario of a method for intelligent push service based on Redis according to an embodiment of the present invention. The method for intelligent push service based on Redis is applied to a server 10, in the method, after the server 10 receives a relevant instruction sent by a user terminal 20 to the server 10, the server 10 analyzes the instruction to obtain a target user matched with the user, and performs push service according to the target user, wherein the user terminal 20 is a mobile terminal with a positioning function, and the server 10 is a device with data transmission and reception functions with the user terminal 20.
As shown in fig. 1, the method includes steps S110 to S160.
S110, if a query request of a user for the current area is received, acquiring the query radius of the user for the current area according to the query request.
Specifically, the query request is that the user sends instruction information for querying a target user matched with the user in the current area to the server 10 in the user terminal 20, and after the user inputs data information of a query radius in the user terminal 20, the terminal can send instruction information for querying the target user matched with the user in the current area to the server according to the data information of the query radius, so that the query radius input by the user in the current area can be obtained through the query request.
And S120, performing Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates.
Specifically, the encoding rule is rule information for the server to perform Geohash encoding according to the longitude and latitude coordinates of the current position of the user, wherein the Geohash encoding is an address encoding method, two-dimensional space longitude and latitude data can be encoded into a character string through the Geohash encoding, that is, the Geohash value of the longitude and latitude coordinates is represented through the character string.
In other inventive embodiments, as shown in fig. 3, step S120 includes sub-steps S121 and S122.
And S121, carrying out binary coding on the longitude and latitude coordinates according to a preset threshold value to obtain a character string of a binary sequence of the longitude and latitude coordinates.
Specifically, the threshold is a standard value set by subtracting the longitude in the latitude and longitude coordinate from the maximum longitude and the minimum longitude in the current longitude interval respectively after binary coding is performed for multiple times according to the latitude and longitude coordinate, or subtracting the latitude in the latitude and longitude coordinate from the maximum latitude and the minimum latitude in the current longitude interval respectively. In this embodiment, when any one of the first ratio or the second ratio does not exceed the threshold, binary coding is continuously performed on the longitude and latitude coordinates until any one of the first ratio or the second ratio exceeds the threshold, coding of the longitude and latitude coordinates is stopped, and then a character string after the longitude binary coding and a character string after the latitude binary coding in the longitude and latitude coordinates are combined to obtain a character string of a binary sequence of the longitude and latitude coordinates, wherein even digits of the character string of the binary sequence of the longitude and latitude coordinates include characters after the longitude binary coding, and odd digits include characters after the latitude binary coding.
And S122, coding the character string of the binary sequence of the longitude and latitude coordinates according to a Base32 coding table to obtain the Geohash value of the longitude and latitude coordinates.
Specifically, Base32 codes are used for coding binary data into visible character strings, and the coding rule is as follows: any given binary data is segmented into a group of 5 bits (bit), and each segmented group is encoded to obtain 1 visible character. In this embodiment, the character string of the binary sequence of the longitude and latitude coordinates is encoded through the Base32 encoding table, so that the Geohash value of the longitude and latitude coordinates can be obtained.
In other embodiments of the present invention, as shown in fig. 4, before the step S120, steps S120a and S120b are further included.
S120a, acquiring the network positioning and the GPS positioning of the user according to the inquiry request.
Specifically, the network positioning is used to acquire longitude and latitude coordinates of the current location of the user through transmission of network data, and the GPS positioning is used to acquire GPS data from the user terminal 20 of the user and send the GPS data to the server 10, so that the server 10 acquires the longitude and latitude coordinates of the current location of the user. In addition, the network location may be a location obtained by connecting the user terminal 20 of the user with the server 10 through WIFI, or a location obtained by connecting the user terminal 20 of the user with the server 10 through a base station through data transmission. When the user terminal 20 is connected with the server 10 through WIFI, the server 10 obtains longitude and latitude coordinates of the WIFI from a database according to the WIFI of the user terminal 20 of the user; when the user terminal is connected to the server 10 through the base station, the server 10 obtains the longitude and latitude coordinates of the base station from the database according to the base station of the user terminal 20 of the user, so as to indirectly obtain the longitude and latitude coordinates of the current position of the user, wherein the database is stored in the server 10 and is used for storing the WIFI and the position of the base station.
S120b, determining the longitude and latitude coordinates of the current position of the user according to the network positioning and the GPS positioning.
Specifically, the server judges for the first time according to the data information in the network positioning and the GPS positioning to obtain whether the network positioning is the same as the GPS positioning, if the first network positioning of the user terminal 20 of the user is the same as the first GPS positioning, the latitude and longitude coordinates of the current position of the user can be determined according to the network positioning or the GPS positioning, if the network positioning is different from the GPS positioning, the latitude and longitude coordinates of the current position of the user are determined according to the GPS positioning, and although the network positioning is fast after being connected to the internet, the external environment has strong interference to the network positioning, and at this time, the latitude and longitude coordinates of the current position of the user cannot be determined accurately through the network positioning.
In other inventive embodiments, as shown in fig. 5, step S120b includes sub-steps S120b1 and S120b 2.
And S120b1, judging whether the network positioning is consistent with the GPS positioning.
Specifically, the server 10 obtains the data information of the network positioning and the data information of the GPS positioning according to the query request sent from the user terminal 20 to the server 10, the server 10 analyzes the data information of the network positioning and the data information of the GPS positioning respectively to obtain the longitude and latitude coordinates corresponding to the network positioning and the longitude and latitude coordinates corresponding to the GPS positioning, wherein whether the network location and the GPS location are consistent is determined according to the error between the latitude and the longitude in the coordinates of the two, when the error between the longitude and latitude of the two coordinates does not exceed (0.05 ), the network location and the GPS location are determined to be consistent, when the error between the latitude and longitude in both coordinates exceeds (0.05 ), then the network location and the GPS location may be determined to be inconsistent.
S120b2, if the network positioning is not consistent with the GPS positioning, determining the longitude and latitude coordinates of the current position of the user according to the GPS positioning.
Specifically, the network positioning is fast relative to the GPS positioning, the user can perform the instant positioning at the user terminal 20 only by networking, the GPS positioning is slow in response, the time spent by the user at the user terminal 20 in the GPS positioning is longer than the time spent in the network positioning, and when the user at the user terminal 20 is a mobile communication device, the GPS positioning needs to consume a large amount of electric power of the mobile communication device, so that the longitude and latitude coordinates of the current position of the user are determined according to the network positioning.
And S130, calculating the grade of the Geohash grid of the current area according to the query radius.
Specifically, the query radius is radius information input by the user in the terminal based on the current position of the user, the level of the Geohash grid in the current region is the Geohash grid according with the lowest level of the current region, and the amount of later-stage search can be reduced through the Geohash grid. In this embodiment, the level of the Geohash grid of the current area is calculated by using the area with the current position of the user as the center of the circle. The Geohash grids are rectangular grids, and the Geohash grids of each level are composed of 4 Geohash grids which are higher than the Geohash grids by one level. The Geohash code of each Geohash grid is determined by the level of the Geohash grid, and in this embodiment, no Geohash grid with a higher level than the Geohash grid with the highest level is included in the Geohash grids with the highest level.
In other inventive embodiments, as shown in fig. 6, step S130 includes sub-steps S131 and S132.
S131, acquiring the first character string coded by Base32 from a preset dictionary table according to the query radius.
Specifically, the dictionary table is a character string which is prepared in advance and used for determining the query radius, and the character string is a character string encoded by Base 32. The number of the first character strings is equal to the number of character strings of the Geohash value of the Geohash grid of the current area. For example, the dictionary table may be represented in the specification as: when the query radius is 500 meters, querying the character string in the 400-600 meters range in the dictionary table as wx4g, and then taking the character string as the first character string, and then calculating the number of the character strings, so as to determine the level of the Geohash grid of the current region.
S132, determining the grade of the Geohash grid of the current area according to the number of the first character strings.
Specifically, the number of times of binary coding performed on the Geohash grid of the current region in the Geohash coding process can be determined according to the number of the first character strings, and the accuracy of the Geohash grid of the current region can be obtained according to the number of times of binary coding, so as to obtain the grade of the Geohash grid of the current region.
S140, acquiring the Geohash grid of the current area from the position set of the Redis Geo according to the grade of the Geohash grid of the current area.
Specifically, the location set of the Redis Geo is configured to store a set of all Geo-hash grids obtained by Geo-hash encoding of a location of a pre-region, where the set includes Geo-hash grids of all levels, and the Geo-hash grid of the current region can be obtained from the location set of the Redis Geo by the level of the Geo-hash grid of the current region. The Redis GEO is mainly used for storing the geographical position information and operating the stored information, and the function is newly added in the Redis 3.2 version. The Redis GEO operation instruction is as follows: geoadd is expressed as coordinates to add a geographic location; geopos represents coordinates for acquiring a geographic location; geodesist is expressed as calculating the distance between two locations; georadius represents that a geographical position set in a specified range is obtained according to longitude and latitude coordinates given by a user; georadiusbymmember represents that a geographical position set in a specified range is obtained according to a certain place stored in the position set; the Geohash is expressed as a Geohash value that returns one or more location objects.
In other inventive embodiments, as shown in fig. 7, step S140 includes sub-steps S141, S142, and S143.
S141, acquiring a plurality of GeoHash grids with the same level as the GeoHash grid of the current area from the position set of the Redis Geo according to the level of the GeoHash grid of the current area.
Specifically, when a preset area is coded, wherein the preset area contains the current area of the user, the area represented by the Geohash grid obtained by the Geohash coding is smaller and the level is higher as the number of times of binary coding is increased, and after the preset area is subjected to the Geohash coding, the Geohash grid of an inverted pyramid structure is formed, the accuracy grid of the top-level Geohash grid is the lowest, the level of the Geohash grid is also the lowest, and the accuracy and the level of the Geohash grid of the inverted pyramid structure are gradually and correspondingly increased from top to bottom, so that a plurality of Geohash grids with the same level as the Geohash grid of the current area are obtained from a position set of Redis Geo through the level of the Geohash grid of the current area.
And S142, acquiring second character strings with the number equal to that of the first character strings from the Geohash values of the longitude and latitude coordinates.
Specifically, the string of the Geohash value of the longitude and latitude coordinate represents the accurate location information of the user, so that the number of the string of the Geohash value of the longitude and latitude coordinate is certainly greater than the number of the first string, but since the number of the first string can determine the level of the Geohash grid of the current area, and the string of the Geohash value of the Geohash grid of the current area is positioned at the forefront of the string of the Geohash value of the longitude and latitude coordinate, and the number of the first string is equal to the number of the string of the Geohash value of the Geohash grid of the current area, the Geohash grid of the current area can be obtained from a plurality of Geohash grids which are the same as the level of the Geohash grid of the current area through the second string. The second character string is identification information of the Geohash grids of the current area, and the Geohash grids of the current area can be obtained from a plurality of Geohash grids with the same level as the Geohash grids of the current area through the second character string. In this embodiment, the current location of the user in the Geohash grid of the current region is a positive center of the Geohash grid of the current region.
S143, obtaining the Geohash grids of the current area from the Geohash grids with the same level as the Geohash grids of the current area according to the second character string.
S150, acquiring a target user matched with the user from the Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates.
Specifically, after the current area is determined, a plurality of target users having the same user attribute may be obtained from the Geohash grid of the current area according to the attribute information of the user, that is, a plurality of target users exist in the Geohash grid of the current area, but the distance between each target user and the user is different, so that the target user closest to the user needs to be screened out from the target users, and the target user closest to the user performs an intelligent push service on the user, so that the precision and the success rate of push are improved, and the quality of the push service is improved.
In other inventive embodiments, as shown in FIG. 8, step S150 includes sub-steps S151 and S152.
And S151, processing the Geohash grid of the current area according to the number of the character strings of the Geohash values of the longitude and latitude coordinates to obtain the Geohash grid according with the longitude and latitude coordinates.
Specifically, after the Geohash grid of the current area is obtained, because the Geohash grid of the current area is a Geohash grid of an inverted pyramid structure, and the accuracy of the bottom layer of the Geohash grid of the current area far exceeds the accuracy of the longitude and latitude coordinates, the partial Geohash grid which does not conform to the accuracy of the longitude and latitude coordinates is removed by the number of character strings of the Geohash value of the longitude and latitude coordinates, and then the Geohash grid conforming to the longitude and latitude coordinates is obtained.
S152, acquiring the target user from the Geohash grid according with the longitude and latitude coordinates according to a recursive algorithm.
Specifically, the recursive algorithm searches from four high-level Geohash grids of a topmost Geohash grid of the Geohash grids conforming to the longitude and latitude coordinates, and if a target user matched with the user does not exist in the four high-level Geohash grids, that is, a position code of the target user does not exist in the current Geohash grid, searches from four lower-level Geohash grids corresponding to the four high-level Geohash grids, and sequentially searches from top to bottom until a target user closest to the user is found.
And S160, pushing service information matched with the query request to the user according to the target user.
Specifically, after a target user matched with the user is determined, information associated with the user in the target user is pushed to the user through a user terminal. For example, the user wants to purchase a financial product, the target user queried through the query request also purchases the financial product and obtains a profit when purchasing the financial product, and the server can push the profit information obtained by the target user to the user after determining the target user, that is, the profit information is service information matched with the query request.
In the method for intelligent push service based on Redis provided by the embodiment of the invention, if a query request of a user for a current area is received, a query radius of the user for the current area is obtained according to the query request; performing Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates; calculating the grade of the Geohash grid of the current area according to the query radius; acquiring the Geohash grid of the current region from a position set of Redis Geo according to the grade of the Geohash grid of the current region; acquiring a target user matched with the user from the Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates; and pushing service information matched with the query request to the user according to the target user. By the method, the target user matched with the user can be obtained, and the target user can be used for carrying out intelligent pushing service on the user, so that the accuracy of the pushing service is improved, and the service quality is improved.
An embodiment of the present invention further provides a device 100 for a intelligent push service based on Redis, where the device is configured to execute any embodiment of the foregoing method for an intelligent push service based on Redis. Specifically, referring to fig. 9, fig. 9 is a schematic block diagram of an apparatus 100 for a Redis-based smart push service according to an embodiment of the present invention.
As shown in fig. 9, the apparatus 100 for the intelligent push service based on the Redis includes a receiving unit 110, a first encoding unit 120, a calculating unit 130, a first obtaining unit 140, a second obtaining unit 150, and a pushing unit 160.
The receiving unit 110 is configured to, if a query request of a user for a current area is received, obtain a query radius of the user for the current area according to the query request.
The first encoding unit 120 is configured to perform Geohash encoding on the longitude and latitude coordinates of the current location of the user according to a preset encoding rule, so as to obtain a Geohash value of the longitude and latitude coordinates.
In another embodiment of the present invention, as shown in fig. 10, the first encoding unit 120 includes: a second encoding unit 121 and a third encoding unit 122.
The second encoding unit 121 is configured to perform binary encoding on the longitude and latitude coordinates according to a preset threshold to obtain a character string of a binary sequence of the longitude and latitude coordinates; and the third encoding unit 122 is configured to encode the character string of the binary sequence of the longitude and latitude coordinates according to a Base32 encoding table to obtain a Geohash value of the longitude and latitude coordinates.
In another embodiment of the present invention, as shown in fig. 9, the apparatus 100 for intelligent push service based on Redis further includes: a third acquisition unit 120a and a first determination unit 120 b.
A third obtaining unit 120a, configured to obtain the network location and the GPS location of the user according to the query request; the first determining unit 120b is configured to determine latitude and longitude coordinates of the current location of the user according to the network location and the GPS location.
In another embodiment of the present invention, as shown in fig. 11, the first determining unit 120b includes: a judgment unit 120b1 and a second determination unit 120b 2.
A judging unit 120b1, configured to judge whether the network positioning and the GPS positioning are consistent; a second determining unit 120b2, configured to determine, according to the GPS positioning, longitude and latitude coordinates of the current location of the user if the network positioning is inconsistent with the GPS positioning.
A calculating unit 130, configured to calculate a rank of the Geohash grid of the current region according to the query radius.
In another embodiment of the present invention, as shown in fig. 12, the calculating unit 130 includes: a fourth acquisition unit 131 and a third determination unit 132.
The fourth obtaining unit 131 is configured to obtain the first character string encoded by Base32 from a preset dictionary table according to the query radius; a third determining unit 132, configured to determine, according to the number of the first character strings, a level of the Geohash grid of the current region.
A first obtaining unit 140, configured to obtain the Geohash grid of the current region from a location set of Redis Geo according to the level of the Geohash grid of the current region.
In another embodiment of the present invention, as shown in fig. 13, the first obtaining unit 140 includes: a fifth acquiring unit 141, a sixth acquiring unit 142, and a seventh acquiring unit 143.
A fifth obtaining unit 141, configured to obtain, according to the level of the Geohash grid of the current region, a plurality of Geohash grids that are the same as the level of the Geohash grid of the current region from the location set of Redis Geo; a sixth obtaining unit 142, configured to obtain, from the Geohash value of the longitude and latitude coordinates, second character strings that are equal in number to the first character strings; a seventh obtaining unit 143, configured to obtain the Geohash grid of the current region from the multiple Geohash grids with the same level as the Geohash grid of the current region according to the second character string.
And a second obtaining unit 150, configured to obtain, according to the Geohash value of the latitude and longitude coordinate, a target user matched with the user from the Geohash grid of the current area.
In another embodiment of the present invention, as shown in fig. 14, the second obtaining unit 150 includes: a processing unit 151 and an eighth acquiring unit 152.
The processing unit 151 is configured to process the Geohash grid of the current area according to the number of the character strings of the Geohash value of the longitude and latitude coordinates, so as to obtain the Geohash grid conforming to the longitude and latitude coordinates; an eighth obtaining unit 152, configured to obtain the target user from the Geohash grid conforming to the longitude and latitude coordinates according to a recursive algorithm.
A pushing unit 160, configured to push service information matched with the query request to the user according to the target user.
The device 100 for intelligent push service based on Redis according to the embodiment of the present invention is configured to execute the above-mentioned method for obtaining, if a query request of a user for a current area is received, a query radius of the user for the current area according to the query request; performing Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates; calculating the grade of the Geohash grid of the current area according to the query radius; acquiring the Geohash grid of the current region from a position set of Redis Geo according to the grade of the Geohash grid of the current region; acquiring a target user matched with the user from the Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates; and pushing service information matched with the query request to the user according to the target user.
It should be noted that, as can be clearly understood by those skilled in the art, for the specific implementation process of the apparatus 100 for intelligent push service based on Redis and each unit, reference may be made to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, no further description is provided herein.
The apparatus of the foregoing Redis-based smart push service may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 15.
Referring to fig. 15, fig. 15 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Referring to fig. 15, the device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, may cause the processor 502 to perform a method of Redis-based Smart push service.
The processor 502 is used to provide computing and control capabilities that support the operation of the overall device 500.
The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to execute a method for intelligent push services based on Redis.
The network interface 505 is used for network communication, such as providing transmission of data information. Those skilled in the art will appreciate that the configuration shown in fig. 15 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the apparatus 500 to which aspects of the present invention may be applied, and that a particular apparatus 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 502 is configured to run the computer program 5032 stored in the memory to implement the following functions: if a query request of a user for a current area is received, acquiring a query radius of the user for the current area according to the query request; performing Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates; calculating the grade of the Geohash grid of the current area according to the query radius; acquiring the Geohash grid of the current region from a position set of Redis Geo according to the grade of the Geohash grid of the current region; acquiring a target user matched with the user from the Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates; and pushing service information matched with the query request to the user according to the target user.
Those skilled in the art will appreciate that the embodiment of the apparatus 500 shown in fig. 15 does not constitute a limitation on the specific construction of the apparatus 500, and in other embodiments, the apparatus 500 may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the apparatus 500 may only include the memory and the processor 502, and in such embodiments, the structure and function of the memory and the processor 502 are the same as those of the embodiment shown in fig. 15, and are not repeated herein.
It should be understood that in the present embodiment, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general-purpose processors 502, a Digital Signal Processor 502 (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general-purpose processor 502 may be a microprocessor 502 or the processor 502 may be any conventional processor 502 or the like.
In another embodiment of the present invention, a computer storage medium is provided. The storage medium may be a non-volatile computer-readable storage medium. The storage medium stores a computer program 5032, wherein the computer program 5032 when executed by the processor 502 performs the steps of: if a query request of a user for a current area is received, acquiring a query radius of the user for the current area according to the query request; performing Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates; calculating the grade of the Geohash grid of the current area according to the query radius; acquiring the Geohash grid of the current region from a position set of Redis Geo according to the grade of the Geohash grid of the current region; acquiring a target user matched with the user from the Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates; and pushing service information matched with the query request to the user according to the target user.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided by the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only a logical division, and there may be other divisions when the actual implementation is performed, or units having the same function may be grouped into one unit, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a device 500 (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method for intelligent pushing service based on Redis is characterized by comprising the following steps:
if a query request of a user for a current area is received, acquiring a query radius of the user for the current area according to the query request;
performing Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates;
calculating the grade of the Geohash grid of the current area according to the query radius;
acquiring the Geohash grid of the current region from a position set of Redis Geo according to the grade of the Geohash grid of the current region;
acquiring a target user matched with the user from the Geohash grid of the current area according to the Geohash value of the longitude and latitude coordinates;
and pushing service information matched with the query request to the user according to the target user.
2. The method of claim 1, wherein the Geohash encoding the longitude and latitude coordinates of the current location of the user according to a preset encoding rule to obtain a Geohash value of the longitude and latitude coordinates comprises:
binary coding is carried out on the longitude and latitude coordinates according to a preset threshold value, and a character string of a binary sequence of the longitude and latitude coordinates is obtained;
and coding the character string of the binary sequence of the longitude and latitude coordinates according to a Base32 coding table to obtain the Geohash value of the longitude and latitude coordinates.
3. The method for intelligent Redis-based push service according to claim 1, wherein before Geohash encoding the longitude and latitude coordinates of the current location of the user according to a preset encoding rule, the method further comprises:
acquiring the network positioning and GPS positioning of the user according to the query request;
and determining the longitude and latitude coordinates of the current position of the user according to the network positioning and the GPS positioning.
4. The Redis-based intelligent push service method according to claim 3, wherein the determining longitude and latitude coordinates of the user's current location from the network location and the GPS location comprises:
judging whether the network positioning is consistent with the GPS positioning;
and if the network positioning is inconsistent with the GPS positioning, determining the longitude and latitude coordinates of the current position of the user according to the GPS positioning.
5. The method for Redis-based Smart push service according to claim 1, wherein said calculating the level of the Geohash mesh of the current region according to the query radius comprises:
acquiring a first character string coded by Base32 from a preset dictionary table according to the query radius;
and determining the grade of the Geohash grid of the current area according to the number of the first character strings.
6. The Redis-based smart push service method according to claim 5, wherein the obtaining the Geohash mesh of the current region from the position set of Redis Geo according to the level of the Geohash mesh of the current region comprises:
acquiring a plurality of Geohash grids with the same grade as the Geohash grid of the current area from a position set of Redis Geo according to the grade of the Geohash grid of the current area;
acquiring second character strings with the number equal to that of the first character strings from the Geohash values of the longitude and latitude coordinates;
and acquiring the Geohash grids of the current area from the Geohash grids with the same grade as the Geohash grids of the current area according to the second character string.
7. The method of Redis-based smart push service according to claim 1, wherein the obtaining a target user matching the user from the Geohash grid of the current area according to the Geohash value of the latitude and longitude coordinates comprises:
processing the Geohash grid of the current area according to the number of the character strings of the Geohash values of the longitude and latitude coordinates to obtain the Geohash grid which accords with the longitude and latitude coordinates;
and acquiring the target user from the Geohash grid according with the longitude and latitude coordinates according to a recursive algorithm.
8. An apparatus for intelligent Redis-based push services, comprising:
the device comprises a receiving unit, a searching unit and a judging unit, wherein the receiving unit is used for acquiring the searching radius of a user to a current area according to a searching request if the searching request of the user to the current area is received;
the first coding unit is used for carrying out Geohash coding on the longitude and latitude coordinates of the current position of the user according to a preset coding rule to obtain a Geohash value of the longitude and latitude coordinates;
a calculating unit, configured to calculate a rank of the Geohash grid of the current region according to the query radius;
a first obtaining unit, configured to obtain the Geohash grid of the current region from a location set of Redis Geo according to a level of the Geohash grid of the current region;
a second obtaining unit, configured to obtain, according to the Geohash value of the latitude and longitude coordinate, a target user matched with the user from the Geohash grid of the current area;
and the pushing unit is used for pushing the service information matched with the query request to the user according to the target user.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements a method of Redis-based smart push service according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to perform the method of Redis-based smart push service according to any of claims 1 to 7.
CN202110220345.8A 2021-02-26 2021-02-26 Redis-based intelligent push service method and device and computer equipment Pending CN112948674A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110220345.8A CN112948674A (en) 2021-02-26 2021-02-26 Redis-based intelligent push service method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110220345.8A CN112948674A (en) 2021-02-26 2021-02-26 Redis-based intelligent push service method and device and computer equipment

Publications (1)

Publication Number Publication Date
CN112948674A true CN112948674A (en) 2021-06-11

Family

ID=76246615

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110220345.8A Pending CN112948674A (en) 2021-02-26 2021-02-26 Redis-based intelligent push service method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN112948674A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113487163A (en) * 2021-06-30 2021-10-08 支付宝(杭州)信息技术有限公司 Method and device for service prediction based on geographical location information
CN114500872A (en) * 2021-12-30 2022-05-13 浙江大华技术股份有限公司 Matching method of camera and road information, computer device and storage medium
CN114880421A (en) * 2022-07-08 2022-08-09 北谷电子有限公司 Location service method, system, electronic device and storage medium
CN115250290A (en) * 2022-07-19 2022-10-28 百融至信(北京)征信有限公司 Service information pushing method, device and system
CN114500872B (en) * 2021-12-30 2024-06-07 浙江大华技术股份有限公司 Method for matching camera with road information, computer device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106708833A (en) * 2015-08-03 2017-05-24 腾讯科技(深圳)有限公司 Position information-based data obtaining method and apparatus
CN109657152A (en) * 2018-12-27 2019-04-19 北京顺丰同城科技有限公司 PUSH message sending method, device, electronic equipment and readable storage medium storing program for executing
CN110399440A (en) * 2019-06-28 2019-11-01 苏州浪潮智能科技有限公司 A kind of longitude and latitude gridding coding method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106708833A (en) * 2015-08-03 2017-05-24 腾讯科技(深圳)有限公司 Position information-based data obtaining method and apparatus
CN109657152A (en) * 2018-12-27 2019-04-19 北京顺丰同城科技有限公司 PUSH message sending method, device, electronic equipment and readable storage medium storing program for executing
CN110399440A (en) * 2019-06-28 2019-11-01 苏州浪潮智能科技有限公司 A kind of longitude and latitude gridding coding method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
WINNER192: ""Redis 实现美团的外卖派单系统"附近的人"筛选实战原理分析"", pages 1 - 12, Retrieved from the Internet <URL:https://www.cnblogs.com/winner192/p/11782308.html> *
WINNER192: "Redis 实现美团的外卖派单系统"附近的人"筛选实战原理分析", pages 1 - 12, Retrieved from the Internet <URL:https://www.cnblogs.com/winner192/p/11782308.html> *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113487163A (en) * 2021-06-30 2021-10-08 支付宝(杭州)信息技术有限公司 Method and device for service prediction based on geographical location information
CN114500872A (en) * 2021-12-30 2022-05-13 浙江大华技术股份有限公司 Matching method of camera and road information, computer device and storage medium
CN114500872B (en) * 2021-12-30 2024-06-07 浙江大华技术股份有限公司 Method for matching camera with road information, computer device and storage medium
CN114880421A (en) * 2022-07-08 2022-08-09 北谷电子有限公司 Location service method, system, electronic device and storage medium
CN114880421B (en) * 2022-07-08 2022-10-18 北谷电子有限公司 Location service method, system, electronic device and storage medium
CN115250290A (en) * 2022-07-19 2022-10-28 百融至信(北京)征信有限公司 Service information pushing method, device and system

Similar Documents

Publication Publication Date Title
CN112948674A (en) Redis-based intelligent push service method and device and computer equipment
CN108011987B (en) IP address positioning method and device, electronic equipment and storage medium
CN108563660B (en) Service recommendation method, system and server
CN110334162B (en) Address recognition method and device
CN111026978A (en) Position query method and device, computer equipment and storage medium
JP2018510410A (en) Method and apparatus for processing address text
CN104281940A (en) Method and device for providing data processing mode list through communication network
CN107547598B (en) Positioning method, server and terminal
CN110928894B (en) Entity alignment method and device
CN108932310B (en) Space service providing method and device, server and storage device
CN107463585B (en) Fingerprint data storage processing method and device
CN104765793A (en) Software recommending method and server
CN112434188A (en) Data integration method and device for heterogeneous database and storage medium
CN113706592A (en) Method and device for correcting positioning information, electronic equipment and storage medium
CN111601380A (en) Position location method, device and equipment based on position fingerprint and storage medium
CN115544088A (en) Address information query method and device, electronic equipment and storage medium
CN116519003B (en) Path planning method and device, electronic equipment and storage medium
CN112631676A (en) Code dynamic loading method and device and computer readable storage medium
CN110972258B (en) Method and device for establishing position fingerprint database
WO2021068347A1 (en) Adaptive position query method and apparatus, and computer device and storage medium
CN106651408B (en) Data analysis method and device
CN113360586B (en) Address aggregation degree query method, device, equipment and computer readable storage medium
CN114125813B (en) Signal coverage range determining method based on mobile phone signaling and related device
CN113849531B (en) Query method and device
CN111125541B (en) Method for acquiring sustainable multi-cloud service combination for multiple users

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