Multi-account group intelligent switching method and device based on dynamic interaction
By obtaining and locally cache group and account data from the server in the multi-account group switching system, optimizing group display using sorting and search, matching accounts according to permissions and encrypting processing, solving the performance problems and insufficient security in the switching process in the existing technology, achieving a more efficient, secure and convenient user experience.
Patent Information
- Application Number
- CN202510095637.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-01-22
AI Technical Summary
The prior art has performance problems, timer leakage risk, high DOM operation coupling, insufficient global state management, low keyword filtering efficiency, tight coupling of hard coding and styles, and lack of error handling.
Get the original set of groups and account sets of users by sending asynchronous network requests to the server and cache this data locally. Use sorting vectors to perform group sorting, expansion or collapse operations, and search and filter based on keywords entered by users. Select the appropriate account according to the permissions required by the group and the account switching matching function, and encrypt the account and access token. Establish a session connection and regenerate encrypted data after a timeout.
It improves the convenience of user operations and the security of the system, optimizes user experience and resource utilization efficiency, adapts to diverse application scenarios, and improves the stability and response speed of the system through error handling and caching mechanisms.
Smart Images

Figure CN119544769B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method, device and electronic device for intelligent switching of multiple account groups based on dynamic interaction. Background Art
[0002] Multi-account group switching is a function that allows users to switch between groups associated with different accounts in a system environment that contains multiple user accounts and multiple groups. Simply put, a user may have multiple accounts, each of which belongs to a different group. When a user needs to switch from a group operating environment under one account to a group environment under another account, multi-account group switching is required.
[0003] The existing technology has the following defects in the process of switching between multiple account groups:
[0004] 1. Performance issues (repeated rendering):
[0005] Each time SetOpen is called, the entire groups_list is deep copied and reset, which may cause performance issues, especially when the group data is large.
[0006] When useEffect processes search keywords, using the setTimeout function will frequently trigger state updates, which may lead to unnecessary multiple renderings.
[0007] 2. Timer leakage risk:
[0008] The timer is not explicitly cleared when the component is destroyed, which can cause memory leaks, especially when the component is mounted and unmounted repeatedly.
[0009] 3. DOM operation coupling is high:
[0010] The isChildOf function checks click events by directly manipulating the DOM, which increases the coupling with the DOM. React emphasizes the use of a declarative approach to handling events, and directly manipulating the DOM may violate best practices.
[0011] 4. Inadequate global state management:
[0012] Group data and keyword search states rely entirely on component internal state management, and may not be shared across components. If multiple components need to access the same data, global state management (such as Redux) would be more appropriate.
[0013] 5. Inefficient keyword filtering:
[0014] Each search will filter keywords by deep copying the entire CP_groups_list and traversing all groups. This may not be efficient for processing large-scale data and may need to be optimized to incremental updates or use a more efficient search algorithm.
[0015] 6. Hard coding is tightly coupled with style:
[0016] The definitions of style class names and some icons are hard-coded in JSX (such as iconfonticonguanbi1), which reduces the maintainability and scalability of the code. It is recommended to use a more dynamic way to manage icons and styles.
[0017] 7. Lack of Error Handling:
[0018] During the network request process, possible error conditions are not handled (such as when an API request fails). Failure to handle error conditions when a request fails may result in a poor user experience.
[0019] The above problems become technical problems that need to be solved. Summary of the invention
[0020] In view of this, the embodiments of the present invention provide a method, device and electronic device for intelligently switching multiple account groups based on dynamic interaction, which at least partially solve the problems existing in the prior art.
[0021] In a first aspect, an embodiment of the present invention provides a method for intelligently switching multiple account groups based on dynamic interaction, including:
[0022] By sending an asynchronous network request to the server, the original group set G and account set A of user u are obtained, and the original group set G and account set A are cached in the local cache space C;
[0023] The obtained original group set G is sorted and displayed using the sorting vector Fp to obtain a first updated group set G', and the groups in the first updated group set G' are expanded or collapsed to obtain a second updated group set Gn;
[0024] Based on the element k in the keyword set K input by the user, a search and screening operation is performed on the obtained second update group set Gn to obtain a searched third group set Gsc;
[0025] When the user performs a group switching operation on the third group set Gsc, the group switched to is g∈Gsc, and according to the permission set P(g) required by group g and the account switching matching function fs, an account subset An∈A matching the group g is selected from the account set A, and the access token set Tn corresponding to the account subset An is updated;
[0026] An encryption operation is performed on the account subset An and the access token set Tn to obtain a first encrypted account subset An' and a first encrypted access token set Tn'. After the first encrypted account subset An' and the first encrypted access token set Tn' are stored in the local cache space C, a first session connection is established with the target network object based on the first encrypted account subset An' and the first encrypted access token set Tn'. When the duration of the first session connection is greater than a preset value T0, a second session connection is established with the target network object through the newly generated second encrypted account subset An'' and the second encrypted access token set Tn'', and the first session connection established with the target network object is disconnected at the same time, and the first encrypted account subset An' and the first encrypted access token set Tn' stored in the local cache space C are deleted.
[0027] According to a specific implementation of an embodiment of the present invention, the method of acquiring the original group set G and account set A of user u by sending an asynchronous network request to the server, and caching the original group set G and account set A into the local cache space C includes:
[0028] Get the server address and specific interface endpoint information for obtaining group and account data, and determine the authentication information to be carried in the request;
[0029] According to the selected technical platform, select the corresponding asynchronous network request tool and configure it according to the request format required by the server;
[0030] Use the configured request tool to send a request to the server to start the asynchronous operation process.
[0031] According to a specific implementation of an embodiment of the present invention, the method of acquiring the original group set G and account set A of user u by sending an asynchronous network request to the server, and caching the original group set G and account set A into the local cache space C, further includes:
[0032] Wait for the server to return a response result. When receiving the response, first determine the response status code to confirm whether the request is successful. If the status code indicates that the request is successful, then parse the data content including group information and account information according to the data format returned by the server;
[0033] Accurately extract the original group set G and account set A from the parsed data;
[0034] The extracted original group set G and account set A are stored according to the requirements of the selected cache method and recorded in the local cache space C.
[0035] According to a specific implementation of an embodiment of the present invention, the method of using the sorting vector Fp to sort and display to obtain a first update group set G', and performing an expansion or collapse operation on the groups in the first update group set G' to obtain a second update group set Gn includes:
[0036] Analyze each element contained in the sorting vector Fp, and clarify the sorting basis and weight represented by each element;
[0037] Based on the analysis of the constituent elements of the sorting vector Fp, specific sorting rules are formulated for each element;
[0038] Take out each group element in the original group set G in turn, and compare and sort the groups according to the requirements of each element in the sorting vector Fp according to the predetermined sorting rules;
[0039] The ordered group set obtained after the sorting operation is determined as the first updated group set G'.
[0040] According to a specific implementation of an embodiment of the present invention, the method of using the sorting vector Fp to sort and display to obtain the first update group set G', and performing an expansion or collapse operation on the groups in the first update group set G' to obtain the second update group set Gn also includes:
[0041] When the user triggers the expansion operation of a group, the content to be displayed is determined based on the structure and information contained in the group;
[0042] When the user triggers the collapse operation of a group, the expanded content of the group is hidden according to the set rules, and the group is restored to the initial state where only the basic information of the group is displayed;
[0043] When the user performs an expansion or folding operation, the current state of each group is recorded in real time, and a set consisting of all groups in different states is determined as a second updated group set Gn.
[0044] According to a specific implementation of an embodiment of the present invention, the search and screening operation is performed on the obtained second update group set Gn based on the element k in the user input keyword set K to obtain the searched third group set Gsc, including:
[0045] Determine the attribute information for searching and matching contained in each group in the second update group set Gn;
[0046] Take out each element k in the keyword set K in turn;
[0047] For each group in the second update group set Gn, extract the determined attribute contents for search and matching, and determine whether the attribute contents of the group match the current keyword k according to the preset keyword matching mechanism;
[0048] If the match is successful, the group is marked as a group that meets the search condition of the current keyword k; if it does not match, the next group is checked until all groups in the second update group set Gn are traversed;
[0049] After completing all search screening of Gn for a keyword k, all groups marked as meeting the search conditions of the keyword k are aggregated to form a temporary intermediate result set;
[0050] The temporary intermediate result set corresponding to each keyword k is sorted to form the final third group set Gsc after the search.
[0051] According to a specific implementation of an embodiment of the present invention, selecting an account subset An∈A matching the group g from the account set A according to the permission set P(g) required by the group g and the account switching matching function fs includes:
[0052] Analyze the specific permissions contained in the permission set P(g) required by group g, and determine the permission elements required for normal access and operation of group g;
[0053] Set the operation rules and judgment logic of the account switching matching function fs. The input of this function is the permission set required by the group and the relevant information of a single account in the account set A. The output is the result of judging whether the account meets the group permission requirements.
[0054] Take out each account element in the account set A in turn, and start the permission matching judgment process with group g for each account;
[0055] The currently retrieved account information and the permission set P(g) required by group g are used as input parameters and passed into the account switching matching function fs for calculation;
[0056] Through the logical judgment of the account switching matching function fs, if the return result shows that the account meets the permission requirements of group g, the account is marked as a qualified account. If the return result shows that the permission requirements are not met, the same judgment operation is continued for the next account until all accounts in the account set A are traversed;
[0057] After completing the authority matching judgment for all accounts in the account set A, all accounts marked as meeting the authority requirements of the group g are aggregated together to form an account subset An.
[0058] According to a specific implementation of an embodiment of the present invention, when the duration of the first session connection is greater than a preset value T0, establishing a second session connection with the target network object through a newly generated second encrypted account subset An'' and a second encrypted access token set Tn'' includes:
[0059] Enable the session duration monitoring mechanism to track the duration t of the first session connection from the time it is established in real time;
[0060] When it is found that the time length t is greater than the preset value T0, the original account subset An and access token set Tn are re-encrypted using the preset encryption algorithm and key to generate a new second encrypted account subset An'' and a second encrypted access token set Tn'';
[0061] Use the newly generated second encrypted account subset An'' and second encrypted access token set Tn'', combined with the prepared connection configuration information, to initiate a request to establish a session connection to the target network object.
[0062] In a second aspect, an embodiment of the present invention further provides a multi-account group intelligent switching device based on dynamic interaction, comprising:
[0063] The acquisition module acquires the original group set G and account set A of the user u by sending an asynchronous network request to the server, and caches the original group set G and account set A into the local cache space C;
[0064] A sorting module, for the obtained original group set G, uses the sorting vector Fp to sort and display to obtain a first updated group set G', and performs an expansion or collapse operation on the groups in the first updated group set G' to obtain a second updated group set Gn;
[0065] A screening module, based on the element k in the keyword set K input by the user, performs a search and screening operation on the obtained second update group set Gn to obtain a searched third group set Gsc;
[0066] The switching module, when the user performs a group switching operation on the third group set Gsc, the group switched to is g∈Gsc, and according to the permission set P(g) required by the group g and the account switching matching function fs, the account subset An∈A matching the group g is selected from the account set A, and the access token set Tn corresponding to the account subset An is updated;
[0067] An execution module performs an encryption operation on the account subset An and the access token set Tn to obtain a first encrypted account subset An' and a first encrypted access token set Tn'. After storing the first encrypted account subset An' and the first encrypted access token set Tn' in a local cache space C, a first session connection is established with a target network object based on the first encrypted account subset An' and the first encrypted access token set Tn'. When the duration of the first session connection is greater than a preset value T0, a second session connection is established with the target network object through a newly generated second encrypted account subset An'' and a second encrypted access token set Tn'', and the first session connection established with the target network object is disconnected at the same time, and the first encrypted account subset An' and the first encrypted access token set Tn' stored in the local cache space C are deleted.
[0068] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0069] at least one processor; and,
[0070] a memory communicatively connected to the at least one processor; wherein,
[0071] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in any of the first aspects or any of the implementations of the first aspect.
[0072] In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the method described in the first aspect or any implementation of the first aspect.
[0073] In the fifth aspect, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the method described in the first aspect or any implementation of the first aspect.
[0074] The scheme in the embodiment of the present invention includes: by sending an asynchronous network request to a server, obtaining the original group set G and the account set A of the user u, and caching the original group set G and the account set A into a local cache space C; for the obtained original group set G, using the sorting vector Fp to sort and display to obtain a first updated group set G', and performing an expansion or folding operation on the groups in the first updated group set G' to obtain a second updated group set Gn; based on the element k in the user input keyword set K, performing a search and screening operation on the obtained second updated group set Gn to obtain a third group set Gsc after the search; when the user performs a group switching operation on the third group set Gsc, the group switched to is g∈Gsc, and according to the permission set P(g) required by the group g and the account switching matching function fs, selecting an account subset matching the group g from the account set A An∈A, update the access token set Tn corresponding to the account subset An; perform encryption operations on the account subset An and the access token set Tn to obtain the first encrypted account subset An' and the first encrypted access token set Tn', store the first encrypted account subset An' and the first encrypted access token set Tn' in the local cache space C, and establish a first session connection with the target network object based on the first encrypted account subset An' and the first encrypted access token set Tn'. When the duration of the first session connection is greater than the preset value T0, establish a second session connection with the target network object through the newly generated second encrypted account subset An'' and the second encrypted access token set Tn'', and disconnect the first session connection established with the target network object at the same time, and delete the first encrypted account subset An' and the first encrypted access token set Tn' stored in the local cache space C. This solution has the following beneficial effects:
[0075] 1. Improve user operation convenience
[0076] In a complex multi-account, multi-group system environment, users do not need to repeatedly log in and out of different accounts to enter the corresponding group for operation. Through the convenient group switching function, with just a few simple steps, you can quickly switch from a group associated with one account to a group corresponding to another account, which greatly saves time costs and allows users to efficiently switch and carry out corresponding activities in different work, social and other scenarios, improving overall work efficiency.
[0077] 2. Enhance system security
[0078] During the switching process, the system strictly verifies the account's access rights to the group, ensuring that only accounts with legitimate permissions can enter the corresponding group. This effectively prevents unauthorized access, avoids the risk of sensitive information leakage, and protects the data security within the group. For example, when it comes to important groups such as finance and business secrets within the enterprise, through a precise permission verification mechanism, it can prevent ordinary employees from making mistakes or malicious access, and ensure the confidentiality and integrity of the company's core data.
[0079] Key information such as accounts and access tokens are encrypted and updated appropriately based on the duration of the session. For example, encrypted data is regenerated after a session times out to establish a new session. This further strengthens the security defenses during data transmission and storage, and reduces security risks caused by data theft or tampering.
[0080] 3. Optimize user experience
[0081] Thanks to the data synchronization and update mechanism, after users switch groups, whether it is the unfinished tasks, chat records and other historical information of the previous group, or the latest announcements, member lists, function portals and other real-time content of the new group, they can be presented to users accurately and timely. This allows users to seamlessly connect operations in different groups without the trouble of information discontinuity or function loss due to switching, creating a smooth and coherent user experience.
[0082] The interface display automatically adapts and adjusts according to the situation of the group after switching. Information such as group name, function menu, member details, etc. is presented reasonably. The interface is simple and meets the user's current operational needs, allowing users to quickly focus on related matters of the new group, reducing operational obstacles caused by interface confusion or mismatch, and improving user satisfaction.
[0083] 4. Improve system resource utilization efficiency
[0084] By caching group and account data locally and updating and cleaning them at the right time, the number of repeated requests for data from the server is reduced, which reduces the load pressure on the server. At the same time, a reasonable cache strategy can speed up the system response. For example, when a user switches groups multiple times, some basic data can be directly obtained from the local cache, making the switching operation faster, so that the entire system can run efficiently in application scenarios where multiple accounts and multiple groups are frequently switched, and improve the overall efficiency of resource utilization.
[0085] 5. Adapt to diverse application scenarios
[0086] Whether it is the multi-account and multi-group operations corresponding to different roles of employees in the enterprise office system, or the complex situation of social media operators managing multiple brand accounts and corresponding groups, or other fields involving multi-identity and multi-business group collaboration, this solution can play a good role and has wide applicability. It can meet the diverse needs of different industries and different user groups for multi-account group switching management. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0088] Figure 1 A schematic diagram of a multi-account group intelligent switching method based on dynamic interaction provided by an embodiment of the present invention;
[0089] Figure 2 A schematic diagram of another method for intelligently switching multiple account groups based on dynamic interaction provided by an embodiment of the present invention;
[0090] Figure 3 A schematic diagram of the structure of a multi-account group intelligent switching device based on dynamic interaction provided by an embodiment of the present invention;
[0091] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0092] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0093] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0094] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0095] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0096] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0097] The embodiment of the present disclosure provides a multi-account group intelligent switching method based on dynamic interaction. The multi-account group intelligent switching method based on dynamic interaction provided in this embodiment can be executed by a computing device, which can be implemented as software, or as a combination of software and hardware, and the computing device can be integrated in a server, terminal device, etc.
[0098] See also Figure 1 and Figure 2 The present disclosure provides a method for intelligently switching multiple account groups based on dynamic interaction, including:
[0099] S101 , acquiring the original group set G and account set A of user u by sending an asynchronous network request to the server, and caching the original group set G and account set A into the local cache space C.
[0100] In modern network application systems, the client (such as the application interface used by users) and the server are usually separated in architecture, and the server stores various data resources. In order to obtain user-related group and account information, the client needs to initiate a network request to the server. Asynchronous network request is a non-blocking request method, which means that after sending a request, the client does not need to wait for the server to respond and can continue to perform other operations. The entire program interface will not be "stuck" due to waiting for data to return, which improves the system's response performance and user experience. For example, in a web application, after the user clicks the Get Data button, the page can still be scrolled, click other menus, etc., which utilizes the asynchronous network request mechanism.
[0101] When sending a request, you need to specify the server address (for example, a URL such as https: / / example.com / api) and the specific interface endpoint that provides services for obtaining group and account data (usually a specific path defined by the server, such as / groupsAndAccounts, etc.). At the same time, you must configure the request header information (including content type Content-Type declaration, authentication-related tokens, etc.) according to the server requirements to ensure that the server can correctly identify and process the request.
[0102] After receiving the request, the server will process it according to its own stored data and corresponding business logic. If the request is legal and meets the requirements, the server will search for group and account information related to user u from its database or storage system. The group set G here contains the relevant data of all groups to which the user belongs, such as each group has its unique identifier, group name, group creation time, group description information, and member list; the account set A covers the details of different accounts owned by the user, such as the account name, the corresponding password of the account (usually stored in encrypted form on the server and not directly returned to the client), the scope of the account's authority, and other information.
[0103] The server organizes the group and account information in a predetermined format (commonly known as JSON, for example, {"groups":[{"id":1,"name":"GroupA","members":["user1","user2"],...},{...}],"accounts":[{"accountName":"acc1","permissions":["read","write"],...},{...}]}) and returns it to the client.
[0104] In order to reduce the network overhead caused by frequent repeated requests for the same data from the server in subsequent operations and improve the system response speed, the client will select an appropriate local cache mechanism to store these data after receiving the group set G and account set A returned by the server. The local cache space C can be the local storage provided by the browser (such as localStorage or sessionStorage, which is commonly used in web application scenarios), or it can be the local file storage, memory cache, etc. supported by the operating system in mobile applications or desktop applications.
[0105] The caching process is to write the data in G and A to the local cache space C according to the format and storage rules required by the corresponding caching mechanism. For example, when using localStorage, the data will be stored through codes like localStorage.setItem('groups',JSON.stringify(G)) and localStorage.setItem('accounts',JSON.stringify(A)) (this is just a demonstration, the actual application may be more complicated), so that subsequent operations can be directly obtained from the local, and operations such as display and search can be performed quickly without initiating requests to the server again.
[0106] S102 , sorting and displaying the obtained original group set G using the sorting vector Fp to obtain a first updated group set G′, and expanding or collapsing the groups in the first updated group set G′ to obtain a second updated group set Gn.
[0107] The sorting vector Fp is a key element in defining the sorting rules. It contains the sorting basis of multiple dimensions and the corresponding weights. For example, Fp may contain three dimensions, namely group name (sorted in alphabetical order, with a weight of 0.3), recent use time (the more recently used groups are ranked first, with a weight of 0.5), and group permission level (the higher the permission, the higher the priority, with a weight of 0.2). These dimensions and weight settings determine how to comprehensively sort the groups so that the final displayed group order is more in line with user search and usage habits.
[0108] According to the dimensions and weights in Fp, specific comparison and sorting rules are formulated for each dimension. Then, each group element in the original group set G is taken out in turn, and the comparison and sorting operations are performed in pairs according to these rules. For example, the group names are compared first. If the names are the same, the order is further determined according to the most recent use time. If the time is also the same, the group authority level is referred to for sorting. In this way, the sorting process of all groups in G is gradually completed, and finally the sorted group set is obtained, that is, the first updated group set G'. For example, there are three groups, namely GroupA (name starts with A, the recent use time is long, and the authority level is medium), GroupB (name starts with B, has been used recently, and the authority level is high), and GroupC (name starts with C, the recent use time is medium, and the authority level is low). After sorting according to the above-mentioned assumed Fp rules, the order may become GroupB, GroupA, GroupC, and this ordered group set is G'.
[0109] In order to facilitate users to flexibly view group details or keep the interface simple, it is necessary to set how users trigger the expansion or collapse of the group. Common triggering methods can be through mouse clicks (for example, set a small icon next to the group name, click the icon to expand or collapse the group), double-click operations, or specific keyboard shortcuts. At the same time, the corresponding response area of the trigger operation must be clearly defined, such as the location of the icon is the response area, to ensure that user operations can be accurately identified.
[0110] When a user triggers the expansion operation of a group, the system needs to display it accordingly based on the internal structure of the group and the detailed information it contains. For example, if a group contains subgroups, then after expansion, the list of subgroups and their basic properties (such as subgroup name, number of members, etc.) should be displayed; if the group is associated with specific project details, relevant information such as project members, project task lists, and permission allocations of each member should be displayed. These details should be presented to complete the group expansion action, so that users can gain a deeper understanding of the specific situation of the group.
[0111] On the contrary, when the user triggers the folding operation, the system hides the expanded details of the group according to pre-set rules, and only displays the basic information of the group, such as the group name, so that the interface is restored to a simple state, avoiding too much information displayed at the same time to cause a cluttered interface and affect the user's efficiency in viewing other groups.
[0112] When the user performs an expansion or collapse operation, the system records the current state of each group (expanded or collapsed) in real time, and then groups all the groups in different states after these operations into a new set. This set is the second updated group set Gn. Subsequent operations (such as search and filtering) are based on this updated group set.
[0113] S103 , based on the element k in the keyword set K input by the user, perform a search and screening operation on the obtained second update group set Gn to obtain a searched third group set Gsc.
[0114] First, we need to determine the specific method of keyword matching. The two common methods are exact matching and fuzzy matching. Exact matching requires that the keyword entered by the user is completely consistent with the content of the group-related attributes in order to be matched successfully. For example, if the user enters the keyword "Project A", only groups with the group name "Project A" can be filtered out; for fuzzy matching, as long as the group-related attributes (such as group name, group description, associated tags, etc.) contain the keyword entered by the user, for example, if "project" is entered, then groups with the word "project" in the name, such as "Project A", "Important Project Group", etc., will be considered as matched successfully. At the same time, it is also necessary to clarify the detailed rules such as whether to distinguish between uppercase and lowercase letters when matching. For example, when distinguishing between uppercase and lowercase letters, "Project" and "project" will be treated as different keywords. After unifying these matching standards, the foundation for subsequent search and screening operations will be laid.
[0115] Sort out the attribute information that can be used for search and matching contained in each group in the second update group set Gn. Generally speaking, the group name is the most commonly used search attribute, but it may also include group description information (such as text description of group functions and business scope), group-associated tags (a set of keywords used to classify and identify group characteristics), etc., and clearly search for content that matches element k in keyword set K based on these attribute ranges.
[0116] Take out each element k in the keyword set K in turn, and start the search and screening process for the second update group set Gn for each element k. For each group in Gn, extract the attribute content previously determined for search and matching, and judge whether these attribute contents of the group match the current keyword k according to the established keyword matching mechanism. If the match is successful, the group is marked as a group that meets the search conditions of the current keyword k; if it does not match, continue to check the next group until all groups in the second update group set Gn are traversed. For example, the keyword set K contains two keywords "sales" and "department A". For each group in Gn, if a group name is "sales department 1", it will be marked if it successfully matches the keyword "sales"; if the group name is "R&D department 2", it does not meet the matching conditions of any keyword, and continue to check the next group.
[0117] After completing the search and screening of Gn for a keyword k, all groups marked as meeting the search conditions of the keyword k are summarized to form a temporary intermediate result set. Repeat this process until the search and screening operations for all elements k in the keyword set K are completed, and the temporary intermediate result sets corresponding to each keyword k are obtained. Finally, the temporary intermediate result sets corresponding to each keyword k are integrated (if there are repeated groups, only one copy is retained, and the uniqueness of the set elements is ensured by deduplication operations) to form the final searched third group set Gsc. The groups in this set are all groups that meet the search conditions of any keyword k in the keyword set K input by the user.
[0118] S104, when the user performs a group switching operation on the third group set Gsc, the group switched to is g∈Gsc, and according to the permission set P(g) required by the group g and the account switching matching function fs, an account subset An∈A matching the group g is selected from the account set A, and the access token set Tn corresponding to the account subset An is updated.
[0119] After seeing the group list displayed by the third group set Gsc obtained after search and screening, the user decides the target group to switch to according to his needs. This target group is g, and g is an element in the Gsc set. For example, the user finds several related project groups through keyword search, and then selects a specific project group (such as a group named "Important Project X") to enter the operation. This "Important Project X" group is g here.
[0120] Carefully review the specific permissions contained in the permission set P(g) required by group g, and clarify the permission elements that group g must have for normal access and operation. For example, it may include read and write permissions (whether it is possible to post messages and view files within the group), permissions to use specific functions (such as whether it is possible to initiate votes, create tasks, etc.), management permissions (management rights over group members, group settings, etc.), and other different types of permission details. Sort out these specific permission requirements clearly to prepare for subsequent account matching.
[0121] Deeply understand the operation rules and judgment logic of the account switching matching function fs. The input of this function is usually the permission set required by the group (i.e. P(g)) and the relevant information of a single account in the account set A. The output is the result of judging whether the account meets the group permission requirements (if it meets, it returns true, if it does not meet, it returns false). It may involve specific operation logic such as extracting the permission attributes of the account itself and comparing them one by one with the group permission requirements. It is necessary to master these logical details clearly.
[0122] Take out each account element in the account set A in turn, and start the permission matching judgment process with group g for each account. The currently taken out account information and the permission set P(g) required by group g are passed as input parameters to the account switching matching function fs for calculation. Through the logical judgment of the account switching matching function fs, if the return result shows that the account meets the permission requirements of group g, then the account is marked as a qualified account; if the return result shows that the permission requirements are not met, continue to perform the same judgment operation on the next account until all accounts in the account set A are traversed.
[0123] After completing the permission matching judgment of all accounts in the account set A, all accounts marked as meeting the permission requirements of group g are aggregated together to form an account subset An. All accounts in this account subset An are valid account resources that can be used to access and operate group g.
[0124] Access tokens are a mechanism for verifying the legitimacy of an account and obtaining corresponding permissions. After determining the account subset An that can be used to access group g, it is necessary to update the access token set Tn corresponding to these accounts. The purpose of the update may be to ensure the timeliness and security of the token or to match the permission settings of the current group g. For example, according to the security policy on the server side, each time you switch to a new group, a new token will be regenerated to contain the latest permission information and valid time range, etc., to ensure that subsequent operations in group g can be carried out smoothly and safely.
[0125] S105, perform encryption operations on the account subset An and the access token set Tn to obtain a first encrypted account subset An' and a first encrypted access token set Tn', store the first encrypted account subset An' and the first encrypted access token set Tn' in the local cache space C, and establish a first session connection with the target network object based on the first encrypted account subset An' and the first encrypted access token set Tn'. When the duration of the first session connection is greater than a preset value T0, establish a second session connection with the target network object through the newly generated second encrypted account subset An'' and the second encrypted access token set Tn'', disconnect the first session connection established with the target network object, and delete the first encrypted account subset An' and the first encrypted access token set Tn' stored in the local cache space C.
[0126] In order to ensure the security of account information and access tokens during storage and subsequent use, and to prevent these key data from being stolen or tampered with, it is necessary to use an encryption algorithm to encrypt the account subset An and the access token set Tn. The encryption algorithm can be a common symmetric encryption algorithm (such as the AES encryption algorithm, which uses the same key for encryption and decryption operations, and the key needs to be properly kept) or an asymmetric encryption algorithm (such as the RSA encryption algorithm, which has a public key and a private key, the public key can be publicly used for encryption, and the private key is used for decryption), etc., which is determined based on the security requirements and performance considerations of the system.
[0127] Through the encryption algorithm, each account information in An and each access token in Tn are encrypted and converted using the corresponding key to obtain the encrypted results, which respectively constitute the first encrypted account subset An' and the first encrypted access token set Tn'. For example, the plain text content such as the account number and password in the original account information becomes a string of seemingly irregular ciphertext after encryption. Only by using the correct decryption key can the original information be restored, which greatly improves the confidentiality of the data.
[0128] The generated first encrypted account subset An' and the first encrypted access token set Tn' are stored in the local cache space C according to the local cache mechanism (similar to the mechanism for caching G and A in step S101, such as using localStorage in web applications, etc.), so that subsequent operations can easily obtain these encrypted data and reduce the cost of recalculation or request.
[0129] Identify the target network object, which is usually a server-side or group-related server-side system. It is the subject that provides group-related business functions (such as sending messages, obtaining group files, etc.). Based on the first encrypted account subset An' and the first encrypted access token set Tn' stored in the local cache space C, a request to establish a session connection is initiated to the target network object in accordance with the network communication protocol (such as HTTP, HTTPS, etc.) and the connection specifications required by the server. During the request process, the encrypted account and token information will be passed to the target network object. After receiving this information, the server will use the corresponding decryption mechanism (if it is symmetric encryption, use the same key for decryption; asymmetric encryption uses the corresponding private key for decryption) for decryption verification. If the verification is successful, the first session connection is established, so that the client can perform subsequent interactive operations with the server through this connection, such as sending messages in the group, obtaining a list of members, etc.
[0130] The system will use a specific timing tool or module to track the duration of the first session connection in real time. This timing function starts at the moment the session connection is successfully established, like an accurate "stopwatch", continuously recording the passage of time and checking the current accumulated duration at a certain time interval (for example, every 1 second).
[0131] The preset value T0 is a time limit set in advance, representing the appropriate duration range for the first session connection under comprehensive considerations such as security and performance. The system will periodically (such as the above-mentioned time interval check) compare the currently monitored first session connection duration with the preset value T0. Once it is found that the duration exceeds T0, it means that a series of subsequent security update operations need to be taken to ensure the continued security of data interaction and the rational use of system resources, thereby triggering the following process steps.
[0132] As the session time increases, in order to further enhance data security and avoid potential security risks caused by long-term use of the same encrypted data (such as increased risk of encrypted information being cracked), it is necessary to regenerate the encrypted data, that is, the second encrypted account subset An'' and the second encrypted access token set Tn''.
[0133] The original account subset An and access token set Tn are encrypted again using the selected encryption algorithm and the corresponding key. This process converts the detailed information related to each account in the account subset An (such as account number, permission identifier, etc.) and each access token in the access token set Tn according to the rules of the encryption algorithm, turning them into a new ciphertext form, thereby generating the second encrypted account subset An'' and the second encrypted access token set Tn''. After encryption, even if these data are intercepted during transmission, without the correct decryption method, it is difficult for attackers to obtain the real content, thus ensuring the confidentiality and integrity of the data.
[0134] Use the newly generated second encrypted account subset An'' and second encrypted access token set Tn'', combined with the prepared connection configuration information, to initiate a request to establish a session connection to the target network object. In the process of sending the request, the stability and integrity of data transmission must be guaranteed, such as through a reliable network transmission protocol and appropriate error handling and retransmission mechanisms (if network fluctuations cause partial data loss, it can be discovered and resent in time), to avoid request failures due to external factors, and ensure that the target network object can receive complete and accurate request information.
[0135] Wait for the target network object to return a response to the connection request. If the response indicates that the connection is successfully established, it means that the second session connection has been successfully established, and the client can then perform corresponding business operations with the server based on this new session connection, such as continuing to send messages in the group, obtaining updated group resources, etc. If the response shows that the connection failed, it is necessary to carefully analyze the cause of the failure (which may be a network failure, configuration error, server-side permission verification problem, etc.), and take corresponding solutions according to the specific situation, such as re-initiating the request, checking and adjusting the connection configuration parameters, or troubleshooting network connectivity problems, until the session connection is successfully established.
[0136] After the second session connection is successfully established, the first session connection is no longer needed. Keeping it may cause a waste of resources (such as occupying network connection resources, server-side session management resources, etc.), and from a security perspective, it may also increase unnecessary security risks (such as the potential for malicious exploitation, etc.). Therefore, it is necessary to disconnect the first session connection established with the target network object in a timely manner to release related resources and keep the system in a more efficient and secure operating state.
[0137] By calling the corresponding network connection management function or following the disconnection process specified in the network protocol, a disconnection instruction is sent to the target network object to complete the closing operation of the first session connection. At the same time, both the client and the server will clean up the resources related to the session connection (such as the session state information cached in the memory, etc.) to ensure a complete disconnection and avoid abnormal residual connections.
[0138] The first encrypted account subset An' and the first encrypted access token set Tn' previously stored in the local cache space C have lost their function after the first session connection is disconnected and replaced by a new session connection. Keeping them in the local cache not only occupies cache space, but also brings certain security risks if the cache data is accidentally leaked. Therefore, they need to be deleted from the local cache space C.
[0139] According to the specific storage mechanism adopted by the local cache (for example, localStorage or sessionStorage used in web applications, through corresponding deletion functions, such as localStorage.removeItem(An') and localStorage.removeItem(Tn'); in other desktop or mobile applications, according to the local file or cache data deletion method provided by the corresponding operating system), accurately find and delete the data records related to the stored first encrypted account subset An' and the first encrypted access token set Tn', release cache space, further enhance the data security of the system and optimize the utilization efficiency of local cache resources.
[0140] Through the above steps, the system realizes the security update and reasonable resource management of session connection after timeout, and continuously ensures the data interaction security of users in multi-account group switching scenarios and the stable and efficient operation of the system.
[0141] As an optional implementation, in the process of sending an asynchronous network request to the server in step S101, the identity of the user may be verified, specifically, including the following steps S1011-S1015:
[0142] S1011, obtain the initial credential set Cf and metadata set Mf required for the client user to log in to the target server, after completing the verification of the initial credential set Cf through the first verification function, generate a first security assessment value Rf based on the initial credential set Cf and the metadata set Mf.
[0143] During the system operation, in order to ensure that the client user can log in to the target server safely, it is necessary to first obtain the initial credential set Cf and metadata set Mf required for the client user to log in to the target server. The initial credential set Cf contains the key information required for the user to log in, such as the user name, password summary, digital certificate, etc., which is the basis for verifying the user's identity. The metadata set Mf contains auxiliary information related to the user, device, and login environment, such as the device model, operating system version, and the IP address of the login location.
[0144] After obtaining the initial credential set Cf, the initial credential set Cf is verified through the first verification function. The first verification function verifies each piece of information in the initial credential set Cf one by one according to the preset verification rules and algorithms, and checks its integrity, accuracy and legality. For example, verify whether the user name exists in the system user list, whether the password summary matches the stored encrypted password, whether the digital certificate is valid and has not been revoked, etc.
[0145] After completing the verification of the initial credential set Cf, a first security assessment value Rf is generated based on the initial credential set Cf and the metadata set Mf. The process of generating the first security assessment value Rf involves complex algorithms and models, which will comprehensively consider multiple factors such as the credibility of the initial credentials and the security of the login environment reflected by the metadata. For example, if the user is using a commonly used device and the login location is consistent with the historical records, and the initial credential verification is completely passed, then the first security assessment value Rf may be relatively high; on the contrary, if the user logs in from an unfamiliar device or an abnormal location, even if the initial credential verification is passed, the first security assessment value Rf may be reduced due to these risk factors.
[0146] S1012: When the first security assessment value Rf is greater than the preset value R0, an encryption key KM is generated based on the metadata set Mf, and a secure transmission protocol TA is established between the client and the target server based on the encryption key KM. The secure transmission protocol TA is provided with an encryption function FY and a content encapsulation warehouse CT, and the encryption function FY is used to perform encryption operations on the information in the content encapsulation warehouse.
[0147] When the first security assessment value Rf is greater than the preset value R0, it means that the security of the current login meets the standard required by the system. At this time, the encryption key KM is generated based on the metadata set Mf. The algorithm for generating the encryption key KM will make full use of the information in the metadata set Mf, such as the unique identifier of the device, the specific characteristics of the user, etc., to ensure that the generated encryption key has sufficient randomness and security.
[0148] Based on the encryption key KM, a secure transmission protocol TA is established between the client and the target server. The secure transmission protocol TA is an important mechanism to ensure the security of data transmission between the client and the target server. It stipulates the format of data transmission, encryption method, and interaction process between the two communicating parties. An encryption function FY and a content encapsulation warehouse CT are provided in the secure transmission protocol TA. The encryption function FY is used to encrypt the information in the content encapsulation warehouse. The encryption function FY uses advanced encryption algorithms, such as AES (Advanced Encryption Standard), RSA, etc., to encrypt the data to be transmitted and convert the plaintext into ciphertext, thereby preventing the data from being stolen or tampered with during the transmission process. The content encapsulation warehouse CT is used to encapsulate the information to be transmitted, and integrate the encrypted data and related control information, metadata, etc. to ensure that the data can be accurately and completely transmitted to the target recipient.
[0149] S1013, obtain a first channel set V={V1,V2,…Vn} including n verification channels, select m verification channels from the first channel set V based on the first security assessment value Rf to form a second channel set V'={V'1,V'2,…V'm}, and based on the secure transmission protocol TA, set m secure transmission layers including an encryption function FY and a content encapsulation warehouse CT in the second channel set V', encrypt the verification information Mc through the encryption function FY, and send it to the user of the client through the content encapsulation warehouse CT.
[0150] A first channel set V={V1, V2, …Vn} containing n verification channels is obtained. These verification channels are different ways set by the system to further verify the user's identity and ensure communication security. Each verification channel may have different characteristics and uses. For example, some channels may focus on verifying the user's biometric information, while others may be used to verify the user's dynamic password, etc.
[0151] Based on the first security assessment value Rf, m verification channels are selected from the first channel set V to form a second channel set V'={V'1, V'2, ... V'm}. The selection process will be comprehensively considered based on the size of the first security assessment value Rf and the risk level of each verification channel, applicable scenarios and other factors. Generally speaking, the higher the first security assessment value Rf, the fewer verification channels may be selected and the verification strength is relatively low; conversely, the lower the first security assessment value Rf, the more verification channels may be selected and the verification strength is higher.
[0152] Based on the secure transmission protocol TA, m secure transmission layers including an encryption function FY and a content encapsulation warehouse CT are set in the second channel set V'. In this way, each selected verification channel has the ability to securely transmit data and can encrypt and encapsulate the information transmitted through the channel. After the verification information Mc is encrypted by the encryption function FY, it is sent to the user of the client through the content encapsulation warehouse CT. The verification information Mc contains relevant information that the system needs to provide from the user in order to further verify the user's identity, such as a one-time verification code, answers to specific questions, etc. Through the encryption and encapsulation processing of the secure transmission layer, the verification information Mc is effectively protected during the transmission process to ensure its security and integrity.
[0153] S1014, obtaining feedback information Mk returned by the user in response to the verification information Mc through the second channel set V', forming a user behavior parameter set B={b1,b2,…bp} based on the feedback information Mk, and determining whether the user behavior is abnormal by calculating the similarity value Sm between the user behavior parameter set B and the standard behavior parameter set L={L1,L2,…Lp}.
[0154] The feedback information Mk returned by the user for the verification information Mc is obtained through the second channel set V'. After receiving the verification information Mc, the user provides corresponding feedback information Mk as required, such as inputting a one-time verification code, answering specific questions, etc.
[0155] Based on the feedback information Mk, a user behavior parameter set B={b1, b2, ...bp} is formed. The user behavior parameter set B includes a series of parameters that can reflect the user's behavior characteristics, such as the time when the user inputs the feedback information, the input speed, the input accuracy, etc. These parameters can reflect the user's behavior habits and operation modes from different angles.
[0156] By calculating the similarity value Sm between the user behavior parameter set B and the standard behavior parameter set L={L1,L2,…Lp}, it is determined whether the user behavior is abnormal. The standard behavior parameter set L is obtained based on the statistical analysis of a large amount of normal user behavior data and represents the typical characteristics and patterns of normal user behavior.
[0157] The behavior pattern similarity function Sm(B,L) can be defined as:
[0158]
[0159] γ and σ are correction parameters;
[0160] A similarity threshold θ is set. When Sm(B,N)<θ, the user behavior is judged to be abnormal.
[0161] On the contrary, if the similarity value Sm is higher than the preset threshold, it means that the user's behavior basically conforms to the normal behavior pattern and there is no obvious abnormality.
[0162] S1015, when it is determined that there is no abnormality in the user's behavior, a session SH is established between the client user and the target server through an encryption protocol, and the user's session record Ah during the session is recorded in real time. Based on the session record Ah, it is determined whether there is an abnormality in the current session SH. When it is determined that the session SH is abnormal, the session between the client user and the target server is disconnected.
[0163] When it is determined that there is no abnormality in the user's behavior, a session SH is established between the client user and the target server through an encryption protocol. The encryption protocol uses advanced encryption technology, such as SSL (Secure Sockets Layer) or TLS (Transport Layer Security), to encrypt and protect the data during the session to ensure the confidentiality, integrity and authentication of the communication.
[0164] After the session SH is established, the user's session record Ah is recorded in real time during the session. The session record Ah contains various operation information of the user during the session, such as the user's login time, accessed resources, and performed operations. This information is crucial for monitoring user behavior and detecting session anomalies.
[0165] Based on the session record Ah, it is determined whether the current session SH has an abnormality. The judgment process will analyze and evaluate the various information in the session record Ah according to the preset abnormality detection rules and algorithms. For example, if it is detected that the user frequently performs high-risk operations in a short period of time, or accesses unauthorized resources, or has abnormal login behavior, etc., it may be determined as a session abnormality.
[0166] Specifically, judging whether the current session SH is abnormal based on the session record Ah includes:
[0167] Analyze the user's operation sequence based on the session record Ah , q is the number of operations;
[0168] Combine operation sequence A with the normal operation mode Compare and get the matching value QD:
[0169]
[0170] and are the maximum and minimum of the jth operation in the normal operation mode, respectively;
[0171] The operation mode matching threshold β is set. When QD(A,E)≥β, it is considered that the user operation conforms to the normal behavior mode and there is no abnormality in the current session SH.
[0172] When it is determined that the session SH is abnormal, in order to ensure the security of the system and the integrity of the data, the session between the client user and the target server is disconnected in time. The operation of disconnecting the session can quickly terminate the continuation of the abnormal behavior, prevent the possible security threat from spreading further, and protect the interests of the system and users.
[0173] See also Figure 2 , the present invention proposes an intelligent group switching and permission management method based on a multi-account system. The method allows users to quickly switch between multiple groups by obtaining user group data and combining account permission information, and realizes dynamic update and switching of account information. The system can filter the group list in real time according to the keywords entered by the user, optimize the group display method through intelligent sorting and grouping, and support users to switch seamlessly between different groups and accounts. The invention uses a combination of asynchronous data request and local cache to ensure the real-time and consistency of group data, and improves user experience through a cache mechanism. The core technical solutions of the system include: efficient screening and updating of data, intelligent expansion and collapse of groups, and automatic account switching management based on permissions, and anti-misoperation design is also carried out for user operations. Through this technical solution, users can quickly locate and switch the required groups and accounts in complex multi-group and multi-account scenarios, which greatly improves the efficiency of group management and permission switching, reduces the operation steps, and ensures the safety and accuracy of operations.
[0174] The detailed description of the technical solution of the present invention includes:
[0175] 1. Acquisition and storage of group and account data:
[0176] The system first obtains all the groups and account data to which the user belongs through asynchronous network requests. Through API calls, the system can obtain the group information to which the current user has permissions, including group name, member list, group permission status, etc. At the same time, the system obtains the user account information corresponding to each group so that the corresponding account can be automatically matched when the user switches groups. To speed up subsequent operations, the system caches group and account data locally to reduce repeated network requests.
[0177] 2. Intelligent sorting and display of group data:
[0178] After obtaining the group data, the system will intelligently sort and display the groups. The sorting criteria include group name, recent usage time, user permissions, etc. For example, by default, the system will put the currently active groups at the top of the list, and can also sort alphabetically by group name to ensure that users can quickly locate the target group. The system supports dynamically adjusting the display order of groups based on user operation behavior, and expanding or collapsing groups when users click to optimize space utilization and interface display.
[0179] 3. Keyword search and real-time filtering:
[0180] To improve the efficiency of users' searches in a large number of groups, the system supports keyword search. After the user enters a keyword, the system filters the group name or description by string matching. The search process uses a dynamic filtering mechanism. After each character entered by the user, the system automatically calls the search algorithm to search the entire group data set and only displays groups that match the keyword. The search results are fed back to the user in real time to ensure a seamless interactive experience.
[0181] 4. Dynamic management of group expansion and collapse:
[0182] The system allows users to expand or collapse a group in the group list. When expanding, users can view the subgroups or project details under the group, including group member list, subgroup name, subproject permissions and other information. When users do not need to view certain groups, they can collapse them to keep the interface simple and clear. The expanded or collapsed state will be saved in real time to ensure that the system remembers the user's last operation preference when the user visits next time.
[0183] 5. Automatic account switching based on permissions:
[0184] When a user switches between different groups, the system automatically identifies the permissions required by the group and matches the user's currently logged in account. If the current account does not have permission to access the group, the system automatically switches to an account that has that permission. When switching, the system sends a request to the backend to update the user's access token and stores the new permission information locally to ensure that the switching process is seamless. This technical solution solves the tedious problem of frequent manual switching in multi-account scenarios and improves work efficiency.
[0185] 6. Account and group status monitoring and misoperation prevention mechanism:
[0186] In order to prevent users from operating the system by mistake when they have insufficient permissions, the system has designed an anti-misoperation mechanism based on status monitoring. For groups that cannot be accessed by an account, the system will mark the group as "locked", and users cannot expand or enter these groups. At the same time, the system will restrict users' switching operations to ensure that users can only operate when they have access permissions. Through the distinction of icons and colors, users can intuitively see which groups are accessible and which groups are unavailable.
[0187] 7. Data synchronization and update mechanism:
[0188] After the group switch or account switch is completed, the system will synchronize the user's latest operation to the backend server in real time to ensure data consistency. The system updates the data status of the front-end and back-end in real time through two-way data binding. Each time the user completes the switch operation, the system will re-acquire a new permission token and store the relevant user information in the local cache. This mechanism ensures the real-time and consistency of data, ensuring that users maintain the same operation experience in different devices or sessions.
[0189] 8. Error handling and prompt mechanism:
[0190] When the system processes network requests, switches accounts or groups, network problems, insufficient permissions or other abnormal situations may occur. In order to improve the user experience, the system has designed a complete error handling mechanism. When a network request fails, the system will display a corresponding error prompt and allow the user to retry the operation; if the user does not have sufficient permissions to access a group or account, the system will pop up a prompt box to inform the user of insufficient permissions and provide relevant solution suggestions. This mechanism ensures the robustness of the system and a good user experience.
[0191] 9. Timer and state management optimization:
[0192] To improve search performance, the system uses timers (such as setTimeout) to delay processing of keywords entered by users to avoid frequent triggering of search operations. The system will batch process search requests within a short period of time after the user stops entering to reduce resource consumption. In terms of state management, the system uses React's useState and useEffect to manage component states, and uses useRef to retain some static data that does not need to be updated frequently, thereby improving component rendering efficiency.
[0193] 10. Security Mechanism:
[0194] When switching accounts or groups, the system sends sensitive data via HTTPS and uses a secure OAuth 2.0 authentication mechanism to obtain access tokens to ensure the security of account switching and permission operations. At the same time, locally cached account information is encrypted to prevent information leakage. In addition, the system will automatically clear cached account information based on the session length set by the user to ensure the privacy and security of user data.
[0195] According to a specific implementation of an embodiment of the present invention, the method of acquiring the original group set G and account set A of user u by sending an asynchronous network request to the server, and caching the original group set G and account set A into the local cache space C includes:
[0196] Get the server address and specific interface endpoint information for obtaining group and account data, and determine the authentication information to be carried in the request;
[0197] According to the selected technical platform, select the corresponding asynchronous network request tool and configure it according to the request format required by the server;
[0198] Use the configured request tool to send a request to the server to start the asynchronous operation process.
[0199] According to a specific implementation of an embodiment of the present invention, the method of acquiring the original group set G and account set A of user u by sending an asynchronous network request to the server, and caching the original group set G and account set A into the local cache space C, further includes:
[0200] Wait for the server to return a response result. When receiving the response, first determine the response status code to confirm whether the request is successful. If the status code indicates that the request is successful, then parse the data content including group information and account information according to the data format returned by the server;
[0201] Accurately extract the original group set G and account set A from the parsed data;
[0202] The extracted original group set G and account set A are stored according to the requirements of the selected cache method and recorded in the local cache space C.
[0203] According to a specific implementation of an embodiment of the present invention, the method of using the sorting vector Fp to sort and display to obtain a first update group set G', and performing an expansion or collapse operation on the groups in the first update group set G' to obtain a second update group set Gn includes:
[0204] Analyze each element contained in the sorting vector Fp, and clarify the sorting basis and weight represented by each element;
[0205] Based on the analysis of the constituent elements of the sorting vector Fp, specific sorting rules are formulated for each element;
[0206] Take out each group element in the original group set G in turn, and compare and sort the groups according to the requirements of each element in the sorting vector Fp according to the predetermined sorting rules;
[0207] The ordered group set obtained after the sorting operation is determined as the first updated group set G'.
[0208] According to a specific implementation of an embodiment of the present invention, the method of using the sorting vector Fp to sort and display to obtain the first update group set G', and performing an expansion or collapse operation on the groups in the first update group set G' to obtain the second update group set Gn also includes:
[0209] When the user triggers the expansion operation of a group, the content to be displayed is determined based on the structure and information contained in the group;
[0210] When the user triggers the collapse operation of a group, the expanded content of the group is hidden according to the set rules, and the group is restored to the initial state where only the basic information of the group is displayed;
[0211] When the user performs an expansion or folding operation, the current state of each group is recorded in real time, and a set consisting of all groups in different states is determined as a second updated group set Gn.
[0212] According to a specific implementation of an embodiment of the present invention, the search and screening operation is performed on the obtained second update group set Gn based on the element k in the user input keyword set K to obtain the searched third group set Gsc, including:
[0213] Determine the attribute information for searching and matching contained in each group in the second update group set Gn;
[0214] Take out each element k in the keyword set K in turn;
[0215] For each group in the second update group set Gn, extract the determined attribute contents for search and matching, and determine whether the attribute contents of the group match the current keyword k according to the preset keyword matching mechanism;
[0216] If the match is successful, the group is marked as a group that meets the search condition of the current keyword k; if it does not match, the next group is checked until all groups in the second update group set Gn are traversed;
[0217] After completing all search screening of Gn for a keyword k, all groups marked as meeting the search conditions of the keyword k are aggregated to form a temporary intermediate result set;
[0218] The temporary intermediate result set corresponding to each keyword k is sorted to form the final third group set Gsc after the search.
[0219] According to a specific implementation of an embodiment of the present invention, selecting an account subset An∈A matching the group g from the account set A according to the permission set P(g) required by the group g and the account switching matching function fs includes:
[0220] Analyze the specific permissions contained in the permission set P(g) required by group g, and determine the permission elements required for normal access and operation of group g;
[0221] Set the operation rules and judgment logic of the account switching matching function fs. The input of this function is the permission set required by the group and the relevant information of a single account in the account set A. The output is the result of judging whether the account meets the group permission requirements.
[0222] Take out each account element in the account set A in turn, and start the permission matching judgment process with group g for each account;
[0223] The currently retrieved account information and the permission set P(g) required by group g are used as input parameters and passed into the account switching matching function fs for calculation;
[0224] Through the logical judgment of the account switching matching function fs, if the return result shows that the account meets the permission requirements of group g, the account is marked as a qualified account. If the return result shows that the permission requirements are not met, the same judgment operation is continued for the next account until all accounts in the account set A are traversed;
[0225] After completing the authority matching judgment for all accounts in the account set A, all accounts marked as meeting the authority requirements of the group g are aggregated together to form an account subset An.
[0226] According to a specific implementation of an embodiment of the present invention, when the duration of the first session connection is greater than a preset value T0, establishing a second session connection with the target network object through a newly generated second encrypted account subset An'' and a second encrypted access token set Tn'' includes:
[0227] Enable the session duration monitoring mechanism to track the duration t of the first session connection from the time it is established in real time;
[0228] When it is found that the time length t is greater than the preset value T0, the original account subset An and access token set Tn are re-encrypted using the preset encryption algorithm and key to generate a new second encrypted account subset An'' and a second encrypted access token set Tn'';
[0229] Use the newly generated second encrypted account subset An'' and second encrypted access token set Tn'', combined with the prepared connection configuration information, to initiate a request to establish a session connection to the target network object.
[0230] Corresponding to the above method embodiment, see Figure 3 The embodiment of the present invention further discloses a multi-account group intelligent switching device 30 based on dynamic interaction, comprising:
[0231] The acquisition module 301 acquires the original group set G and account set A of the user u by sending an asynchronous network request to the server, and caches the original group set G and account set A into the local cache space C;
[0232] The sorting module 302 sorts and displays the obtained original group set G using the sorting vector Fp to obtain a first updated group set G', and expands or collapses the groups in the first updated group set G' to obtain a second updated group set Gn;
[0233] The screening module 303 performs a search and screening operation on the obtained second update group set Gn based on the element k in the user input keyword set K to obtain a searched third group set Gsc;
[0234] The switching module 304, when the user performs a group switching operation on the third group set Gsc, the group switched to is g∈Gsc, and according to the permission set P(g) required by the group g and the account switching matching function fs, an account subset An∈A matching the group g is selected from the account set A, and the access token set Tn corresponding to the account subset An is updated;
[0235] Execution module 305 performs encryption operations on the account subset An and the access token set Tn to obtain a first encrypted account subset An' and a first encrypted access token set Tn'. After storing the first encrypted account subset An' and the first encrypted access token set Tn' in the local cache space C, a first session connection is established with the target network object based on the first encrypted account subset An' and the first encrypted access token set Tn'. When the duration of the first session connection is greater than a preset value T0, a second session connection is established with the target network object through the newly generated second encrypted account subset An'' and the second encrypted access token set Tn'', and the first session connection established with the target network object is disconnected at the same time, and the first encrypted account subset An' and the first encrypted access token set Tn' stored in the local cache space C are deleted.
[0236] See also Figure 4 The embodiment of the present invention further provides an electronic device 60, the electronic device comprising:
[0237] at least one processor; and,
[0238] a memory communicatively connected to the at least one processor; wherein,
[0239] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the multi-account group intelligent switching method based on dynamic interaction in the aforementioned method embodiment.
[0240] An embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the aforementioned method embodiment.
[0241] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the multi-account group intelligent switching method based on dynamic interaction in the aforementioned method embodiment.
[0242] Reference below Figure 4 , which shows a schematic diagram of the structure of an electronic device 60 suitable for implementing the embodiment of the present disclosure. The electronic device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0243] like Figure 4 As shown, the electronic device 60 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 60 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0244] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, a gage, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 60 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 60 is shown with various devices, but it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or have instead.
[0245] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0246] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A multi-account group intelligent switching method based on dynamic interaction, characterized in that: include: By sending an asynchronous network request to the server, the original group set G and account set A of user u are obtained, and the original group set G and account set A are cached in the local cache space C; The obtained original group set G is sorted and displayed using the sorting vector Fp to obtain a first updated group set G', and the groups in the first updated group set G' are expanded or collapsed to obtain a second updated group set Gn; Based on the element k in the keyword set K input by the user, a search and screening operation is performed on the obtained second update group set Gn to obtain a searched third group set Gsc; When the user performs a group switching operation on the third group set Gsc, the group switched to is g∈Gsc, and according to the permission set P(g) required by group g and the account switching matching function fs, an account subset An∈A matching the group g is selected from the account set A, and the access token set Tn corresponding to the account subset An is updated; An encryption operation is performed on the account subset An and the access token set Tn to obtain a first encrypted account subset An' and a first encrypted access token set Tn'. After the first encrypted account subset An' and the first encrypted access token set Tn' are stored in the local cache space C, a first session connection is established with the target network object based on the first encrypted account subset An' and the first encrypted access token set Tn'. When the duration of the first session connection is greater than a preset value T0, a second session connection is established with the target network object through the newly generated second encrypted account subset An'' and the second encrypted access token set Tn'', and the first session connection established with the target network object is disconnected at the same time, and the first encrypted account subset An' and the first encrypted access token set Tn' stored in the local cache space C are deleted.
2. The method according to claim 1, characterized in that The method of sending an asynchronous network request to the server to obtain the original group set G and account set A of the user u, and caching the original group set G and account set A into the local cache space C includes: Get the server address and specific interface endpoint information for obtaining group and account data, and determine the authentication information to be carried in the request; According to the selected technical platform, select the corresponding asynchronous network request tool and configure it according to the request format required by the server; Use the configured request tool to send a request to the server to start the asynchronous operation process.
3. The method according to claim 2, characterized in that The method sends an asynchronous network request to the server to obtain the original group set G and account set A of the user u, and caches the original group set G and account set A in the local cache space C, and further includes: Wait for the server to return a response result. When receiving the response, first determine the response status code to confirm whether the request is successful. If the status code indicates that the request is successful, then parse the data content including group information and account information according to the data format returned by the server; Accurately extract the original group set G and account set A from the parsed data; The extracted original group set G and account set A are stored according to the requirements of the selected cache method and recorded in the local cache space C.
4. The method according to claim 3, characterized in that The method of using the sorting vector Fp to sort and display to obtain a first update group set G', and performing an expansion or folding operation on the groups in the first update group set G' to obtain a second update group set Gn includes: Analyze each element contained in the sorting vector Fp, and clarify the sorting basis and weight represented by each element; Based on the analysis of the constituent elements of the sorting vector Fp, specific sorting rules are formulated for each element; Take out each group element in the original group set G in turn, and compare and sort the groups according to the requirements of each element in the sorting vector Fp according to the predetermined sorting rules; The ordered group set obtained after the sorting operation is determined as the first updated group set G'.
5. The method according to claim 4, characterized in that The method of using the sorting vector Fp to sort and display to obtain a first update group set G', and performing an expansion or collapse operation on the groups in the first update group set G' to obtain a second update group set Gn, further includes: When the user triggers the expansion operation of a group, the content to be displayed is determined based on the structure and information contained in the group; When the user triggers the collapse operation of a group, the expanded content of the group is hidden according to the set rules, and the group is restored to the initial state where only the basic information of the group is displayed; When the user performs an expansion or folding operation, the current state of each group is recorded in real time, and a set consisting of all groups in different states is determined as a second updated group set Gn.
6. The method according to claim 5, characterized in that The search and screening operation is performed on the obtained second update group set Gn based on the element k in the keyword set K input by the user to obtain the searched third group set Gsc, including: Determine the attribute information for searching and matching contained in each group in the second update group set Gn; Take out each element k in the keyword set K in turn; For each group in the second update group set Gn, extract the determined attribute contents for search and matching, and determine whether the attribute contents of the group match the current keyword k according to the preset keyword matching mechanism; If the match is successful, the group is marked as a group that meets the search condition of the current keyword k; if it does not match, the next group is checked until all groups in the second update group set Gn are traversed; After completing all search screening of Gn for a keyword k, all groups marked as meeting the search conditions of the keyword k are aggregated to form a temporary intermediate result set; The temporary intermediate result set corresponding to each keyword k is sorted to form the final third group set Gsc after the search.
7. The method according to claim 6, characterized in that The method of selecting an account subset An∈A matching the group g from the account set A according to the permission set P(g) required by the group g and the account switching matching function fs comprises: Analyze the specific permissions contained in the permission set P(g) required by group g, and determine the permission elements required for normal access and operation of group g; Set the operation rules and judgment logic of the account switching matching function fs. The input of this function is the permission set required by the group and the relevant information of a single account in the account set A. The output is the result of judging whether the account meets the group permission requirements. Take out each account element in the account set A in turn, and start the permission matching judgment process with group g for each account; The currently retrieved account information and the permission set P(g) required by group g are used as input parameters and passed into the account switching matching function fs for calculation; Through the logical judgment of the account switching matching function fs, if the return result shows that the account meets the permission requirements of group g, the account is marked as a qualified account. If the return result shows that the permission requirements are not met, the same judgment operation is continued for the next account until all accounts in the account set A are traversed; After completing the authority matching judgment of all accounts in the account set A, all accounts marked as meeting the authority requirements of the group g are aggregated together to form the account subset An.
8. The method according to claim 7, characterized in that When the duration of the first session connection is greater than a preset value T0, establishing a second session connection with the target network object through the newly generated second encrypted account subset An'' and the second encrypted access token set Tn'' includes: Enable the session duration monitoring mechanism to track the duration t of the first session connection from the time it is established in real time; When it is found that the time length t is greater than the preset value T0, the original account subset An and access token set Tn are re-encrypted using the preset encryption algorithm and key to generate a new second encrypted account subset An'' and a second encrypted access token set Tn''; Use the newly generated second encrypted account subset An'' and second encrypted access token set Tn'', combined with the prepared connection configuration information, to initiate a request to establish a session connection to the target network object.
9. A multi-account group intelligent switching device based on dynamic interaction, characterized in that: include: The acquisition module acquires the original group set G and account set A of the user u by sending an asynchronous network request to the server, and caches the original group set G and account set A into the local cache space C; A sorting module, for the obtained original group set G, uses the sorting vector Fp to sort and display to obtain a first updated group set G', and performs an expansion or collapse operation on the groups in the first updated group set G' to obtain a second updated group set Gn; A screening module, based on the element k in the keyword set K input by the user, performs a search and screening operation on the obtained second update group set Gn to obtain a searched third group set Gsc; The switching module, when the user performs a group switching operation on the third group set Gsc, the group switched to is g∈Gsc, and according to the permission set P(g) required by the group g and the account switching matching function fs, the account subset An∈A matching the group g is selected from the account set A, and the access token set Tn corresponding to the account subset An is updated; An execution module performs an encryption operation on the account subset An and the access token set Tn to obtain a first encrypted account subset An' and a first encrypted access token set Tn'. After storing the first encrypted account subset An' and the first encrypted access token set Tn' in a local cache space C, a first session connection is established with a target network object based on the first encrypted account subset An' and the first encrypted access token set Tn'. When the duration of the first session connection is greater than a preset value T0, a second session connection is established with the target network object through a newly generated second encrypted account subset An'' and a second encrypted access token set Tn'', and the first session connection established with the target network object is disconnected at the same time, and the first encrypted account subset An' and the first encrypted access token set Tn' stored in the local cache space C are deleted.
10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the multi-account group intelligent switching method based on dynamic interaction as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Location-based digital token management systems, methods, and apparatus
US11798244B1
Methods for Conditional Transaction Tokens, Secure Sharing of Token Assets, Wallet Spam Protection, and User Interfaces for Acceptance of Terms
US20230120534A1