Lightweight function switch control method and device based on gray release mechanism

Through the lightweight functional switch control method based on the grayscale release mechanism, the status of the functional switch is dynamically adjusted, and the problems of complex configuration, lack of flexibility and real-time in the prior art are solved, and rapid response to business needs and personalized services are achieved.

CN119829121APending Publication Date: 2025-04-15QIAN JIN NETWORK INFORMATION TECH SHANGHAI LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411914539.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The existing functional switch technology has complex configurations and high thresholds, lacks flexibility and real-timeness, cannot effectively respond to rapid changes in business needs, and cannot achieve refined management and control for users or scenarios.

Method used

The lightweight functional switch control method based on the grayscale release mechanism is adopted. By obtaining the blacklist, whitelist and configuration information of the function switch, the status of the function switch is dynamically adjusted, and precise control is carried out according to the user ID and scene.

Benefits of technology

It reduces the complexity of the system, improves the operation efficiency, enables the functional switch to be quickly integrated into the existing business, provides personalized services, meets diversified user needs, and achieves rapid response to changes in business needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829121A_ABST
    Figure CN119829121A_ABST
Patent Text Reader

Abstract

The invention discloses a control method and device of a lightweight function switch based on a gray release mechanism, and the method comprises the steps: obtaining the configuration information of a plurality of function switches from a first server, the configuration information comprising a black list, a white list and a gray release range; when the target scene is accessed, determining a first target function switch corresponding to the target scene; judging whether the target user is allowed to use the first target function or not based on a multi-level gray release mechanism; wherein if the user identifier is in the blacklist, the first target function is disabled; if the user identifier is in the white list, starting a first target function; if the user identifier is not in the black list and the white list, converting the user identifier into a number, and performing modulo operation on the number to obtain a modulo operation result; if the modulo result is in the gray release range, turning on a first target function switch; otherwise, turning off the first target function switch. According to the invention, the complexity of function switch configuration can be reduced, and individual requirements are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet platform technology, and in particular to a control method for a lightweight function switch based on a grayscale release mechanism, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] As an important technical means in software development and operation and maintenance, feature switches are widely used in scenarios such as rapid iteration, grayscale release, and risk control. For example, in the recruitment industry, in order to improve recruitment efficiency and user experience, recruitment platforms need to continuously iterate and add new features. In this process, feature switches, as a tool for agile development and continuous delivery, are increasingly gaining attention and application from recruitment platforms. Feature switches allow for the flexibility to enable or disable specific features without affecting existing features, thereby achieving rapid testing and iteration and reducing the risks of launching new features.

[0003] However, current function switch technology is usually based on complex rule engines or global parameter configuration. Although this method meets the needs of large-scale systems to a certain extent, it is complex to configure and has a high threshold. It still has obvious deficiencies in flexibility, ease of use and universality. Secondly, the current configuration of function switches is mainly based on global configuration, lacking the ability to fine-tune management and control for users or scenarios, and unable to meet the diverse needs of users. In addition, the current state adjustment of function switches usually requires restarting the service or redeploying, which cannot quickly respond to real-time needs. This limitation makes the function switch unable to respond to rapid changes in business needs and lacks flexibility and real-time performance. Summary of the invention

[0004] In view of this, embodiments of the present application provide a control method for a lightweight function switch based on a grayscale release mechanism, an electronic device, a computer-readable storage medium, and a computer program product, to solve at least one of the above technical problems.

[0005] In a first aspect, an embodiment of the present application provides a control method for a lightweight function switch based on a grayscale release mechanism, which is applied to a terminal device, and the method includes:

[0006] After logging into the target client, obtaining configuration information of multiple function switches of the target client from the first server, the configuration information including a blacklist, a whitelist, and a grayscale release range;

[0007] When accessing a target scene of a target client, determining a first target function switch corresponding to the target scene based on a correspondence between the scene and the function switch, the first target function switch being used to enable or disable a first target function in the target client;

[0008] Based on a multi-level grayscale release mechanism, it is determined whether a target user of the terminal device is allowed to use the first target function; if the user identifier of the target user is in the blacklist of the first target function switch, the first target function switch is turned off and the target user is not allowed to use the first target function; if the user identifier of the target user is in the whitelist of the first target function switch, the first target function switch is turned on and the target user is allowed to use the first target function;

[0009] If the user identifier of the target user is neither in the blacklist nor in the whitelist of the first target function switch, the user identifier is converted into a number, and the converted number is modulo-ed to obtain a modulo result; if the modulo result is within the grayscale release range of the first target function switch, the first target function switch is turned on to allow the target user to use the first target function; otherwise, the first target function switch is turned off and the target user is not allowed to use the first target function.

[0010] According to some embodiments of the present application, optionally, the user identifier is converted into a number, and the converted number is modulo-ed to obtain a modulo result, including: converting the user identifier into a decimal code value; calculating the remainder of the code value divided by a preset modulo value to obtain a modulo result; wherein the grayscale release range of the first target function switch includes at least one grayscale limit value, if the modulo result is equal to the grayscale limit value, the modulo result is within the grayscale release range of the first target function switch; if the modulo result is not equal to the grayscale limit value, the modulo result is not within the grayscale release range of the first target function switch.

[0011] According to some embodiments of the present application, optionally, the user identifier is a string containing n characters; the user identifier is converted into a decimal code value, including: for n characters, setting the character index of each character in order from right to left; converting each character into a decimal sub-code value; calculating the cumulative sum of the sub-code values ​​of the n characters and the weights of the n characters to obtain the code value, wherein the weight of the i-th character is the product of the character index of the i-th character and a preset step size, 0≤i≤n-1, and i and n are both integers.

[0012] According to some embodiments of the present application, optionally, the method also includes: opening a function switch configuration visualization page; in response to an operator's input on the function switch configuration visualization page, selecting a function switch to be changed, and synchronously updating the configuration information of the function switch stored in the first server and / or the terminal device.

[0013] According to some embodiments of the present application, optionally, configuration information of multiple function switches is stored in a configuration file of the first server and / or the terminal device in a target format, or stored in a database associated with the first server; wherein the target format includes a script object notation format, an extensible markup language format, or another markup language format; the terminal device obtains or adjusts the configuration information of the function switch in the first server through an application programming interface provided by the first server.

[0014] According to some embodiments of the present application, optionally, the configuration information also includes whether it is set to be globally enabled, and the method also includes: if the first target function switch is set to be globally enabled, turning on the first target function switch to allow the target user to use the first target function.

[0015] According to some embodiments of the present application, optionally, the user identification includes a unique user identifier, a universal unique identifier, an identity token, or a session identifier.

[0016] In a second aspect, an embodiment of the present application provides a control method for a lightweight function switch based on a grayscale release mechanism, which is applied to a second server, and the second server is used to execute at least one function in a target client, and the method includes:

[0017] In response to the user identification sent by the terminal device and the request to execute the second target function in the target client, sending the user identification and the second target function identification to the first server;

[0018] The first server stores configuration information of the second target function switch, and the second target function switch is used to enable or disable the second target function. The configuration information includes a blacklist, a whitelist, and a grayscale release range. The first server is used to determine whether the second server is allowed to execute the second target function based on a multi-level grayscale release mechanism; wherein, if the user identifier is in the blacklist of the second target function switch, an instruction to turn off the second target function switch is sent to the second server; if the user identifier is in the whitelist of the second target function switch, an instruction to turn on the second target function switch is sent to the second server; if the user identifier is neither in the blacklist of the second target function switch nor in the whitelist of the second target function switch, the user identifier is converted into a number, and the converted number is modulo-operated to obtain a modulo-operated result; if the modulo-operated result is within the grayscale release range of the second target function switch, an instruction to turn on the second target function switch is sent to the second server;

[0019] When an instruction to turn on the second target function switch is received, the second target function is executed.

[0020] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the steps of the method described above are implemented.

[0021] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored, and the computer program instructions implement the steps of the method described above when executed by a processor.

[0022] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes computer program instructions, and when the computer program instructions are executed by a processor, the steps of the method described above are implemented.

[0023] The control method, electronic device, computer-readable storage medium and computer program product of the lightweight function switch based on the grayscale release mechanism provided by the embodiment of the present application, on the one hand, the present application adopts a lightweight configuration method for the function switch, such as configuring the blacklist, whitelist and grayscale release range of the function switch, which can allow the administrator to dynamically adjust the configuration information of the function switch without modifying the code or restarting the service. This is conducive to reducing the complexity of the system and improving the operating efficiency, so that the function switch can be quickly integrated into the existing business without a large amount of system reconstruction or resource investment, thereby improving the operability and dynamic response capability. On the other hand, the present application controls the state of the function switch according to the user identification and scenario, and realizes the precise control of enabling or disabling specific functions for different users and different scenarios. This fine-grained control method can flexibly customize the function switch strategy for different users, thereby providing personalized services and meeting personalized needs. On the other hand, the present application provides a multi-level grayscale release mechanism such as blacklist, whitelist and grayscale release, and determines whether it meets the conditions of blacklist, whitelist and grayscale release according to the user identification, so as to dynamically enable or disable certain functions. Through this mechanism, the release of functions is no longer fully enabled or disabled, but can be gradually released according to a multi-level grayscale release mechanism to test the effectiveness of new functions. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following briefly introduces the drawings in the embodiments of the present application.

[0025] Figure 1 A schematic diagram of a system architecture of an embodiment of the present application is shown.

[0026] Figure 2 A flowchart of a method for controlling a lightweight function switch based on a grayscale release mechanism provided in an embodiment of the present application.

[0027] Figure 3 Another flowchart diagram of a method for controlling a lightweight function switch based on a grayscale release mechanism provided in an embodiment of the present application.

[0028] Figure 4 Another flowchart of a method for controlling a lightweight function switch based on a grayscale release mechanism provided in an embodiment of the present application.

[0029] Figure 5 A schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that the purpose of providing these embodiments is to make the principles and spirit of the present application clearer and more thorough, so that those skilled in the art can better understand and implement the principles and spirit of the present application. The exemplary embodiments provided herein are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments herein, all other embodiments obtained by ordinary technicians of the art without creative work are within the scope of protection of this application.

[0031] Embodiments of the present application relate to terminal devices and / or servers. Those skilled in the art will appreciate that the embodiments of the present application may be implemented as a system, apparatus, device, method, computer-readable storage medium, or computer program product. Therefore, the present disclosure may be specifically implemented in at least one of the following forms: complete hardware, complete software, or a combination of hardware and software. According to the embodiments of the present application, the present application claims a control method, electronic device, computer-readable storage medium, and computer program product for a lightweight function switch based on a grayscale release mechanism. Figure 1 A schematic diagram of a system architecture of an embodiment of the present application is shown. Figure 1As shown, the system includes a terminal device 102, a first server 103 and a second server 104. Among them, the terminal device 102 may include at least one of the following: a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, various wearable devices, augmented reality AR devices, virtual reality VR devices, etc. A client can be installed on the terminal device 102. For example, the client can be a client that specifically performs a specific function (such as an application app), or a client with multiple application applets (different functions) embedded in it, or a client logged in through a browser. The user can operate on the terminal device 102. For example, the user can open the client installed on the terminal device 102 and input instructions through the client operation, or the user can open the browser installed on the terminal device 102 and input instructions through the browser operation. After the terminal device 102 receives the instruction input by the user, the request information containing the instruction is sent to the server 104. After receiving the request information, the server 104 performs corresponding processing and then returns the processing result information to the terminal device 102. The user instruction is completed through a series of data processing and information interaction.

[0032] The first server 103 can be used to set and store the configuration information of multiple feature switches (FeatureToggle) of the target client. The target client can be any client installed in the terminal device 102, such as a recruitment service client. The recruitment service client can be used to provide recruitment and application services for recruiting companies and job seekers. The terminal device 102 can call the second server 104, and the second server 104 can be responsible for executing one or more functions requested by the target client.

[0033] In this document, terms such as first, second, third, etc. are only used to distinguish one entity (or operation) from another entity (or operation), but not to require or imply any order or relationship between these entities (or operations).

[0034] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate the understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the related art:

[0035] As an important technical means in software development and operation and maintenance, function switches are widely used in scenarios such as rapid iteration, grayscale release, and risk control. For example, in the recruitment industry, in order to improve recruitment efficiency and user experience, recruitment platforms need to continuously iterate and add new functions. In this process, function switches, as a tool for agile development and continuous delivery, are increasingly gaining attention and application from recruitment platforms. Function switches allow for the flexibility to enable or disable specific functions without affecting existing functions, thereby achieving rapid testing and iteration and reducing the risks of launching new functions.

[0036] However, the inventors of the present application have found that the current function switch technology has at least the following problems or shortcomings:

[0037] First of all, the current function switch operation is cumbersome and the configuration is complex. It mainly relies on rule engines (such as the open source service rule engine Drools) or global configuration files to control the function switch. This method often requires developers to configure a large number of complex rules or parameters, and even requires in-depth adjustments to the configuration files or redefinition of relevant rules when modifying them. Not only does it greatly increase the workload of development and operation and maintenance, it also requires relevant personnel to have an in-depth understanding of the underlying logic and implementation details of the system. For non-technical personnel with low technical levels, it is difficult to make configuration modifications, which can easily lead to configuration errors or misunderstandings. For example, when using rule engines such as Drools, the rule logic of each function switch needs to be configured in detail, which means that a lot of time needs to be invested in design and debugging, which ultimately leads to high costs for overall implementation and maintenance.

[0038] Secondly, the function switch is not dynamic enough. Specifically, in the related art, the state change of the function switch is often static, usually requiring restarting the service or complex redeployment. This limitation makes the function switch unable to respond to the rapid changes in business needs, lacking flexibility and real-time performance. For example, when a new function needs to be enabled or disabled immediately, the existing system often requires restarting the service or manually modifying the configuration file, which increases system downtime or operation delays and affects the user experience.

[0039] Thirdly, there is a lack of fine-grained control for individual users in the status management of function switches. Currently, most solutions are managed based on global or user groups, which greatly reduces their flexibility and efficiency in scenarios where function switches need to be dynamically adjusted according to different users or devices. Specifically, existing solutions usually only configure function switches for specific user groups (such as VIPs and ordinary users), but cannot be dynamically adjusted according to the device type or identity of a single user, and cannot meet the diverse needs of users.

[0040] In addition, the current function switch technology has poor scalability. With the rapid growth of user needs and changes in the technical environment, multiple function switches may need to be redesigned or customized in a complex manner, which consumes a lot of manpower and material resources. At the same time, it also causes the maintenance model to be unable to keep up with the development of the business, making it difficult to achieve rapid horizontal expansion.

[0041] In view of the above research findings of the inventors, the embodiments of the present application provide a control method, electronic device, computer-readable storage medium and computer program product of a lightweight function switch based on a grayscale release mechanism, which can solve at least one of the above technical problems existing in the related art.

[0042] In a first aspect, the present application provides a method for controlling a lightweight function switch based on a grayscale release mechanism, which can be applied to a terminal device (such as Figure 1 The terminal device 102 is shown).

[0043] Figure 2 A flow chart of a method for controlling a lightweight function switch based on a grayscale release mechanism provided in an embodiment of the present application. Figure 2 As shown, the lightweight function switch based on the grayscale release mechanism provided in the embodiment of the present application may include the following steps S201 to S203.

[0044] S201: After logging into the target client, obtain respective configuration information of multiple function switches of the target client from the first server, where the configuration information includes a blacklist, a whitelist, and a grayscale release range.

[0045] The target client may be any client installed in the terminal device, such as a recruitment service client or other client. The first server may be used to set and store respective configuration information of multiple function switches of the target client. The function switch may be used to enable or disable functions in the target client.

[0046] After detecting that the target user logs in to the target client, the terminal device can obtain the configuration information of the multiple function switches of the target client from the first server. For example, in some examples, the terminal device can obtain the configuration information of the multiple function switches of the target client from the first server through the application programming interface (Application Programming Interface, API) provided by the first server. The target user is the user who uses the terminal device.

[0047] This application uses a lightweight configuration method for function switches. The switch status of each function switch is controlled by a set of configuration information (such as black and white lists, grayscale modulus, etc.). Users do not need to modify the underlying code, and can achieve dynamic adjustment of function switches by simply modifying the configuration. This allows administrators to dynamically adjust the switch status of function switches without modifying the code or restarting the service.

[0048] The configuration information of each function switch may include a blacklist, a whitelist, and a grayscale release range. A blacklist is a list of users or devices that are not allowed to use a specific function. In some examples, the blacklist of each function switch may include the user identifier of at least one user who is not allowed to use the function corresponding to the function switch. By setting a blacklist, it is helpful to reduce the risk of malicious users abusing or attacking sensitive functions.

[0049] A whitelist is a list of users or devices that are allowed to use a specific function. In some examples, the whitelist for each function switch may include the user identifier of at least one user who is allowed to use the function corresponding to the function switch. The grayscale release range refers to the user range that limits the availability of functions during the grayscale release process. By setting grayscale limits, certain functions can be controlled to be available only to some users. For example, the modulus can be set to 20, and 0, 1, and 2 can be used as grayscale limits, meaning that only these users can use certain functions.

[0050] S202: When accessing a target scene of a target client, a first target function switch corresponding to the target scene is determined based on a correspondence between the scene and the function switch, where the first target function switch is used to enable or disable a first target function in the target client.

[0051] The target client may have multiple different scenarios. For example, if the target client is a recruitment service client, the recruitment service client may have multiple scenarios such as job posting, resume delivery, resume screening, interview arrangement, interview feedback, recruitment activity information release, voice chat, video chat, etc. The correspondence between the scenario and the function switch can be established in advance, and one scenario can correspond to at least one function switch. For example, the voice chat scenario can correspond to the function switch of voice message, the video chat scenario can correspond to the function switch of video call, and so on.

[0052] The target scene can be any scene. When the target scene of the target user accessing the target client is monitored, the function switch corresponding to the target scene is determined based on the correspondence between the scene and the function switch. For ease of explanation, the function switch corresponding to the target scene is referred to as the first target function switch. The first target function switch can be a function switch corresponding to the target scene, or it can be a plurality of function switches corresponding to the target scene, and this application does not limit this. The first target function switch can be used to enable or disable the first target function in the target client.

[0053] S203: Determine whether to allow the target user of the terminal device to use the first target function based on a multi-level grayscale release mechanism.

[0054] This application determines whether the conditions for grayscale release are met based on the user ID, thereby dynamically enabling or disabling certain functions. Through this mechanism, the release of functions is no longer fully enabled or disabled, but can be gradually released according to specific rules to test the effect of new functions.

[0055] In an embodiment of the present application, the grayscale release mechanism is divided into multiple levels, which may at least include a blacklist, a whitelist, and grayscale release based on user identification, thereby improving flexibility and scalability.

[0056] Specifically, if the user ID of the target user is in the blacklist of the first target function switch, the first target function switch is turned off, and the target user is not allowed to use the first target function. For example, taking the first target function switch as a voice message function switch as an example, if the user ID of the target user is in the blacklist of the function switch, the voice message function switch is turned off, that is, the voice message function switch is in an off state, and the target user is not allowed to use the voice message function.

[0057] If the user ID of the target user is in the whitelist of the first target function switch, the first target function switch is turned on, allowing the target user to use the first target function. Still taking the first target function switch as the function switch of the voice message as an example, if the user ID of the target user is in the whitelist of the function switch, the function switch of the voice message is turned on, that is, the function switch of the voice message is in the on state, allowing the target user to use the function of the voice message.

[0058] For users who are not in the blacklist or whitelist, it is possible to determine whether the first target function switch is turned on based on the grayscale release range. Specifically, if the user ID of the target user is not in the blacklist of the first target function switch, nor in the whitelist of the first target function switch, the user ID is converted into a number, and the converted number is modulo-ed to obtain a modulo result; if the modulo result is within the grayscale release range of the first target function switch, the first target function switch is turned on, allowing the target user to use the first target function; if the modulo result is not within the grayscale release range of the first target function switch, the first target function switch is turned off, and the target user is not allowed to use the first target function.

[0059] The control method of the lightweight function switch based on the grayscale release mechanism provided by the embodiment of the present application, on the one hand, the present application adopts a lightweight configuration method for the function switch, such as configuring the blacklist, whitelist and grayscale release range of the function switch, which can allow the administrator to dynamically adjust the configuration information of the function switch without modifying the code or restarting the service. This is conducive to reducing the complexity of the system and improving the operating efficiency, so that the function switch can be quickly integrated into the existing business without a large amount of system reconstruction or resource investment, and improves the operability and dynamic response capability. On the other hand, the present application controls the state of the function switch according to the user identification and the scene, and realizes the precise control of enabling or disabling specific functions for different users and different scenes. This fine-grained control method can flexibly customize the function switch strategy for different users, thereby providing personalized services and meeting personalized needs. On the other hand, the present application provides a multi-level grayscale release mechanism such as blacklist, whitelist and grayscale release, and determines whether it meets the conditions of blacklist, whitelist and grayscale release according to the user identification, so as to dynamically enable or disable certain functions. Through this mechanism, the release of functions is no longer fully enabled or disabled, but can be gradually released according to a multi-level grayscale release mechanism to test the effectiveness of new functions.

[0060] According to some embodiments of the present application, optionally, in S203, the user identifier is converted into a number, and the converted number is modulo-operated to obtain a modulo-operated result, which may include the following steps 1 and 2.

[0061] Step 1: Convert the user ID into a decimal encoding value.

[0062] In some embodiments, the user identifier may be converted into a decimal coded value based on an identity identifier digital conversion algorithm. Identity identifier digital conversion refers to the process of converting an identity identifier string into a number (i.e., a coded value). For example, by parsing the user identifier, a number is obtained based on a conversion algorithm and used for subsequent modular operations.

[0063] Step 2: Calculate the remainder of dividing the encoded value by the preset modulus value to obtain the modulus result.

[0064] In some embodiments, the configuration information of the function switch may also include a preset modulus value, also known as a grayscale modulus value. In step 2, the remainder of the code value obtained in step 1 divided by the preset modulus value may be calculated, and the remainder is used as the modulus result.

[0065] Among them, the grayscale release range of the first target function switch includes at least one grayscale limit value. If the modulo result is equal to the grayscale limit value, the modulo result is within the grayscale release range of the first target function switch; if the modulo result is not equal to the grayscale limit value, the modulo result is not within the grayscale release range of the first target function switch.

[0066] For example, in some embodiments, assuming the modulus value is 20, and 0, 1, and 2 are selected as grayscale limit values, if the encoding value is modulo 20 (ie, encoding value% 20), the result is 0, 1, or 2, then the user is allowed to use the first target function.

[0067] For example:

[0068] Code value 1001: 1001%20=1, that is, the remainder is 1, and the user is allowed to use the first target function;

[0069] Code value 1002: 1002%20=2, that is, the remainder is 2, and the user is allowed to use the first target function;

[0070] Code value 1003: 1003%20=3, that is, the remainder is 3, and the user is not allowed to use the first target function;

[0071] Code value 1000: 1000%20=0, that is, the remainder is 0, and the user is allowed to use the first target function;

[0072] Coded value 1019: 1019%20=19, that is, the remainder is 19, and the user is not allowed to use the first target function.

[0073] According to some embodiments of the present application, optionally, the user identifier may be a string containing n characters, where n is a positive integer.

[0074] Accordingly, step 1: converting the user identifier into a decimal coded value may include the following steps 11 to 13.

[0075] Step 11: For n characters, set the character index of each character in order from right to left. For example, for a string S (i.e., user ID) containing n characters, the n characters from right to left are c0, c1, c2…, c n-1. Set the character index of each character starting from 0 in order from right to left. The character index of the rightmost character is 0, and the character index of the leftmost character is n-1.

[0076] Step 12: Convert each character into a decimal subcode value.

[0077] For example, the subcode value may be an ASCII value of the standard code for information interchange. Each character may be converted into a decimal ASCII value, such as uppercase letters AZ: ASCII values ​​from 65 to 90; lowercase letters az: ASCII values ​​from 97 to 122; numbers 0-9: ASCII values ​​from 48 to 57; space: ASCII value 32, etc.

[0078] Step 13: Calculate the cumulative sum of the sub-coding values ​​of the n characters and the weights of the n characters to obtain the encoding value.

[0079] The weight of the i-th character may be the product of the character index of the i-th character and a preset step length, 0≤i≤n-1, and i and n are both integers.

[0080] For example, in some examples, the encoded value corresponding to the user identifier can be calculated according to the following expression:

[0081]

[0082] Among them, sum represents the encoding value, ASCII (c i ) represents the character c i ASCII value, i represents the character index from right to left, i*256 represents the weight of the i-th character, that is, the product of the character index of the i-th character and the preset step size. For example, the preset step size is 256, and the weight of each character increases as the character index increases.

[0083] In this way, the conversion of user identifiers is implemented through a more efficient algorithm, which can meet the needs of fast response in high-concurrency scenarios.

[0084] Unlike traditional solutions that require restarting services or redeploying, this application uses a configuration-driven approach to quickly adjust the status of function switches without affecting the normal operation of the business, ensuring that the system responds quickly to changes in business needs.

[0085] Specifically, according to some embodiments of the present application, optionally, the control method of the lightweight function switch based on the grayscale release mechanism may also include the following steps three and four.

[0086] Step 3: Open the function switch configuration visualization page.

[0087] The operator can open the function switch configuration visualization page through the terminal device. In some examples, the function switch configuration visualization page can display a function switch selection button, a configuration information input box or adjustment button, such as a blacklist, a whitelist, a gray release range, and a modulus value input box or adjustment button.

[0088] Step 4: In response to the operator's input on the function switch configuration visualization page, the function switch to be modified is selected, and the configuration information of the function switch stored in the first server and / or the terminal device is synchronously updated.

[0089] The operator can set or modify the configuration information of the function switch through the function switch configuration visualization page. For example, in some examples, in response to the operator's input of the function switch on the function switch configuration visualization page, the function switch to be changed can be selected. For the selected function switch, in response to the operator's input in the input box or adjustment button of the configuration information, the configuration information of the function switch can be modified, and the configuration information of the function switch stored in the first server can be synchronously updated based on the API interface. The terminal device used by the target user re-acquires the respective configuration information of multiple function switches of the target client based on the API interface, thereby realizing the synchronous update of the configuration information.

[0090] In this way, through the function switch configuration visualization page and API interface, operators are allowed to dynamically obtain and adjust the configuration information of each function switch, so that non-technical personnel can easily enable and adjust the function switch without in-depth understanding of the complex rule engine or underlying implementation logic, which lowers the threshold for use. After the configuration is changed, the configuration information of the function switch takes effect immediately, without restarting the application or performing complex manual intervention, which greatly improves the ability to respond to changes in business needs. This dynamic adjustment capability is particularly important in rapidly changing business scenarios, and supports adjusting the configuration information of the function switch at any time without interrupting the service.

[0091] According to some embodiments of the present application, optionally, the configuration information of the plurality of function switches may be stored in a configuration file of the first server and / or the terminal device in a target format, or in a database associated with the first server.

[0092] In some embodiments, the configuration information of multiple function switches can be stored through standardized configuration files (such as SwitchersProperties), thereby supporting the rapid integration and application of function switch management in different technology stacks. The configuration file is highly universal and compatible with the API interface, and can adapt to a variety of technology stacks and business scenarios. Whether it is a mobile terminal, a Web terminal, or a background service, the control solution of the function switch provided by this application can be applied, which reduces the development and operation and maintenance costs in different scenarios, and has strong versatility and scalability.

[0093] In other embodiments, a distributed configuration center may be used to replace the configuration file to store the configuration information of multiple function switches. The distributed configuration center is a centrally managed system that can share configuration information between multiple services or applications, supports dynamic updates, and can take effect immediately without restarting the service. The core of this application is to support dynamic adjustment of the state of the function switch, and changes in the storage method will not affect the core logic of this application in the control of the function switch state.

[0094] In some embodiments, the target format may include a JSON format, that is, the configuration information of the function switch (such as a blacklist, a whitelist, a grayscale configuration, etc.) may be stored in JSON format. JSON format has the advantages of being easy to read and write and convenient to configure.

[0095] In other embodiments, the target format may also be other formats such as Extensible Markup Language (XML) format or Another Markup Language (YAML) format.

[0096] In some other embodiments, a relational database (MySQL) or a key-value storage system (Redis) may be used instead of JSON to store the configuration information of the function switch, which is not limited in this application.

[0097] According to some embodiments of the present application, the configuration information of the function switch may also include whether it is set to be globally enabled. Globally enabled means that a function of the target client is always enabled for all users, without being restricted by grayscale release or blacklist or whitelist. Even if some users are not included in the whitelist, the function is still available to these users.

[0098] Accordingly, the control method of the lightweight function switch based on the grayscale release mechanism may also include the following steps:

[0099] If the first target function switch is set to be globally enabled, the first target function switch is enabled to allow the target user to use the first target function.

[0100] That is, when the first target function switch is set to be globally turned on, the first target function switch can be turned on to allow the target user to use the first target function.

[0101] According to some embodiments of the present application, optionally, the user identification may include a unique user identifier (Instant Messaging ID, IMID).

[0102] IMID is a unique user identifier used to identify each user in an instant messaging (IM) system. IMID is usually generated by the system and contains specific information related to the user, such as user type, account number, etc. In this application, IMID can be used to accurately identify the user and control whether the user enables a certain function based on the identifier, thereby realizing user-level function switch control.

[0103] According to other embodiments of the present application, optionally, the user identifier may also be other identity identifiers, such as a universal unique identifier (UUID), an identity token (Token) or a session identifier (Session ID), etc., to accurately identify the user.

[0104] According to some other embodiments of the present application, optionally, the user identifier may also be an identity identifier provided by a third-party identity resolution system (such as OAuth or a single sign-on system) by resolving the user identity, which is not limited in the present application.

[0105] In a second aspect, the present application embodiment provides a control method for a lightweight function switch based on a grayscale release mechanism, which can be applied to a second server (such as Figure 1 The terminal device can call the backend (ie, the second server), and the second server can be used to execute at least one function in the target client.

[0106] Figure 3 Another flow chart of a method for controlling a lightweight function switch based on a grayscale release mechanism provided in an embodiment of the present application. Figure 3 As shown, the lightweight function switch based on the grayscale release mechanism provided in the embodiment of the present application may include the following steps S301 and S302.

[0107] S301: In response to a user identifier and a request to execute a second target function in a target client sent by a terminal device, the user identifier and the second target function identifier are sent to a first server.

[0108] Specifically, the second server may receive the user identification sent by the terminal device and a request to execute the second target function in the target client. The second target function may be any function, which is not limited in this application. Then, the second server may send the user identification and the second target function identification to the first server.

[0109] The first server may store configuration information of the second target function switch, and the second target function switch is used to enable or disable the second target function. The configuration information may include a blacklist, a whitelist, and a grayscale release range. The first server may be used to determine whether the second server is allowed to execute the second target function based on a multi-level grayscale release mechanism; wherein, if the user identifier is in the blacklist of the second target function switch, an instruction to turn off the second target function switch is sent to the second server; if the user identifier is in the whitelist of the second target function switch, an instruction to turn on the second target function switch is sent to the second server; if the user identifier is not in the blacklist of the second target function switch, nor in the whitelist of the second target function switch, the user identifier is converted into a number, and the converted number is modulo-operated to obtain a modulo-operated result; if the modulo-operated result is within the grayscale release range of the second target function switch, an instruction to turn on the second target function switch is sent to the second server. The multi-level grayscale release mechanism has been described in detail above and will not be repeated here.

[0110] S302: When receiving an instruction to turn on a second target function switch, execute the second target function.

[0111] Specifically, the second server may execute the second target function when receiving an instruction to turn on the second target function switch, or may not execute the second target function when receiving an instruction to turn off the second target function switch.

[0112] The control method of a lightweight function switch based on a grayscale release mechanism provided by the embodiment of the present application, on the one hand, the present application adopts a lightweight configuration method for the function switch, such as configuring the blacklist, whitelist and grayscale release range of the function switch, which can allow the administrator to dynamically adjust the configuration information of the function switch without modifying the code or restarting the service. This is conducive to reducing the complexity of the system and improving the operating efficiency, so that the function switch can be quickly integrated into the existing business without a large amount of system reconstruction or resource investment, and improves the operability and dynamic response capability. On the other hand, the present application controls the state of the function switch according to the user identification, and realizes the precise control of enabling or disabling specific functions for different users. This fine-grained control method can flexibly customize the function switch strategy for different users, thereby providing personalized services and meeting personalized needs. On the other hand, the present application provides a multi-level grayscale release mechanism such as blacklist, whitelist and grayscale release, and determines whether it meets the conditions of blacklist, whitelist and grayscale release according to the user identification, so as to dynamically enable or disable certain functions. Through this mechanism, the release of functions is no longer fully enabled or disabled, but can be gradually released according to the multi-level grayscale release mechanism to test the effect of new functions.

[0113] The control method of the lightweight function switch based on the grayscale release mechanism provided in the second aspect may have the same or corresponding technical features as the control method of the lightweight function switch based on the grayscale release mechanism provided in the first aspect, and can achieve its corresponding technical effects. For the sake of concise description, it will not be repeated here.

[0114] In a third aspect, the present application embodiment provides a control method for a lightweight function switch based on a grayscale release mechanism, which can be applied to a first server (such as Figure 1 The second server 103 is shown).

[0115] Figure 4 Another flow chart of a method for controlling a lightweight function switch based on a grayscale release mechanism provided in an embodiment of the present application. Figure 4 As shown, the lightweight function switch based on the grayscale release mechanism provided in the embodiment of the present application may include the following steps S401 to S403.

[0116] S401: In response to a request sent by a terminal device to query configuration information of multiple function switches of a target client, the configuration information of each of the multiple function switches of the target client is sent to the terminal device. The configuration information may include at least a blacklist, a whitelist, and a grayscale release range.

[0117] S402: In response to the user identifier and the second target function identifier sent by the second server, query the configuration information of the second target function switch corresponding to the second target function identifier.

[0118] S403: Determine whether to allow the second server to execute the second target function based on the multi-level grayscale publishing mechanism.

[0119] Among them, if the user identifier is in the blacklist of the second target function switch, an instruction to turn off the second target function switch is sent to the second server; if the user identifier is in the whitelist of the second target function switch, an instruction to turn on the second target function switch is sent to the second server; if the user identifier is not in the blacklist of the second target function switch, nor in the whitelist of the second target function switch, the user identifier is converted into a number, and the converted number is modulo-taken to obtain a modulo result; if the modulo result is within the grayscale release range of the second target function switch, an instruction to turn on the second target function switch is sent to the second server. The multi-level grayscale release mechanism has been described in detail above and will not be repeated here.

[0120] The control method of a lightweight function switch based on a grayscale release mechanism provided by the embodiment of the present application, on the one hand, the present application adopts a lightweight configuration method for the function switch, such as configuring the blacklist, whitelist and grayscale release range of the function switch, which can allow the administrator to dynamically adjust the configuration information of the function switch without modifying the code or restarting the service. This is conducive to reducing the complexity of the system and improving the operating efficiency, so that the function switch can be quickly integrated into the existing business without a large amount of system reconstruction or resource investment, and improves the operability and dynamic response capability. On the other hand, the present application controls the state of the function switch according to the user identification, and realizes the precise control of enabling or disabling specific functions for different users. This fine-grained control method can flexibly customize the function switch strategy for different users, thereby providing personalized services and meeting personalized needs. On the other hand, the present application provides a multi-level grayscale release mechanism such as blacklist, whitelist and grayscale release, and determines whether it meets the conditions of blacklist, whitelist and grayscale release according to the user identification, so as to dynamically enable or disable certain functions. Through this mechanism, the release of functions is no longer fully enabled or disabled, but can be gradually released according to the multi-level grayscale release mechanism to test the effect of new functions.

[0121] According to some embodiments of the present application, optionally, the lightweight function switch based on the grayscale release mechanism provided in the embodiments of the present application may include the following steps:

[0122] In response to the operator's input on the function switch configuration visualization page, the configuration information of the function switch stored in the first server and / or the terminal device is synchronously updated.

[0123] The control method of the lightweight function switch based on the grayscale release mechanism provided in the third aspect may have the same or corresponding technical features as the control method of the lightweight function switch based on the grayscale release mechanism provided in the first aspect and the second aspect, and can achieve the corresponding technical effects. For the sake of concise description, it will not be repeated here.

[0124] In a fourth aspect, the present application further provides an electronic device. The electronic device in the embodiment of the present application can be a user terminal device, a server, other computing devices, or a cloud server. Figure 5 This is a hardware structure diagram of an electronic device of an embodiment of the present application. The electronic device may include a processor 501 and a memory 502 storing computer program instructions. When the processor 501 executes the computer program instructions, it implements the process or function of any of the above-mentioned embodiment methods.

[0125] Specifically, the processor 501 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application. The memory 502 may include a large-capacity memory for data or instructions. For example, the memory 502 may be at least one of the following: a hard disk drive (HDD), a read-only memory (ROM), a random access memory (RAM), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, a universal serial bus (USB) drive, or other physical / tangible memory storage devices. For another example, the memory 502 may include a removable or non-removable (or fixed) medium. For another example, the memory 502 may be inside or outside the integrated gateway disaster recovery device. The memory 502 may be a non-volatile solid-state memory. In other words, the memory 502 generally includes a tangible (non-transitory) computer-readable storage medium (such as a memory device) encoded with computer-executable instructions, and when the software is executed (such as by one or more processors), the operations described in the method of the embodiments of the present application may be performed. The processor 501 implements the process or function of any method in the above embodiments by reading and executing the computer program instructions stored in the memory 502 .

[0126] In one example, Figure 5 The electronic device shown may also include a communication interface 503 and a bus 510. Among them, the processor 501, the memory 502, and the communication interface 503 are connected through the bus 510 and complete the communication between each other. The communication interface 503 is mainly used to realize the communication between each module, device, unit and / or device in the embodiment of the present application. The bus 510 includes hardware, software or both, and can couple the components of the online data traffic billing device to each other. For example, the bus may include at least one of the following: an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-end bus (FSB), a hypertransport (HT) interconnect, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnect, a low pin count (LPC) bus, a memory bus, a micro channel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable buses. The bus 510 may include one or more buses. Although the embodiments of the present application describe or illustrate a specific bus, the embodiments of the present application may consider any suitable bus or interconnection method.

[0127] In combination with the method in the above embodiments, an embodiment of the present application also provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the process or function of any method in the above embodiments is implemented.

[0128] In addition, an embodiment of the present application further provides a computer program product, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the process or function of any one of the methods in the above embodiments is implemented.

[0129] The above exemplarily describes the flowcharts and / or block diagrams of the methods, devices, systems and computer program products of the embodiments of the present application, and describes the relevant various aspects. It should be understood that each box or combination thereof in the flowchart and / or block diagram can be implemented by computer program instructions, or by dedicated hardware that performs a specified function or action, or by a combination of dedicated hardware and computer instructions. For example, these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to form a machine that enables these instructions executed by such a processor to enable the implementation of the functions / actions specified in each box or combination thereof in the flowchart and / or block diagram. Such a processor can be a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.

[0130] The functional blocks shown in the structured block diagram of the embodiment of the present application can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc.; when implemented in software, it is a program or code segment used to perform the required task. The program or code segment can be stored in a memory, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0131] It should be noted that the present application is not limited to the specific configurations and processes described above or shown in the figures. The above is only a specific implementation mode of the present application. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the described system, device, module or unit can refer to the corresponding process in the method embodiment without further description. It should be understood that the scope of protection of the present application is not limited to this. Any technician familiar with the technical field can think of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and these modifications or substitutions should be included in the scope of protection of the present application.

Claims

1. A control method for a lightweight function switch based on a grayscale release mechanism, characterized in that: Applied to a terminal device, the method comprises: After logging into the target client, obtaining configuration information of each of the multiple function switches of the target client from the first server, wherein the configuration information includes a blacklist, a whitelist, and a grayscale release range; When accessing a target scene of a target client, determining a first target function switch corresponding to the target scene based on a correspondence between the scene and the function switch, wherein the first target function switch is used to enable or disable a first target function in the target client; Based on a multi-level grayscale release mechanism, it is determined whether a target user of the terminal device is allowed to use the first target function; if the user identifier of the target user is in the blacklist of the first target function switch, the first target function switch is turned off and the target user is not allowed to use the first target function; if the user identifier of the target user is in the whitelist of the first target function switch, the first target function switch is turned on and the target user is allowed to use the first target function; If the user identifier of the target user is neither in the blacklist nor in the whitelist of the first target function switch, the user identifier is converted into a number, and the converted number is modulo-ed to obtain a modulo result; if the modulo result is within the grayscale release range of the first target function switch, the first target function switch is turned on to allow the target user to use the first target function; otherwise, the first target function switch is turned off and the target user is not allowed to use the first target function.

2. The method according to claim 1, characterized in that The user ID is converted into a number, and the converted number is modulo-calculated to obtain the modulo-calculated result, including: Convert the user ID into a decimal encoding value; Calculate the remainder of dividing the encoded value by the preset modulus value to obtain the modulus result; Among them, the grayscale release range of the first target function switch includes at least one grayscale limit value. If the modulo result is equal to the grayscale limit value, the modulo result is within the grayscale release range of the first target function switch; if the modulo result is not equal to the grayscale limit value, the modulo result is not within the grayscale release range of the first target function switch.

3. The method according to claim 2, characterized in that The user ID is a string containing n characters; Convert the user ID to a decimal encoding value, including: For n characters, set the character index of each character in order from right to left; Convert each character into a decimal subcode value; The sub-coding value of n characters and the cumulative sum of the weights of n characters are calculated to obtain the encoding value, wherein the weight of the i-th character is the product of the character index of the i-th character and a preset step length, 0≤i≤n-1, and i and n are both integers.

4. The method according to claim 1, characterized in that: The method further comprises: Open the function switch configuration visualization page; In response to the operator's input on the function switch configuration visualization page, the function switch to be modified is selected, and the configuration information of the function switch stored in the first server and / or the terminal device is synchronously updated.

5. The method according to claim 1, characterized in that The configuration information of the plurality of function switches is stored in a configuration file of the first server and / or the terminal device, or in a database associated with the first server, in a target format; wherein the target format includes a script object notation format, an extensible markup language format, or another markup language format; The terminal device obtains or adjusts the configuration information of the function switch in the first server through the application programming interface provided by the first server.

6. The method according to claim 1, characterized in that The configuration information also includes whether it is set to be globally enabled, and the method further includes: If the first target function switch is set to be globally enabled, the first target function switch is enabled to allow the target user to use the first target function.

7. The method according to claim 1, characterized in that The user identification includes a unique user identifier, a universal unique identifier, an identity token or a session identifier.

8. A control method for a lightweight function switch based on a grayscale release mechanism, characterized in that: Applied to a second server, the second server being used to execute at least one function in a target client, the method comprising: In response to the user identification sent by the terminal device and the request to execute the second target function in the target client, sending the user identification and the second target function identification to the first server; The first server stores configuration information of a second target function switch, the second target function switch is used to enable or disable the second target function, the configuration information includes a blacklist, a whitelist and a grayscale release range, and the first server is used to determine whether the second server is allowed to execute the second target function based on a multi-level grayscale release mechanism; wherein, if the user identifier is in the blacklist of the second target function switch, an instruction to turn off the second target function switch is sent to the second server; if the user identifier is in the whitelist of the second target function switch, an instruction to turn on the second target function switch is sent to the second server; if the user identifier is neither in the blacklist of the second target function switch nor in the whitelist of the second target function switch, the user identifier is converted into a number, and the converted number is modulo-operated to obtain a modulo-operated result; if the modulo-operated result is within the grayscale release range of the second target function switch, an instruction to turn on the second target function switch is sent to the second server; When an instruction to turn on the second target function switch is received, the second target function is executed.

9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; when the electronic device executes the computer program instructions, the method for controlling a lightweight function switch based on a grayscale release mechanism as described in any one of claims 1 to 8 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement a method for controlling a lightweight function switch based on a grayscale release mechanism according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Application access method, device, server and computer storage medium

    CN108011891A

  • Gray release method and device

    CN111538529A

  • Gray scale adjustment method and device, electronic equipment and storage medium

    CN112686519A