Method and device for switching different services of double sites
By automatically detecting and switching to the corresponding site, and automatically logging in and authorizing when necessary, the problem of low business switching development between the main site and the new site in the existing technology is solved, and seamless site switching and login status interoperability is achieved.
Patent Information
- Application Number
- CN202510235324.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-06-17
AI Technical Summary
In the prior art, business switching between the main site and the new site requires manual configuration of a large number of parameters, resulting in low development efficiency.
By detecting the target page entered by the user, it will automatically enter the corresponding main site or new site according to the page function, and automatically log in when the target site is not logged in, and use the redirect link to achieve seamless jump. If the next operation is detected as a new business, it will jump from the target page to the authorization page of the main business for authorization and authentication. After success, it will jump to the new business operation page. Both login tokens are used for login and interoperability.
It realizes seamless business switching and login status interoperability between the main site and the new site, reduces the need for manual configuration parameters and improves development efficiency.
Smart Images

Figure CN120162499A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic information technology, and particularly to a method and device for switching between different services of two sites. Background Art
[0002] Due to the increasing demand for services, it may be necessary to add new services on the basis of the main service. Then, a new site needs to be developed for the new service. In this way, the main service can be accessed through the link of the original main site, and the new service can be accessed through the link of the new site. However, the new and main sites are independent of each other. The intercommunication login status needs to be manually configured with parameters when switching between the new and main sites, and accessing the new site requires authorization from the main site, and the authorization also needs to be manually configured with parameters. This results in a very large amount of service development work and low development efficiency. Summary of the Invention
[0003] This application provides a method and device for switching between different services of two sites to solve the problem of low development efficiency.
[0004] In a first aspect, this application provides a method for switching between different services of two sites, the method comprising:
[0005] After detecting that a user enters a target page through a site link, enter a corresponding target site according to the page function of the target page, where the target site is a main site or a new site, the main site is used to display the main service, and the new site is used to display the new service;
[0006] If the target site has not logged in an account, carry a redirect link and jump to the login page of the main site for account login, where the redirect link is used to jump back to the target page of the target site after successful login;
[0007] If it is detected that the next operation is a new service, jump from the target page to the authorization page of the main service for authorization determination;
[0008] After successful authorization determination, jump from the authorization page of the main service to the service operation page of the new service, where the login intercommunication is adopted by using a login token during the page jump process between the new service and the main service.
[0009] Optionally, entering a corresponding target site according to the page function of the target page includes:
[0010] According to the page function of the target page, intercept the route through a hook function and determine the service type of the page function;
[0011] If the service type is a new service and the entered site link is the link of the main site, jump from the main site to the new site;
[0012] If the service type is a new service and the entered site link is a link to a new site, stay on the new site;
[0013] If the service type is the main service, stay on the main site.
[0014] Optionally, intercepting the route through a hook function and determining the service type of the page function includes:
[0015] Use a hook function to intercept the route of the target site;
[0016] Determine the configuration information of the route file corresponding to the target site, where the configuration information is used to indicate that the main service and the new service share one route file or the main service and the new service each use their own route files;
[0017] If the configuration information is that the main service and the new service each use their own route files, determine the service type of the page function according to the route name of the target site;
[0018] If the configuration information is that the main service and the new service share one route file, determine the service type of the page function according to the set marker in the route file, where the set marker is used to distinguish different service types.
[0019] Optionally, jumping from the main site to the new site includes:
[0020] Determine the site domain name, site route, service parameters, and login token of the new site;
[0021] By concatenating the site domain name, site route, service parameters, and login token of the new site, obtain the link to the new site;
[0022] Jump from the main site to the new site according to the link to the new site.
[0023] Optionally, if it is detected that the next operation is a new service, jumping from the target page to the authorization page of the main service for authorization determination includes:
[0024] Query the destination parameter in the hook function, where the destination parameter is used to indicate the route name corresponding to the jump link of the next operation;
[0025] If the route name corresponding to the jump link is the same as the route name of the new service, determine that the next operation is a new service;
[0026] Jump from the target page to the authorization page of the main service and obtain the authorization determination.
[0027] Optionally, the process of jumping from the authorization page of the main service to the service operation page of the new service includes:
[0028] Concatenate the login token of the target site, the site link of the new site, the route to be redirected currently, and the parameters in the link of the authorization page to obtain the jump link for the new service;
[0029] Jump to the new site according to the jump link of the new service;
[0030] If the new site determines that the jump link of the new service carries a login token, cache the login token locally and jump to the service operation interface.
[0031] Optionally, after jumping from the target page to the authorization page of the main service for authorization verification, the method further includes:
[0032] If the authorization verification fails, use a preset navigation method to jump back to the authorization page of the main site, where the preset navigation method is used to return to the previous visited page according to the browsing history of the current page.
[0033] In a second aspect, the present application provides a switching device for different services on two sites, the device includes:
[0034] An entry module, configured to enter the corresponding target site according to the page function of the target page after detecting that the user enters the target page through the site link, where the target site is the main site or the new site, the main site is used to display the main service, and the new site is used to display the new service;
[0035] A login module, configured to jump to the login page of the main site to log in the account with the redirect link if the account is not logged in on the target site, where the redirect link is used to jump back to the target page of the target site after successful login;
[0036] An authorization module, configured to jump from the target page to the authorization page of the main service for authorization verification if it is detected that the next operation is a new service;
[0037] A jump module, configured to jump from the authorization page of the main service to the service operation page of the new service after successful authorization verification, where the login token is used for login intercommunication during the page jump process between the new service and the main service.
[0038] In a third aspect, the present application provides an electronic device, including: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus.
[0039] In a fourth aspect, the present application further provides a computer storage medium storing computer-executable instructions for executing the method for switching between different services of two sites according to any one of the above of the present application.
[0040] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art: after guiding the user to enter the main site or the new site that matches the page, if it is detected that the target site entered is not logged in, the account is logged in on the main site and then returned to the target site using the redirect link, realizing seamless cross-site jump. In addition, the login token is used for login interoperability between the two old and new sites during the site jump process. Moreover, the new site needs to obtain the authentication authorization of the main site before operating the service. All these tasks are automatically implemented by the system without the need for manual configuration of a large number of parameters for each site, improving the development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0043] One or more embodiments are illustrated by way of example with the pictures in the corresponding accompanying drawings. These exemplary illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements, unless otherwise stated, and the drawings in the drawings do not constitute a proportional limitation.
[0044] Figure 1 It is a schematic diagram of the switching system for different services of two sites provided by the embodiments of the present application;
[0045] Figure 2 It is a flowchart of a method for switching between different services of two sites provided by the embodiments of the present application;
[0046] Figure 3 It is an overall flowchart of a method for switching between different services of two sites provided by the embodiments of the present application;
[0047] Figure 4 It is a schematic structural diagram of a device for switching between different services of two sites provided by the embodiments of the present application;
[0048] Figure 5A schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0050] The following disclosure provides many different embodiments or examples for implementing different structures of the present application. To simplify the disclosure of the present application, components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the present application. In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplification and clarity and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0051] To solve the problem of low development efficiency mentioned in the background art, in the embodiments of the present application, seamless jump between the main site and the new site by the user is achieved, and the login status interoperability between different sites and the permission authentication of the main site are ensured, without manual parameter configuration, thereby improving the development efficiency.
[0052] The present application is applicable to scenarios that need to manage multiple business lines or provide diversified services, and the application scenarios include but are not limited to: financial services, education and training and online learning, or medical and health services, etc.
[0053] Optionally, in the embodiments of the present application, the method for switching different services between the two sites described above may be applied to a hardware environment composed of a terminal 101 and a server 103 as Figure 1 shown. As Figure 1 shown, the server 103 is connected to the terminal 101 through a network. The user clicks on a site link in the terminal and enters the corresponding site. The server includes a main site and a new site. The main site and the new site may be located on two independent servers respectively, or may be two virtual services located on one server. A database 105 may be set on the server or independently of the server to provide data storage services for the server 103. The above network includes but is not limited to: wide area network, metropolitan area network or local area network. The terminal 101 includes but is not limited to a PC, a mobile phone, a tablet computer, etc.
[0054] A method for switching different services between the two sites in the embodiments of the present application may be executed by the server 103, or may also be executed by the terminal 101.
[0055] The following will combine with specific implementation manners to provide a detailed description of a method for switching between different services of two sites. Taking the application to a server as an example, as Figure 2 shown, the specific steps are as follows:
[0056] Step 201: After detecting that the user enters the target page through the site link, enter the corresponding target site according to the page function of the target page. Among them, the target site is the main site or the new site. The main site is used to display the main service, and the new site is used to display the new service;
[0057] Step 202: If the account is not logged in on the target site, carry the redirect link and jump to the login page of the main site to log in to the account. Among them, the redirect link is used to jump back to the target page of the target site after successful login;
[0058] Step 203: If it is detected that the next operation is the new service, jump from the target page to the authorization page of the main service for authorization determination;
[0059] Step 204: After the authorization determination is successful, jump from the authorization page of the main service to the business operation page of the new service. Among them, the login token is used for login intercommunication during the page jump process between the new service and the main service.
[0060] The following explains some terms mentioned in the embodiments of the present application, including the following content.
[0061] Main site: Refers to the website or application part that bears the main service function;
[0062] New site: An independent site used to display the new service;
[0063] Redirect link: As the key to returning to the original target page after the user logs in, it ensures the consistency and convenience of the user experience.
[0064] Login token: It is an important credential for user authentication and authorization, ensuring the security and legality of the user's operations between the two sites.
[0065] In step 201, when the user enters the system through a certain link, first, it will judge which site it belongs to according to the functional attributes of the target page, that is, whether it belongs to the main site or the new site, and open the target page on the target site it belongs to. This process is realized based on the pre-defined routing rules or setting marks (such as meta marks). The main site is mainly used to display and process the core business functions, while the new site is specifically used to carry innovative or extended services. This distinction not only helps users quickly locate the required services but also lays a foundation for subsequent security verification and permission control.
[0066] In step 202, once the target site is determined, the system checks the user's login status at that target site. If it is found that the user has not logged in, a redirect link containing the information of the current accessed page is immediately carried to jump to the login page of the main site. This redirect link is crucial because it records the target address that the user initially tried to access, enabling the user to be accurately guided back to the original page of the target site after completing the login process on the main site. This approach greatly enhances the user experience and reduces the operational complexity caused by re-navigation.
[0067] In step 203, after the user returns to the original page of the target site, if the next operation is an operation request for a new service, the system will direct the user from the current page to the authorization page of the main service for additional identity verification before execution. This step is to confirm whether the user has the permission to perform specific new service operations. The authorization page usually requires the user to provide further identity proof or consent to certain terms of use, thus adding an extra layer of security protection to prevent unauthorized actions. All interactions in this process are aimed at ensuring the security of the system and the protection of user data.
[0068] In step 204, once the authorization is successfully recognized, the system directly directs the user from the authorization page to the corresponding new service operation page. In this process, whether jumping from the main site to the new site or vice versa, the login token is relied on to maintain the user's login status and permission information. This means that no matter which site the user is on, as long as they hold a valid login credential, they can freely shuttle between various service modules and enjoy a consistent service experience. In this way, the solution not only achieves seamless cross-site jumps but also strengthens the security and flexibility of the overall architecture.
[0069] If the authorization recognition fails, a preset navigation method (such as the back method) is used to jump back to the authorization page of the main site, where the preset navigation method is used to return to the previous accessed page according to the browsing history of the current page.
[0070] Exemplarily, after the user enters the page of the site through the site link, if the function of this page is the main service, then the accessed site is the main site; if the function of this page is a new service, then this page needs to be opened on the new site. If the site has not been logged in at this time, the system will first redirect it to the login page of the main site and attach a redirect link so as to return to the original page entered through the site link after successful login. After the login is completed, if the user attempts to perform a specific new service operation, they also need to go through the authorization page of the main service to confirm the permission to ensure that the user has the right to perform the requested operation.
[0071] In this application, after guiding the user to enter the main site or the new site that matches the page, if it is detected that the target site entered is not logged in, after logging in to the account on the main site, use the redirect link to return to the target site, achieving seamless cross-site jumps. Moreover, during the site jump process, the login token is used to achieve login interoperability between the two old and new sites. In addition, the new site needs to obtain authentication authorization from the main site before operating the business. All these tasks are automatically implemented by the system without the need for manual configuration of a large number of parameters for each site, improving the development efficiency.
[0072] As an optional implementation manner, in step 201, entering the corresponding target site according to the page function of the target page includes:
[0073] Step S11: According to the page function of the target page, intercept the route through the hook function and judge the business type of the page function;
[0074] Step S12: If the business type is a new business and the site link entered is the link of the main site, then jump from the main site to the new site;
[0075] Step S13: If the business type is a new business and the site link entered is the link of the new site, then stay on the new site;
[0076] Step S14: If the business type is the main business, then stay on the main site.
[0077] The above content describes an identification and site jump mechanism, which ensures that users can seamlessly switch between sites of different business types and maintain a consistent login status and user experience.
[0078] First of all, in step S11, the system intercepts the route request through the hook function and judges its business type based on the functional attributes of the target page. This step utilizes the navigation guard function of vue-router (Vue routing), allowing developers to distinguish between the main business and the new business according to the set markers (such as the meta field) or specific routing rules. Such a design not only simplifies the processing of business logic but also provides an accurate basis for subsequent jump decisions.
[0079] Then, in step S12, if the system determines that the current business type is a new business and the user enters from the main site link, the user will be automatically redirected from the main site to the new site. This mechanism is applicable to application scenarios where multiple business services are expected to be accessed through a unified entry. It ensures that even if the user first accesses the main site, they can quickly and securely jump to the required new business platform without having to manually search for or enter the address of the new site, thus improving the operation efficiency and user experience.
[0080] For users who are already on the new site link, step S13 states that if the business type is a new business, the user should continue to stay on the new site without any additional redirection. This approach avoids unnecessary page refreshes or redirects, maintains the user's browsing continuity, reduces server load, and improves the overall performance of the system.
[0081] In step S14, when the system detects that the business type is the main business, regardless of whether the user accesses directly or jumps from other services, the user will stay on the main site. This strategy helps to centralize the management of core business processes, ensuring that users can focus on the main tasks without being distracted by irrelevant information. Additionally, it creates a clear boundary between the main business and new businesses, facilitating maintenance and expansion.
[0082] The implementation process of steps S12 to S14 includes the following:
[0083] If it is determined that the business type is a new business, the system will further check whether the site link the user entered is a link to the main site. If the user accesses from the new site, the new business can be directly opened and processed in the current new site environment without additional redirection. However, if it is detected that the user enters from the main site link, a jump operation from the main site to the new site needs to be performed to ensure that the new business can be accessed in the correct new site environment.
[0084] When the business type is identified as the main business, the system will confirm that the user enters through the main site link and keep the user operating within the main site to ensure the normal operation of the main business function. This mechanism ensures that both the main business and new businesses can efficiently and securely perform corresponding operations in the correct site environment.
[0085] In addition, after the user enters the corresponding site, the system will also determine the login status. For example, when the user attempts to access the main business through the main site, the system will check the login status of the main site; similarly, when the user tries to access the new business through the new site, the system will verify the login situation of the new site.
[0086] This application accurately identifies the business type to ensure that each business request can be correctly processed and displayed in a site environment that matches its business type. This accurate business type identification can guarantee the integrity and correctness of the business page display.
[0087] As an alternative implementation, in step S11, intercepting the route through a hook function and determining the business type of the page function includes the following:
[0088] Step S21: Use a hook function to intercept the route of the target site;
[0089] Step S22: Determine the configuration information of the routing file corresponding to the target site, where the configuration information is used to indicate that the main service and the new service share one routing file, or the main service and the new service each use their own routing file;
[0090] Step S23: If the configuration information is that the main service and the new service each use their own routing file, determine the business type of the page function according to the routing name of the target site;
[0091] Step S24: If the configuration information is that the main service and the new service share one routing file, determine the business type of the page function according to the setting flag in the routing file, where the setting flag is used to distinguish different business types.
[0092] In step S111, the system uses the hook function beforeEach to intercept the routing request of the target site. This process is the basis of the whole mechanism. By intercepting the routing request, the system can obtain the specific page information that the user tries to access and provide the necessary data support for further business type identification and processing. The use of the hook function not only makes the routing interception flexible and efficient, but also ensures the consistent and accurate processing of different routing requests.
[0093] Next, in step S112, the system needs to determine the configuration information of the routing file corresponding to the target site. This step is crucial because it determines how to identify the business type subsequently. Specifically, the configuration information will indicate whether the main service and the new service share one routing file or each have their own independent routing file. This design provides great flexibility and allows the most suitable routing management method to be selected according to actual needs, thereby optimizing the overall performance and user experience of the system.
[0094] If the configuration information shows that the main service and the new service each use their own routing file (step S113), then the system will determine the business type of the page function according to the routing name of the target site. This method is direct and efficient because the routing name of each business type usually has clear identification, and the business type can be determined quickly and accurately. This way not only simplifies the routing management and business logic processing, but also improves the maintainability and scalability of the system.
[0095] On the other hand, if the configuration information is that the main service and the new service share one routing file (step S114), the system will determine the business type of the page function according to the setting flag (such as the meta flag) in the routing file. These setting flags are used to distinguish different business types, and they can be specific metadata, tags or attributes, ensuring that different business types can be accurately distinguished even within the same routing file.
[0096] In this application, by allowing the primary service and the new service to choose to share or use independent routing files, the system can better adapt to different business scenarios and changing requirements. When the primary service and the new service each use their own routing files, developers can focus more on implementing their respective business logics, reducing interference between each other. For the case of sharing a routing file, by setting markers to distinguish business types, it is also convenient for future expansion and maintenance.
[0097] As an alternative implementation, in step S11, intercepting the route through a hook function and judging the business type of the page function includes the following:
[0098] Step S31: Determine the site domain name, site route, business parameters, and login token of the new site;
[0099] Step S32: Obtain the link of the new site by concatenating the site domain name, site route, business parameters, and login token of the new site;
[0100] Step S33: Jump from the main site to the new site according to the link of the new site.
[0101] In step S31, the system first needs to determine the key information of the new site, including the site domain name, site route, business parameters, and login token. These information are the basis for ensuring that users can smoothly jump from the main site to the new site and maintain correct permission and function access. Specifically:
[0102] Site domain name: It is the network address of the new site, such as newsite.example.com, which identifies the specific website that the user will access.
[0103] Site route: Specifies the specific page or function module that the user should access in the new site, such as / dashboard or / user / profile.
[0104] Business parameters: Contain data related to specific business operations, such as order ID, user ID, etc. These parameters are crucial for executing specific business logics.
[0105] Login token: This is a security token used to verify the user's login status and permissions, ensuring that only authorized users can access protected content.
[0106] Next, in step S32, the system generates a complete link by concatenating the newly determined site domain name, site route, business parameters, and login token. For example, assume the domain name of the new site is newsite.example.com, the site route is / dashboard, the business parameter is orderId=12345, and the login token is abcde12345. Then the generated complete link is https: / / newsite.example.com / dashboard?orderId=12345&token=abcde12345. This concatenation method not only ensures that all necessary information is included but also facilitates subsequent parsing and processing.
[0107] Finally, in step S33, the system performs a jump operation from the main site according to the generated new site link. This process usually involves front-end code or server-side redirection mechanisms to ensure that users can seamlessly switch from one site to another while maintaining a consistent user experience and security during this process.
[0108] This application generates a complete link automatically by concatenation and performs a jump. Users do not need to manually enter complex links or perform additional operations; using the login token as an authentication means ensures that only logged-in users with corresponding permissions can access the content of the new site, effectively preventing unauthorized access.
[0109] As an alternative implementation, in step S23, the authorization determination from the target page to the authorization page of the main business includes:
[0110] Step S41: Query the destination parameter in the hook function, where the destination parameter is used to indicate the route name corresponding to the jump link of the next operation;
[0111] Step S42: If the route name corresponding to the jump link is the same as the route name of the new business, determine that the next operation is the new business;
[0112] Step S43: Jump from the target page to the authorization page of the main business and obtain the authorization determination.
[0113] In step S41, the system first queries the destination parameter to in the hook function beforeEach. The destination parameter to is used to indicate the route name corresponding to the jump link of the next operation. Specifically, the hook function intercepts the user's route request and extracts the key information containing the next jump target from it. This information usually includes the route name, business type, and other necessary context data to ensure that the system can accurately identify the user's intention and perform corresponding operations.
[0114] Next, in step S42, the system checks whether the route name corresponding to the jump link extracted from the hook function matches the route name of the new service. If the two are the same, it indicates that the user's next operation should point to the new service. This mechanism ensures that even in a complex multi-site or multi-service environment, the system can accurately distinguish different types of business requests and guide users to the correct page or service. For example, assume the route name of the new service is / new-service, and the route name corresponding to the current user's jump link is also / new-service. Then the system will confirm that the user intends to access the new service.
[0115] Finally, in step S43, if it is determined that the next operation is the new service, the system will jump from the target page to the authorization page of the main service to obtain authorization recognition. This step is crucial because it ensures that only properly authorized users can access protected resources and services. The specific implementation method may involve redirecting to a dedicated authorization page, asking the user to provide credentials or perform secondary verification. Once the authorization is successful, the system will allow the user to continue their operation process; otherwise, an error message may be displayed or access may be denied.
[0116] By querying the destination parameter in the hook function and comparing the route names, the system of this application can accurately judge the user's next operation intention, thereby guiding the user to the correct site. This method can improve the accuracy of site navigation. In addition, the system automatically guides the user to the authorization page of the main service for authorization, ensuring that only access to the new service requires user authorization, which enhances the security of the system.
[0117] As an alternative implementation, in step S24, the jump from the authorization page of the main service to the business operation page of the new service includes:
[0118] Step S51: Concatenate the login token of the target site, the site link of the new site, the route to be currently redirected, and the parameters in the link of the authorization page to obtain the jump link for the new service;
[0119] Step S52: Redirect to the new site according to the jump link of the new service;
[0120] Step S53: If the new site determines that the jump link of the new service carries the login token, cache the login token locally and jump to the business operation interface.
[0121] In step S51, the system first concatenates the login token of the target site, the site link of the new site, the route to be jumped to currently, and the parameters in the link of the authorization page to generate a complete jump link. This process ensures that all necessary information is included in the generated URL, so that users can smoothly jump from the main site to the new site while maintaining their logged-in status and permissions. For example:
[0122] Login token: abcde12345;
[0123] Site link of the new site: https: / / newsite.example.com;
[0124] Route to be jumped to currently: / dashboard;
[0125] Parameters in the link of the authorization page: redirect_uri=https%3A%2F%2Fnewsite.example.com%2Fdashboard;
[0126] The concatenated jump link may be as follows:
[0127] https: / / newsite.example.com / dashboard?token=abcde12345&redirect_uri=https%3A%2F%2Fnewsite.example.com%2Fdashboard.
[0128] Next, in step S52, the system performs a jump operation according to the generated jump link of the new service. This is usually achieved through front-end code or a server-side redirection mechanism. After the user clicks the corresponding button or link, the browser will automatically navigate to the generated URL, thus guiding the user from the main site to the new site.
[0129] Finally, in step S53, when the user arrives at the new site, the system checks whether the jump link carries a login token. If a login token is detected, the system will cache it locally and immediately jump to the business operation interface. This mechanism not only ensures the continuity of the user's logged-in status but also simplifies the user's operation process, enabling them to access different business modules without having to log in again. For example, assuming the login token is abcde12345, the system will store it locally after verifying its validity and redirect the user to the / dashboard page.
[0130] In this application, by automatically generating and using jump links that contain all necessary parameters, users can easily switch from one site to another without manually entering complex URLs or performing additional operations. The process of automatically generating and processing jump links reduces the likelihood of human errors while improving processing speed and accuracy. The system determines the user's permissions by checking the login token in the jump link and caches the token after confirming its legitimacy to ensure that the user can access the corresponding resources within the correct permission scope.
[0131] Based on the same technical concept, this application provides a switching flowchart for different services on two sites, as Figure 3 shown, including the following steps.
[0132] Step 301: After the user enters the system through the site link, the target page is displayed.
[0133] Step 302: The system uses a hook function to intercept the route and determines whether the function of the target page is the main service. If it is not the main service, step 303 is executed; if it is the main service, it indicates that the system has entered from the main site, and step 305 is executed.
[0134] Step 303: If it is not the main service, the system further determines whether the link is an old site link. If it is not an old site link, it indicates that a new service is opened on the new site, and step 305 is executed. If it is an old site link, it indicates that a new service is opened on the old site, and step 304 is executed.
[0135] Step 304: The system jumps from the main site to the new site.
[0136] Step 305: The system determines whether the user has logged in to the current site. If logged in, step 306 is continued. If not logged in, step 307 is continued.
[0137] Step 306: After the user completes the login, the system jumps to the page corresponding to the link.
[0138] Step 307: Carry the redirect link and jump to the login page of the main service for login operation. After successful login, jump to the page of the redirect link.
[0139] Step 308: The system determines whether the next operation is a new service. If it is not a new service, the process directly ends at step 3013; if it is a secondary service, step 309 is continued.
[0140] Step 309: If it is a secondary service, the system jumps to the authorization page in the main service and carries the jump link of the secondary service.
[0141] Step 3010: On the authorization page, the system determines whether the authorization operation is successful. If the authorization operation is successful, proceed to step 3012; if the authorization operation fails, proceed to step 3011.
[0142] Step 3011: The authorization operation fails, and the system jumps back to the authorization page of the main service.
[0143] Step 3012: The authorization operation is successful, and the system jumps to the business operation page of the secondary service.
[0144] Step 3013: The system ends the entire process.
[0145] The following provides a complete example. Suppose there is an integrated service platform, which consists of a main site and a new site. The main site provides account management and basic services, while the new site focuses on specific new services such as online course booking. Users can manage their accounts, view historical orders, and book new online courses through this platform.
[0146] 1. The user enters the system through a link: The user clicks on a link in an email that points to a specific course details page on the new site (e.g., / course / 123).
[0147] 2. Determine whether the function of the current page is the main service: The system checks the attributes of the target page and finds that this is a request related to the new service (online course booking) and does not belong to the main service.
[0148] 3. Handle the jump from the old site link to the new site link: Since the user directly accesses the new service function from an external link, the system needs to ensure that the user is operating in the correct location. If the link is from the old site, the system will automatically convert it to the new site link format and prepare for redirection. In this case, since the user directly accesses the new site link, no additional processing is required.
[0149] 4. Determine whether the user is logged in: The system checks whether the user is logged in. If the user is not logged in, the system redirects the user to the login page of the main site with the redirect link (i.e., the original accessed course details page / course / 123). After the user enters their credentials and completes the login, the system brings the user back to the / course / 123 page based on the redirect link.
[0150] 5. After the user successfully logs in, jump to the corresponding link page: After successful login, the system uses the previously saved redirect link to guide the user back to the new site course details page they originally tried to access.
[0151] 6. Determine whether the next operation is a secondary business (new business): When the user decides to book the course on the course details page, this is an operation for a new business. The system recognizes that the user's next operation involves a new business.
[0152] 7. Jump to the authorization page of the main business for authorization determination: To confirm that the user has the permission to perform this operation, the system requires the user to verify their identity again. The user is redirected to the authorization page of the main business site, where the user may need to enter the password again or verify their identity in other ways.
[0153] 8. After the authorization operation is determined, jump to the operation page of the new business: Once the authorization is successful, the system allows the user to continue the booking process and redirects the user back to the course booking confirmation page of the new site.
[0154] 9. After the user completes the booking operation, return to the main business page: After the user completes the course booking, the system may prompt the user that the operation has been completed and give options for the user to choose whether to return to the main business page or other relevant pages, such as the personal center to view the order details.
[0155] Based on the same technical concept, this application provides a switching device for different businesses on two sites, as Figure 4 shown. The device includes:
[0156] An entry module 401, configured to enter the corresponding target site according to the page function of the target page after detecting that the user enters the target page through the site link, where the target site is the main site or the new site, the main site is used to display the main business, and the new site is used to display the new business;
[0157] A login module 402, configured to jump to the login page of the main site to log in with the account if the account is not logged in on the target site, where the redirect link is used to jump back to the target page of the target site after successful login;
[0158] An authorization module 403, configured to jump from the target page to the authorization page of the main business for authorization determination if it is detected that the next operation is a new business;
[0159] A jump module 404, configured to jump from the authorization page of the main business to the business operation page of the new business after successful authorization determination, where the login token is used for login intercommunication during the page jump process between the new business and the main business.
[0160] Optionally, the entry module 401 is configured to:
[0161] Intercept the route through a hook function and determine the business type of the page function according to the page function of the target page;
[0162] If the service type is a new service and the entered site link is the link of the main site, then jump from the main site to the new site;
[0163] If the service type is a new service and the entered site link is the link of the new site, then stay on the new site;
[0164] If the service type is the main service, then stay on the main site.
[0165] Optionally, the entry module 401 is used for:
[0166] Use a hook function to intercept the route of the target site;
[0167] Determine the configuration information of the routing file corresponding to the target site, where the configuration information is used to indicate that the main service and the new service share a routing file or the main service and the new service each use their own routing files;
[0168] If the configuration information is that the main service and the new service each use their own routing files, then determine the service type of the page function according to the route name of the target site;
[0169] If the configuration information is that the main service and the new service share a routing file, then determine the service type of the page function according to the setting flag in the routing file, where the setting flag is used to distinguish different service types.
[0170] Optionally, the entry module 401 is used for:
[0171] Determine the site domain name, site route, service parameters, and login token of the new site;
[0172] By splicing the site domain name, site route, service parameters, and login token of the new site, obtain the link of the new site;
[0173] Jump from the main site to the new site according to the link of the new site.
[0174] Optionally, the authorization module 403 is used for:
[0175] Query the destination parameter in the hook function, where the destination parameter is used to indicate the route name corresponding to the jump link of the next operation;
[0176] If the route name corresponding to the jump link is the same as the route name of the new service, then determine that the next operation is the new service;
[0177] Jump from the target page to the authorization page of the main service and obtain the authorization determination.
[0178] Optionally, the jump module 404 is used for:
[0179] Concatenate the login token of the target site, the site link of the new site, the route to be redirected currently, and the parameters in the link of the authorization page to obtain the redirect link for the new service;
[0180] Redirect to the new site according to the redirect link of the new service;
[0181] If the new site determines that the redirect link of the new service carries a login token, cache the login token locally and redirect to the service operation interface.
[0182] Optionally, the device is further configured to:
[0183] If the authorization determination fails, use a preset navigation method to redirect back to the authorization page of the main site, where the preset navigation method is used to return to the previously visited page according to the browsing history of the current page.
[0184] As Figure 5 shown, an embodiment of the present application provides an electronic device, including a processor 501, a communication interface 502, a memory 503, and a communication bus 504. Among them, the processor 501, the communication interface 502, and the memory 503 complete mutual communication through the communication bus 504.
[0185] The memory 503 is used to store computer programs.
[0186] In an embodiment of the present application, when the processor 501 executes the program stored on the memory 503, it implements the switching method for different services of dual sites provided by any of the foregoing method embodiments.
[0187] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the switching method for different services of dual sites provided by any of the foregoing method embodiments.
[0188] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0189] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0190] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. Unless the context clearly indicates otherwise, as used herein, the singular forms "a", "an", and "the" may also include the plural forms. The terms "comprising", "including", "containing", and "having" are inclusive and thus specify the presence of the stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or their combinations. The method steps, processes, and operations described herein are not to be construed as necessarily requiring them to be performed in the particular order described or illustrated, unless the order of performance is explicitly stated. It should also be understood that additional or alternative steps may be used.
[0191] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for switching different services of dual sites, characterized in that: The method comprises: After detecting that the user enters the target page through the site link, enter the corresponding target site according to the page function of the target page, wherein the target site is a main site or a new site, the main site is used to display the main business, and the new site is used to display the new business; If the target site has no account logged in, then a redirect link is carried to jump to the login page of the main site for account login, wherein the redirect link is used to jump back to the target page of the target site after successful login; If it is detected that the next operation is a new business, jump from the target page to the authorization page of the main business for authorization confirmation; After the authorization is successful, the authorization page of the main business jumps to the business operation page of the new business, wherein the login token is used for login communication during the page jump process of the new business and the main business.
2. The method according to claim 1, characterized in that Entering the corresponding target site according to the page function of the target page includes: According to the page function of the target page, the route is intercepted by a hook function and the business type of the page function is determined; If the service type is a new service and the entered site link is a link of the main site, jump from the main site to the new site; If the business type is a new business and the site link entered is a link to a new site, stay at the new site; If the service type is a primary service, the network stays at the primary site.
3. The method according to claim 2, characterized in that The business types of intercepting routes and determining the page functions through hook functions include: Adopting a hook function to intercept the route of the target site; Determine configuration information of a routing file corresponding to the target site, wherein the configuration information is used to indicate that the main service and the new service share a routing file or that the main service and the new service use their own routing files respectively; If the configuration information is that the main business and the new business use their own routing files respectively, the business type of the page function is determined according to the routing name of the target site; If the configuration information is that the main service and the new service share a routing file, the service type of the page function is determined according to the setting mark in the routing file, wherein the setting mark is used to distinguish different service types.
4. The method according to claim 2, characterized in that: Jumping from the primary site to the new site includes: Determine the site domain name, site routing, service parameters and login token of the new site; Obtain a link to the new site by concatenating the site domain name, site routing, service parameters, and login token of the new site; Jump from the main site to the new site according to the link of the new site.
5. The method according to claim 1, characterized in that If it is detected that the next operation is a new business, jumping from the target page to the authorization page of the main business for authorization identification includes: Query the destination parameter in the hook function, where the destination parameter is used to indicate the route name corresponding to the jump link of the next operation; If the routing name corresponding to the jump link is the same as the routing name of the new service, determining that the next operation is the new service; Jump from the target page to the authorization page of the main business and obtain authorization certification.
6. The method according to claim 1, characterized in that Jumping from the authorization page of the main business to the business operation page of the new business includes: Concatenate the login token of the target site, the site link of the new site, the route to be redirected, and the parameters in the link of the authorization page to obtain the redirect link of the new service; Jump to the new site according to the jump link of the new service; If the new site determines that the jump link of the new service carries a login token, the login token is cached locally and the site jumps to the service operation interface.
7. The method according to claim 1, characterized in that After jumping from the target page to the authorization page of the main business for authorization confirmation, the method further includes: If the authorization fails, a preset navigation method is used to jump back to the authorization page of the main site, wherein the preset navigation method is used to return to the last visited page according to the browsing history of the current page.
8. A switching device for different services at two sites, characterized in that: The device comprises: An entry module is used to enter a corresponding target site according to the page function of the target page after detecting that the user enters the target page through a site link, wherein the target site is a main site or a new site, the main site is used to display the main business, and the new site is used to display the new business; A login module, for carrying a redirect link to jump to the login page of the main site for account login if the target site has no logged in account, wherein the redirect link is used to jump back to the target page of the target site after successful login; The authorization module is used to jump from the target page to the authorization page of the main business for authorization confirmation if it is detected that the next operation is a new business; The jump module is used to jump from the authorization page of the main business to the business operation page of the new business after the authorization is successfully recognized, wherein the login token is used for login communication during the page jump process of the new business and the main business.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-7 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.