Disclosure of Invention
The invention mainly aims to provide a software head portrait management method, a system, equipment and a computer storage medium, which aim to solve the technical problem of intelligently realizing consistency of all head portrait types in software.
In order to achieve the above object, the present invention provides a software head portrait management method, which is applied to a head portrait server, and includes the following steps:
acquiring associated head portraits of all users in associated software associated with a head portrait server based on a preset timing time interval;
Traversing each associated head portrait, determining a traversed user corresponding to the traversed associated head portrait, and determining whether the head portrait of the traversed user in the head portrait server is matched with the traversed associated head portrait;
and if the head images are not matched, adjusting the traversed associated head images in the associated software to be the same as the head images of the traversed users in the head image server.
Optionally, the step of determining whether the head portrait of the traversing user in the head portrait server matches with the traversed associated head portrait includes:
carrying out gray processing on the traversed associated head portrait to obtain a first gray image, and calculating a first sparse coefficient of the first gray image;
performing gray processing on the head portrait of the traversing user in the head portrait server to obtain a second gray image, and calculating a second sparse coefficient of the second gray image;
Calculating the similarity value of the first sparse coefficient and the second sparse coefficient, detecting whether the similarity value is smaller than a preset threshold value, and determining whether the head portrait of the traversing user in the head portrait server is matched with the traversed associated head portrait according to the detection result of detecting whether the similarity value is smaller than the preset threshold value.
Optionally, the step of calculating a first sparse coefficient of the first gray scale image includes:
Acquiring all preset template images, and performing overlapping block taking processing on each template image to acquire a preset number of image blocks;
And carrying out sparse coding on each image block according to the column vector of each image block, constructing a dictionary according to each sparse coding, and determining a first sparse coefficient of the first gray level image in the dictionary.
Optionally, the step of calculating a similarity value of the first sparse coefficient and the second sparse coefficient includes:
Calculating brightness values, contrast values and structure values of the first gray scale image and the second gray scale image based on the first sparse coefficient and the second sparse coefficient;
and determining similarity values of the first sparse coefficient and the second sparse coefficient according to the brightness value, the contrast value and the structure value.
Optionally, the software head portrait management method further includes:
Acquiring head portraits of all users in a head portraits server, and detecting whether updated head portraits are updated in each head portrait;
If the updated head portrait exists, determining an updated user corresponding to the updated head portrait, and updating the head portrait of the updated user in associated software associated with the head portrait server to be the updated head portrait.
Optionally, the step of detecting whether the updated head portrait exists in each head portrait, includes:
determining whether to send request data in the head portrait server to a cloud server corresponding to the head portrait server;
If yes, acquiring a head portrait file fed back by the cloud server based on the request data, determining a first head portrait of a user corresponding to the head portrait file in the head portrait server, and detecting whether the head portrait file is matched with the first head portrait;
And determining whether updated head images exist in each head image based on a matching result of detecting whether the head image file is matched with the first head image.
In addition, in order to achieve the above object, the present invention further provides a software head portrait management method, which is applied to a cloud server, and includes the following steps:
if the request data for acquiring the head portrait file sent by the head portrait server side is received, whether the signature in the request data is valid or not is detected;
and if the signature is valid, determining the head portrait file in the private barrel according to the unique identifier in the request data, and feeding back the head portrait file to the head portrait server.
Optionally, before the step of receiving the request data for obtaining the avatar file sent by the avatar server, the method includes:
storing the received head portrait file into a preset private barrel, determining a unique identifier of the private barrel with the head portrait file, generating request data based on the unique identifier, and feeding back the request data to a head portrait server.
Optionally, the step of storing the received header file in a preset private bucket includes:
determining a request instruction corresponding to the received head portrait file;
Mapping all request parameters in the request instruction to obtain a first mapping table, splicing all key value pairs in the first mapping table to obtain a first spliced key value pair, and/or
Mapping request heads corresponding to the request parameters to obtain a second mapping table, and splicing all key value pairs in the second mapping table to obtain a second spliced key value pair;
splicing the preset effective time period, the request path corresponding to the request instruction, the first splicing key value pair and/or the second splicing key value pair to obtain a signature character string, determining a signature corresponding to the signature character string, and storing the received head portrait file into a preset private barrel according to the signature.
In addition, in order to achieve the above purpose, the invention also provides a software head portrait management system, which comprises a head portrait server, a cloud server and associated software;
The cloud server is used for detecting whether a signature in the request data is valid or not if the request data for acquiring the head portrait file sent by the head portrait server is received, determining the head portrait file in the private barrel according to a unique identifier in the request data if the signature is valid, and feeding back the head portrait file to the head portrait server;
The head portrait server is used for determining an updated head portrait according to the received head portrait file, determining an updated user corresponding to the updated head portrait, and updating the head portrait of the updated user in associated software associated with the head portrait server into the updated head portrait;
The head portrait server is used for acquiring associated head portraits of all users in associated software associated with the head portrait server based on a preset timing time interval, traversing each associated head portrait, determining traversed users corresponding to the traversed associated head portraits, determining whether the head portraits of the traversed users in the head portrait server are matched with the traversed associated head portraits, and if so, adjusting the traversed associated head portraits in the associated software to be identical with the head portraits of the traversed users in the head portrait server.
Optionally, the cloud server is further configured to store the received avatar file in a preset private bucket, determine a unique identifier of the private bucket with the avatar file, generate request data based on the unique identifier, and feed back the request data to the avatar server;
The head portrait server is also used for acquiring head portraits of all users in the head portrait server, determining whether to send request data in the head portrait server to a cloud server corresponding to the head portrait server according to each head portrait, and if so, sending the request data to the cloud server.
In addition, in order to achieve the aim, the invention also provides a software head portrait management device, which comprises a memory, a processor and a software head portrait management program which is stored in the memory and can run on the processor, wherein the software head portrait management program realizes the steps of the software head portrait management method when being executed by the processor.
In addition, in order to achieve the above object, the present invention also provides a computer storage medium having stored thereon a software head portrait management program which when executed by a processor implements the steps of the software head portrait management method as described above.
The head portrait processing method comprises the steps of obtaining associated head portraits of all users in associated software associated with a head portrait server side based on a preset timing time interval, traversing each associated head portrait, determining traversing users corresponding to the traversed associated head portraits, determining whether the head portraits of the traversing users in the head portrait server side are matched with the traversed associated head portraits, and if the head portraits of the traversing users in the head portrait server side are not matched with the traversed associated head portraits, adjusting the traversed associated head portraits in the associated software to be identical with the head portraits of the traversing users in the head portrait server side. According to the method, all the associated head images in the associated software are acquired according to the timing time interval, each associated head image is traversed, when the traversed associated head image of the user in the head image server is not matched with the traversed associated head image, the traversed associated head image in the associated software is adjusted to be identical with the head image of the traversed user in the head image server, and therefore inconsistent head images in the associated software and the head image server are effectively screened out, the phenomenon that the head images are multiple in variety and cannot be guaranteed in a self-adjusting or default distribution mode of the user in the prior art is avoided, and the consistency of the head image types in the software is intelligently improved.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
As shown in fig. 1, fig. 1 is a schematic structural diagram of a software head portrait management device of a hardware running environment according to an embodiment of the present invention.
The software head portrait management device of the embodiment of the invention can be a PC or a server device, and a Java virtual machine is operated on the software head portrait management device.
As shown in fig. 1, the software avatar management device may include a processor 1001, e.g., a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the software avatar management device structure shown in fig. 1 does not constitute a limitation of the device, and may include more or fewer components than shown, or may combine certain components, or may be a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a software head portrait management program may be included in a memory 1005 as one type of computer storage medium.
In the software avatar management apparatus shown in fig. 1, the network interface 1004 is mainly used for connecting to a background server and performing data communication with the background server, the user interface 1003 is mainly used for connecting to a client (user side) and performing data communication with the client, and the processor 1001 may be used for calling a software avatar management program stored in the memory 1005 and performing operations in a software avatar management method described below.
Based on the hardware structure, the embodiment of the software head portrait management method is provided.
Referring to fig. 2, fig. 2 is a flowchart of a first embodiment of a software head portrait management method according to the present invention, where the software head portrait management method is applied to a head portrait service, and the software head portrait management method includes:
step S10, acquiring associated head portraits of all users in associated software associated with a head portrait server based on a preset timing time interval;
In this embodiment, the software avatar management method is applied to the avatar server. The head portrait management and timing task processing can be performed in the head portrait server. Wherein, the head portrait management comprises two functions of head portrait uploading and head portrait storage, and the head portrait uploading function provides web pages for uploading employee head portraits. The head portrait storage function is used for storing the uploaded head portrait information of the user. The timing task processing is used for managing each head portrait, such as the head portrait in the related software related to the timing synchronization and the head service end (e.g. the head portrait of a synchronous employee enterprise micro-letter head portrait), periodically reminding an administrator to upload the head portrait of a work card which is not uploaded to the head portrait service to a new job user head portrait, namely reminding the administrator in time when the head portrait of the new user exists in the head portrait service or is not found, periodically comparing the head portraits with the non-work card head portraits, and periodically informing the administrator to update or upload the head portraits and the like. For example, as shown in fig. 4, the head portrait management module (i.e. the head portrait service) includes a head portrait uploading module and a head portrait storage module, and sets a timing task for the head portrait management module, such as a timing synchronization head portrait module, to complete synchronization of the enterprise micro-letter head portrait. Or an amorphous card head portrait timing notification module which timely notifies a head portrait manager.
Moreover, the software head portrait management method in the embodiment can uniformly manage the head portraits of users as standard head portraits, such as work card head portraits, and can uniformly store and manage the head portraits of users, such as head portraits of users of whole companies. And the head portrait interface is provided outwards, and the head portrait of staff work cards of all companies is provided for office chat software and other office systems, such as an entrance guard face recognition system, an approval system and the like, so that the head portrait interface has the advantages of convenience in access and strong usability. In this embodiment, personnel information is regularly pulled from the storage system storing personnel data of the whole company, and the personnel information is compared with the head portrait in the head portrait service so as to screen out the head portrait of the user (such as a new user) in the storage system, and the head portrait service does not have the head portrait of the user, and prompt an administrator to upload the head portrait file (such as the work card head portrait) of the user in the head portrait service.
Therefore, in this embodiment, the avatar server may detect the avatars of all users in the associated software, such as the WeChat of personnel of the whole company, at regular intervals according to the preset timing time. Therefore, user information of personnel of the whole company is determined first, enterprise WeChat head portraits of the personnel are pulled from associated software, such as enterprise WeChat, according to the user information, namely head portraits of all users in the associated software are used as associated head portraits, and head portraits of the users in the associated software are matched with head portraits of the users in advance in head portraits service, so that whether adjustment of the head portraits in the associated software is needed is determined.
Step S20, traversing each associated head portrait, determining a traversing user corresponding to the traversed associated head portrait, and determining whether the head portrait of the traversing user in the head portrait server is matched with the traversed associated head portrait;
In this embodiment, the head portrait in the head portrait server may be set as an employee's work card head portrait (blue/white/black solid background, head-to-body ratio 1:2, clear front view), so as to quickly identify the head portrait subsequently. In this embodiment, all the extracted associated head images are traversed, whether the traversed associated head images are matched with the head images of the users corresponding to the traversed associated head images in the head image service end is detected, the traversed users corresponding to the traversed associated head images I y are determined first, the head images I x of the traversed users in the head image service end are determined, if the head images I x of the traversed users in the head image service end do not exist in the head image service end, recording is carried out, and an administrator is reminded in batches to upload the head images of the part of users to the head image service, and the head image comparison is not carried out. If the head portrait I x of the traversing user in the head portrait server exists in the head portrait server, comparing the I x with the I y, judging whether the I y is a work card head portrait, and determining whether the traversed associated head portrait I y is matched with the head portrait I x according to a judging result. the comparison process of I x and I y may be to perform sparse representation on the head portrait I x and the traversed associated head portrait I y, then perform similarity calculation, determine whether the similarity is greater than a preset threshold, and if so, determine that I x and I y are similar, i.e. the traversed associated head portrait is matched with the standard head portrait.
And step S30, if the head images are not matched, adjusting the traversed associated head images in the associated software to be the same as the head images of the traversed users in the head image server.
When judging that the head portrait of the traversing user in the head portrait server side is not matched with the traversed associated head portrait, determining that the head portrait of the traversing user in the head portrait server side and the traversed associated head portrait have differences, and adjusting the head portrait in the associated software is needed. Therefore, head portrait errors of the traversing user in the associated software can be output to an administrator, prompt information for adjusting the head portrait of the traversing user (namely the traversed associated head portrait) in the associated software is needed, an adjustment instruction input by the administrator is received, and the target head portrait in the associated software is adjusted to be the same as the head portrait of the traversing user in the head portrait server according to the adjustment instruction, so that the consistency of head portrait types in the associated software and the head portrait server is realized. If the head portrait of the traversing user in the head portrait server is matched with the traversed associated head portrait, determining that the head portrait of the traversing user in the head portrait server is not different from the traversed associated head portrait, and if all the associated head portraits are matched with the head portraits of the corresponding users in the head portrait server, keeping the head portraits in the associated software unchanged.
In the embodiment, the associated head portraits of all users in associated software associated with a head portrait server are acquired based on a preset timing time interval, each associated head portrait is traversed, a traversed user corresponding to the traversed associated head portrait is determined, whether the head portraits of the traversed user in the head portrait server are matched with the traversed associated head portraits is determined, and if the head portraits of the traversed user in the associated software are not matched with the head portraits of the traversed user in the head portraits server, the traversed associated head portraits in the associated software are adjusted to be the same as the head portraits of the traversed user in the head portraits server. According to the method, all the associated head images in the associated software are acquired according to the timing time interval, each associated head image is traversed, when the traversed associated head image of the user in the head image server is not matched with the traversed associated head image, the traversed associated head image in the associated software is adjusted to be identical with the head image of the traversed user in the head image server, and therefore inconsistent head images in the associated software and the head image server are effectively screened out, the phenomenon that the head images are multiple in variety and cannot be guaranteed in a self-adjusting or default distribution mode of the user in the prior art is avoided, and the consistency of the head image types in the software is intelligently improved.
Further, based on the first embodiment of the present invention, a second embodiment of the software avatar management method of the present invention is provided, in this embodiment, step S20 in the foregoing embodiment, the step of determining whether the traversed user' S avatar in the avatar server matches the traversed associated avatar includes:
step a, carrying out gray processing on the traversed associated head portrait to obtain a first gray image, and calculating a first sparse coefficient of the first gray image;
In this embodiment, after each associated head portrait is obtained, each associated head portrait may be traversed, and gray processing is performed on the traversed associated head portrait, for example, red, green and blue components of each pixel point in an image corresponding to the traversed associated head portrait are set to be fixed gray values, so that graying of the traversed associated head portrait is achieved, and a corresponding gray image, that is, a first gray image, is obtained. After the first gray level image is obtained, a dictionary trained according to the head portrait server side can be obtained first, and the sparse coefficient of the first gray level image in the dictionary, namely the first sparse coefficient, can be determined.
Step b, carrying out gray processing on the head portrait of the traversing user in the head portrait server to obtain a second gray image, and calculating a second sparse coefficient of the second gray image;
And then determining user information corresponding to the traversed associated head portrait, namely determining the traversed user, acquiring the head portrait of the traversed user in the head portrait server, and carrying out gray processing on the head portrait of the traversed user in the head portrait server, for example, setting the red, green and blue components of each pixel point in the image corresponding to the head portrait of the traversed user in the head portrait server to be the same fixed gray value as the first gray image, thereby realizing the graying of the head portrait of the traversed user in the head portrait server and obtaining a corresponding gray image, namely a second gray image. After the second gray level image is obtained, a dictionary trained according to the head portrait server side can be obtained first, and a sparse coefficient of the second gray level image in the dictionary, namely a second sparse coefficient, can be determined.
And c, calculating the similarity value of the first sparse coefficient and the second sparse coefficient, detecting whether the similarity value is smaller than a preset threshold value, and determining whether the head portrait of the traversing user in the head portrait server is matched with the traversed associated head portrait according to the detection result of detecting whether the similarity value is smaller than the preset threshold value.
After the first sparse coefficient and the second sparse coefficient are obtained, similarity analysis is required to be performed on the first sparse coefficient and the second sparse coefficient, namely similarity values of the first sparse coefficient and the second sparse coefficient are calculated, so that a mean u x, a standard deviation sigma x and a variance of the second sparse coefficient X x are calculated firstMean u y, standard deviation sigma y, standard deviation sigma y and variance of first sparse coefficient X y The covariance σ xy of the first sparse coefficient X y and the second sparse coefficient X x is then calculated. And calculating a brightness value, a contrast value and a structural value according to the set different constants, namely:
Wherein, C 1、C2、C3 is a constant, L is the brightness value of the two head portraits, C is the contrast value of the two head portraits, and S is the structure value of the two head portraits.
After the brightness value, the contrast value and the structure value are obtained through calculation, the similarity value of the first sparse coefficient and the second sparse coefficient can be determined according to the brightness value, the contrast value and the structure value, whether the similarity value is smaller than a preset threshold value (a value smaller than 1 set by a user in advance) is detected, if the similarity value is smaller than the preset threshold value, it is determined that the head portrait of the traversing user in the head portrait server is not matched with the traversed associated head portrait, and adjustment is needed for the traversed associated head portrait in the associated software. And if the similarity value is greater than or equal to a preset threshold value, determining that the head portrait of the traversing user in the head portrait server is matched with the traversed associated head portrait.
In this embodiment, gray processing is performed on both the traversed associated head portrait and the traversed user in the head portrait server to obtain a first gray image and a second gray image, a similarity value between a first sparse coefficient of the first gray image and a second sparse coefficient of the second gray image is calculated, and whether the head portrait of the traversed user in the head portrait server is matched with the traversed associated head portrait is determined according to a detection result that whether the similarity value is smaller than a preset threshold value, that is, whether the head portrait of the traversed user in the head portrait server is matched with the traversed associated head portrait is determined by calculating the similarity value between the two head portraits, so that inconsistent head portraits in association software and in the head portrait server can be effectively screened.
Specifically, the step of calculating the first sparse coefficient of the first gray scale image includes:
Step d, acquiring all preset template images, and performing overlapping block taking processing on each template image to acquire a preset number of image blocks;
In this embodiment, when calculating the first sparse coefficient, a trained dictionary needs to be acquired first, that is, a plurality of template images set in advance, for example, images corresponding to the head images of each work card, are acquired in the head image server, and then the template images are overlapped and blocked to obtain the number M of image blocks, that is, the preset number, and the sizes of the image blocks are all the same, where n is n.
And e, performing sparse coding on each image block according to the column vector of each image block, constructing a dictionary according to each sparse coding, and determining a first sparse coefficient of the first gray level image in the dictionary.
After M n x n image blocks are acquired, sparse coding may be performed according to the image blocks to acquire a dictionary, i.e.:
Wherein Y is the original signal of the image, i.e. each template image. D is a dictionary. X represents a sparse coefficient matrix of the image block. Epsilon is the maximum error value allowed in sparse coding of image blocks. In this embodiment, M image blocks are used as column vectors y j, which satisfies Where j=n×n, M > j.
And in formula (1)Can be calculated by the following formula.
Wherein d j is the j-th column of the dictionary,For the j-th row corresponding to d j in the sparse coefficient matrix X, E K is the current error matrix.
Also, in this embodiment, the process of constructing the dictionary may be to determine a preset initial dictionary (i.e., the number of columns in the initial dictionary is M) according to the number of image blocks, and each column in the initial dictionary may beFurther, and with the initial dictionary fixed, the sparse matrix X is updated, the update operation may be decomposed into k separate updates for each column of the sparse matrix X. And when updating the initial dictionary, decompose DX into the sum of K rank 1 matrices, and each rank 1 matrix is the kth column in the initial dictionary multiplied by the kth row in X (k=1, 2.., M). And k row corresponding to your k column and X in updating initial dictionaryAnd fixing other rows in the initial dictionary and other columns in the sparse matrix X until all columns in the initial dictionary and all rows in the sparse matrix X are updated. And taking the updated initial dictionary as a constructed dictionary. And after the dictionary is built, the first sparse coefficient of the first gray level image in the dictionary and the second sparse coefficient of the second gray level image in the dictionary can be directly determined.
In this embodiment, the specific process of calculating the second sparse coefficient of the second gray scale image is consistent with the process of calculating the second sparse coefficient of the first gray scale image, which is not described herein.
In this embodiment, by performing overlapped block processing on all template images to obtain a preset number of image blocks, performing sparse coding on each image block to construct a dictionary, and determining a first sparse coefficient of a first gray scale image in the dictionary, that is, constructing the dictionary first, and then determining the first sparse coefficient of the first gray scale image from the dictionary, a data basis is provided for subsequent calculation of similarity values.
Specifically, if the similarity value of the first sparse coefficient and the second sparse coefficient is smaller than a preset threshold, before the step of taking the traversed associated head portrait as the target head portrait, the method includes:
step f, calculating brightness values, contrast values and structure values of the first gray scale image and the second gray scale image based on the first sparse coefficient and the second sparse coefficient;
after the first sparse coefficient and the second sparse coefficient are obtained, the mean value, standard deviation, variance and covariance value of the first sparse coefficient are calculated, and the mean value, standard deviation, variance and covariance value of the second sparse coefficient are calculated. And then calculating the brightness value, the contrast value and the structure value of the first gray level image and the second gray level image according to a formula, namely:
Wherein u x,uy is the mean of X x and X y, respectively, σ x,σy is the standard deviation of X x and X y, respectively, AndThe variances of X x and X y, respectively, σ xy represents the covariance of X x and X y, C 1、C2、C3 is a constant, L is the brightness of the two avatars (i.e., brightness values), C is the contrast of the two avatars (i.e., contrast values), and S is the structure of the two avatars (i.e., structure values).
And g, determining similarity values of the first sparse coefficient and the second sparse coefficient according to the brightness value, the contrast value and the structural value.
And then calculating the product among the brightness value, the contrast value and the structural value, and taking the product as a similarity value between the first sparse coefficient and the second sparse coefficient. Namely:
SSIM(x,y)=[L(x,y)αC(x,y)βS(x,y)γ]
Setting alpha, beta and gamma to be 1 again, and setting The similarity value SSIM (x, y) may be:
In this embodiment, the luminance value, the contrast value and the structural value are calculated according to the first sparse coefficient and the second sparse coefficient, and the similarity value of the first sparse coefficient and the second sparse coefficient is determined according to the luminance value, the contrast value and the structural value, that is, the similarity value of the first sparse coefficient and the second sparse coefficient is determined according to multiple angles of the luminance value, the contrast value and the structural value, so that the phenomenon that in the prior art, the accuracy of the obtained similarity value is low is avoided, the accuracy of the calculated similarity value is improved, and the follow-up determination of whether the head portrait of the traversing user in the head portrait server is matched with the traversed associated head portrait according to the similarity value is more accurate.
Further, the software head portrait management method in this embodiment further includes:
step t, acquiring head portraits of all users in a head portraits server, and detecting whether updated head portraits exist in each head portrait;
In this embodiment, the head portraits of all users in the head portraits server are acquired in real time or at regular time according to a fixed time period, the head portraits of all users are detected, whether the head portraits with head portraits changed exist in the fixed time period before the current moment is determined, and if the head portraits with head portraits changed exist, the head portraits with head portraits changed are taken as updated head portraits. For example, if there is a new job user with a user not uploading a head portrait in a fixed period of time before the current time, that is, there is a new job user with a user not uploading a head portrait, a timing task is created to output a prompt message to inform an administrator, so as to obtain the head portrait of the new job user uploaded by the administrator on a web page, and name the new job user (for example, name the new user with an english name), and upload the head portrait to a cloud server connected to the head portrait service, and the cloud server receives a unique identifier fileid (character string type) fed back by the cloud server. And then, the request data with the unique identification, the update time, the uploading time and other parameters fed back by the cloud server are stored into a database of the head portrait server, and at the moment, a new job-entering user in the head portrait server also has a corresponding head portrait, and the head portrait is used as an update head portrait. And because the storage barrel space of the cloud server has no upper limit of capacity, mass data can be accommodated, and employee head images can be stored infinitely for a long time. And the purchasing according to the requirement is supported, the capacity expansion is supported, and the resource is not wasted.
For example, as shown in fig. 5, an image may be uploaded on a head portrait in a web interface, and displayed by a display layer, after confirming that there is no error, the head portrait file is uploaded to a cloud server, and authority verification is performed, and after verification is passed, the head portrait file is stored in a private bucket of the cloud server, and a corresponding identifier fileid is generated, and request data is generated according to the identifier fileid and stored in a database. When the user needs to query the head portrait, the head portrait can be requested through the head portrait list page in the web page, the identifier fileid in the request data is queried in the database, and the returned head portrait file is acquired from the cloud server according to the identifier fileid and is displayed in the display layer.
And step u, if the updated head portrait exists, determining an updated user corresponding to the updated head portrait, and updating the head portrait of the updated user in associated software associated with the head portrait server to be the updated head portrait.
In this embodiment, data in association software (such as WeChat) associated with the avatar server is detected based on a preset time interval set in advance by a user, that is, the data is detected once every preset time interval, and if the user's avatar is found to be unmatched with the user's avatar in the avatar service in the association software, the user's avatar in the association software is updated. For example, when the user is a new user, the new user avatar of the new user is uploaded to the avatar server by the administrator, and stored by the cloud server, and then the avatar of the new user in the associated software associated with the avatar service is synchronously updated. For example, as shown in fig. 6, the daily time of 10:00 a in the morning obtains personnel data of the whole company from hrm (an office oa system, store whole personnel data, organize architecture data), searches the database to see if there is head portrait data in the head portrait service, and if there is no head portrait data in the head portrait service, informs the manager in batches which staff is in the head portrait service without head portrait, and needs to upload the staff work card head portrait. The general administrator receives the mail notice and collects the work card head portrait of the staff and uploads the work card head portrait to the head portrait service. And the enterprise micro-letter head images of the staff (namely the synchronization related software) can be synchronized regularly, the staff detected to be used as the staff with the head images changed are updated at the next day to be the work card head images in the head image service. Wherein hrm is a system for storing corporate personnel data. It is also possible in this embodiment to determine whether to update the avatar in the associated software by detecting whether there is an update in the avatar data in the avatar service. For example, as shown in fig. 7, when the avatar service process is started, the avatar server provides a list of the avatars that have changed within a specified period of time. And the head portrait personnel list is obtained from the head portrait server at the early morning every day, the head portrait personnel list is inquired, the head portrait is obtained from another interface of the head portrait server based on the inquiry result (comprising the English name, fileid, the updating time, the uploading time and the like) and the head portrait is obtained from the cloud server, and the head portrait in the related software such as enterprise WeChat is updated according to the obtained head portrait. And the full quantity comparison is also carried out, namely, whether the head portraits of all employee data in the head portraits server are consistent with the head portraits in the associated software or not is regularly compared, and if not, the head portraits in the associated software are updated to be consistent with the corresponding head portraits in the head portraits server. And if the head portrait does not exist in the head portrait service end, the manager is informed to upload the head portrait.
In the embodiment, by acquiring the head portraits of all users in the head portraits server, when the updated head portraits exist, the updated users corresponding to the updated head portraits are determined first, and the head portraits of the updated users in the associated software are updated to the updated head portraits, thereby avoiding the phenomenon that the head portraits are more in variety and cannot guarantee the consistency of the head portraits caused by the self-adjustment or default distribution mode of the users in the prior art, and intelligently improving the consistency of the head portraits in the software.
Specifically, the step of detecting whether an updated head portrait exists in each head portrait, includes:
Step h, determining whether to send the request data in the head portrait server to a cloud server corresponding to the head portrait server;
In this embodiment, the head portraits of all users in the head portraits server are obtained in real time or at regular time according to a fixed time period, the head portraits of all users are detected, whether the head portraits of all users need to be updated or whether all users have respective corresponding head portraits in the head portraits server are detected, if the head portraits of the users need to be updated or if a corresponding head portraits of a certain user does not exist in the head portraits server, request data in the head portraits server are sent to a cloud server corresponding to the head portraits server, so as to obtain head portraits data fed back by the cloud server. The request data are data fed back to the head portrait server by the cloud server after the head portrait is stored in the cloud server.
Step k, if yes, acquiring a head portrait file fed back by the cloud server based on the request data, determining a first head portrait of a user at the head portrait server side corresponding to the head portrait file, and detecting whether the head portrait file is matched with the first head portrait;
And step y, determining whether updated head images exist in each head image based on the matching result of detecting whether the head image file is matched with the first head image.
And when judging that the request data need to be sent to the cloud server, acquiring a head portrait file fed back by the cloud server according to the request data, determining a user corresponding to the head portrait file, detecting whether the head portrait exists in the head portrait server side or not, and if not, directly updating the head portrait in the head portrait file to the head portrait server side as an updated head portrait. If the user has the head portrait in the head portrait server, the user takes the head portrait as a first head portrait, detects whether the head portrait in the head portrait file is matched with the first head portrait, and if the head portrait in the head portrait file is not matched with the first head portrait, the head portrait in the head portrait file is directly updated to the head portrait server as an updated head portrait. If the head images are matched, the head images in the head image server are kept unchanged.
In this embodiment, after the request data is sent to the cloud server, the head portrait file fed back by the cloud server is obtained, the head portrait file is determined to correspond to the first head portrait of the user in the head portrait server, and whether the updated head portrait exists in the head portrait server or not is determined according to a matching result of whether the head portrait file is matched with the first head portrait, that is, whether the updated head portrait exists or not is determined directly by comparing the head portrait in the cloud server with the head portrait in the head portrait server, so that the accuracy of updating the head portrait in the head portrait server is achieved.
Further, referring to fig. 3, fig. 3 is a flow chart of a third embodiment of the software head portrait management method of the present invention, the software head portrait management method is applied to a cloud server, and the software head portrait management side implements the following steps:
Step S100, if request data for acquiring the head portrait file sent by the head portrait server is received, whether a signature in the request data is valid or not is detected;
In this embodiment, the software avatar management method is applied to a cloud server. In this embodiment, the header file is uploaded to a private barrel (i.e. a storage barrel) in the cloud server, and only the user checked by the signature parameters has permission to access the header, so that the security of header access is ensured, and the phenomenon of header information leakage of the user is avoided.
In this embodiment, when receiving, in the cloud server, request data that is sent by the avatar server and requests to obtain the avatar file, the cloud server needs to detect whether the request data carries a signature, and if the request data does not carry a signature, the cloud server prohibits the feedback of the avatar file to the avatar server. If the signature is carried, whether the signature in the request data is effective or not needs to be detected, namely, the signature is compared with the signature corresponding to the private barrel, and if the signature is not the signature corresponding to the private barrel, the feedback of the head portrait file to the head portrait server is forbidden. If the signature is the signature corresponding to the private barrel, whether the current time is within the valid time range of the signature corresponding to the private barrel is also required to be detected, if not, the signature is determined to be invalid, the head portrait file is forbidden to be fed back to the head portrait server, and if so, the signature is determined to be valid, and the subsequent operation is continued.
Step 200, if the signature is valid, determining a head portrait file in the private barrel according to the unique identifier in the request data, and feeding back the head portrait file to the head portrait server.
When the signature in the request data is found to be effective through judgment, the position of the private barrel can be determined according to the unique identifier carried in the request data, the head portrait file in the private barrel is obtained, and then the head portrait file is fed back to the head portrait server.
In this embodiment, if the request data for acquiring the head portrait file sent by the head portrait server is received, whether the signature in the request data is valid is detected, and if the signature is valid, the head portrait file in the private bucket is determined according to the unique identifier in the request data, and the head portrait file is fed back to the head portrait server. If the request data sent by the head portrait server is received and the signature in the request data is effective, the head portrait file in the private barrel is fed back to the head portrait server, so that the phenomenon that the head portrait is directly distributed by default or is randomly modified by a user to reduce the security of the head portrait in the prior art is avoided, the security of head portrait protection is improved, the consistency of the head portrait types in software can be controlled according to the head portrait file in the cloud server, and the phenomenon that the head portrait types are inconsistent is avoided.
Further, before the step of receiving the request data for obtaining the avatar file sent by the avatar server, the method includes:
step z, storing the received head portrait file into a preset private barrel, determining a unique identifier of the private barrel with the head portrait file, generating request data based on the unique identifier, and feeding back the request data to the head portrait server;
In this embodiment, before receiving the avatar server or the avatar file input by the user in the cloud server, the account AppId of the cloud server needs to be registered first, and the security credentials SecretId and SECRETKEY are acquired to generate the signature. When the cloud server receives the head portrait file input by the head portrait server or the user, firstly authenticating the signature of the head portrait server or the user, if the authentication is passed, creating a private barrel in the cloud server, storing the new head portrait file in the private barrel, regenerating a unique identifier of the position information of the private barrel of the new head portrait file, and compressing the unique identifier and the signature to form request data to be fed back to the head portrait server. The security credential SecretId is used to identify the identity of the interface caller, and the security credential SECRETKEY is used to encrypt the signature string and the cloud server-side authentication key for the signature string. The private bucket is a private storage bucket in the cloud server and can be accessed only by authorized users.
Specifically, the step of storing the received head portrait file in a preset private bucket includes:
Step q, determining a request instruction corresponding to the received head portrait file;
Step x, mapping all request parameters in the request instruction to obtain a first mapping table, splicing all key value pairs in the first mapping table to obtain a first spliced key value pair, and/or
Step w, mapping the request header corresponding to the request parameter to obtain a second mapping table, and splicing all key value pairs in the second mapping table to obtain a second spliced key value pair;
and r, splicing the preset effective time period, the request path corresponding to the request instruction, the first splicing key value pair and/or the second splicing key value pair to obtain a signature character string, determining a signature corresponding to the signature character string, and storing the received head portrait file into a preset private barrel according to the signature.
In this embodiment, since the private barrel can only be used by a user with authority, a request instruction corresponding to the avatar file can be acquired first, then a signature is generated according to the security credentials SecretId and SECRETKEY, that is, a valid period KeyTime of the signature is set first, and a start time STARTTIMESTAMP and an end time ENDTIMESTAMP (unix timestamp) of the valid period KeyTime are determined. Message digest SignKey is then calculated by an encryption algorithm using security credentials SECRETKEY as keys and valid time period KeyTime as messages. In this embodiment, when calculating the signature, only all the key value pairs of the HTTP request parameter in the request instruction may be spliced, or only all the key value pairs in the HTTP request header may be spliced. Or the key value pair splicing process of the HTTP request parameter and the HTTP request head image is carried out simultaneously.
Therefore, all HTTP request parameters in the request instruction may be traversed, and a key-to-value Map and a list KeyList of keys (i.e., a first mapping table) may be generated, the first mapping table may be ordered according to a dictionary, and each key-value pair in the Map may be spliced according to the ordering result, in the format of kenk1=value1 & kenk2=value2 & kenk3=value3, and may be used as HTTPPARAMETERS (i.e., a first spliced key-value pair). And splicing each item in the first mapping table according to the sequencing result in the first mapping table, wherein the format is key1, key2 and key3, and taking the key as UrlParamList.
All HTTP request headers in the request instructions may also be traversed, generating a key-to-value Map and a list KeyList of keys (i.e., a second mapping table), where keys are encoded using UrlEncode (percent number encoding) and converted to lower case mode, and values are encoded using UrlEncode. And sorting the second mapping table according to the dictionary sequence, and splicing each key value pair in the Map according to the sorting result, wherein the format is key1=value 1& key2=value 2& key3=value 3, and the key value pair is taken as HTTPHEADERS (namely, a second spliced key value pair). And splicing each item in the first mapping table according to the sequencing result in the first mapping table, wherein the format is key1, key2 and key3, and taking the key as HEADERLIST.
The HTTP method, HTTP request path, HTTPPARAMETERS (first splice key pair) and/or HTTPHEADERS (second splice key pair) are then spliced to generate HTTPSTRING. And splicing the effective time periods KeyTime and HTTPSTRING to obtain a request character string StringToSign with the format of sha1\ nKeyTime \ nSHA1 (HTTPSTRING) \n. Finally, the encryption algorithm is adopted to calculate a new message digest, namely Signature (Signature character string), by taking SignKey as a key and StringToSign as a message, and the new message digest is used as a Signature.
After the signature is obtained, the private barrel can be started through the signature, and the head portrait file is stored in the private barrel which is set in advance. In the cloud server, operations such as uploading the head portrait file, requesting the file, deleting the file and the like all need to carry a signature to determine whether the head portrait file has authority or not, and the security access of a user to the cloud server can be ensured through the signature, so that the head portrait is prevented from being accessed by an illegal user, and the phenomenon of information leakage is effectively avoided.
The invention further provides a software head portrait management system, which comprises a head portrait service, a cloud server and associated software;
The cloud server is used for detecting whether a signature in the request data is valid or not if the request data for acquiring the head portrait file sent by the head portrait server is received, determining the head portrait file in the private barrel according to a unique identifier in the request data if the signature is valid, and feeding back the head portrait file to the head portrait server;
The head portrait server is used for determining an updated head portrait according to the received head portrait file, determining an updated user corresponding to the updated head portrait, and updating the head portrait of the updated user in associated software associated with the head portrait server into the updated head portrait;
The head portrait server is used for acquiring associated head portraits of all users in associated software associated with the head portrait server based on a preset timing time interval, traversing each associated head portrait, determining traversed users corresponding to the traversed associated head portraits, determining whether the head portraits of the traversed users in the head portrait server are matched with the traversed associated head portraits, and if so, adjusting the traversed associated head portraits in the associated software to be identical with the head portraits of the traversed users in the head portrait server.
Optionally, the cloud server is further configured to store the received avatar file in a preset private bucket, determine a unique identifier of the private bucket with the avatar file, generate request data based on the unique identifier, and feed back the request data to the avatar server;
The head portrait server is also used for acquiring head portraits of all users in the head portrait server, determining whether to send request data in the head portrait server to a cloud server corresponding to the head portrait server according to each head portrait, and if so, sending the request data to the cloud server.
The invention also provides a computer storage medium.
The computer storage medium of the present invention stores thereon a software head portrait management program which, when executed by a processor, implements the steps of the software head portrait management method as described above.
The method implemented when the software head portrait management program running on the processor is executed may refer to various embodiments of the software head portrait management method according to the present invention, and will not be described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.