CN117743717A - Method and device for dynamically loading different static resources according to domain name mapping - Google Patents

Method and device for dynamically loading different static resources according to domain name mapping Download PDF

Info

Publication number
CN117743717A
CN117743717A CN202311751478.3A CN202311751478A CN117743717A CN 117743717 A CN117743717 A CN 117743717A CN 202311751478 A CN202311751478 A CN 202311751478A CN 117743717 A CN117743717 A CN 117743717A
Authority
CN
China
Prior art keywords
domain name
static
static resource
server
resources
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311751478.3A
Other languages
Chinese (zh)
Inventor
陈浩得
钟和旭
万彦鹏
何奎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Lubangtong Intelligent Technology Co ltd
Original Assignee
Guangzhou Lubangtong Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Lubangtong Intelligent Technology Co ltd filed Critical Guangzhou Lubangtong Intelligent Technology Co ltd
Priority to CN202311751478.3A priority Critical patent/CN117743717A/en
Publication of CN117743717A publication Critical patent/CN117743717A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of computers, and discloses a method for dynamically loading different static resources according to domain name mapping, which comprises the following steps: step 1: registering a corresponding domain name for each agent and setting a corresponding static resource; step 2: setting a server as a static resource database; setting corresponding file paths for different static resources and storing the file paths in a server; step 3: setting a static resource database mapping table, and pairing domain names, static resources and file paths; step 4: and analyzing and acquiring the domain name according to the request path, acquiring the static resource corresponding to the domain name from the server according to the static resource database mapping table, and loading the static resource. An apparatus for implementing the method is also provided. The method maintains and stores the static resource file of each agent in one service node, dynamically obtains the configuration of the static resource file by requesting the domain name, realizes personalized customization, and is convenient for unified management and maintenance.

Description

Method and device for dynamically loading different static resources according to domain name mapping
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for dynamically loading different static resources according to domain name mapping.
Background
In the SaaS system, the system shares a set of code structure, when an agent wants to agent the SaaS system, but does not want to use static resources such as icons, fonts and the like of the company main body of the original system, and the agent wants to change the static resources such as icons and the like of the company main body of the agent into the static resources, namely, the agent customizes the company system page of the agent;
the method for realizing personalized customization of the own company system page is as follows: a set of code system is deployed, static resources such as icons, fonts and the like are changed into the agent, and the agent is customized, but as the agent increases, the scheme is completely infeasible, and huge financial resources and energy are consumed;
or deploying the personalized static resources corresponding to each agent to different service nodes, for example, three agents, then the corresponding static resources need to be deployed at three different service nodes, then each service node associates a corresponding domain name, and then dynamically routes to the corresponding service node through the domain name to load the static resources for rendering. However, as more and more agents need to be personalized, more and more static resource nodes need to be deployed, each time one agent needing to be customized is added, a corresponding service node needs to be added to deploy and maintain the static resource, so that the operation is complicated, the maintenance cost is high, and unified management cannot be performed.
CN201910850719 discloses a method and a device for processing static resources, which are used for receiving an access request sent by a terminal device, wherein the access request comprises access domain name information; determining a target cloud link corresponding to the access domain name information from a plurality of cloud links stored in advance; acquiring a target static resource from a cloud server according to the target cloud link; and sending the target static resource to the terminal equipment. The processing method adopts a cloud storage mode for storage, and because the cloud storage mode is generally provided with a plurality of backups, even if one fails, the other backups exist, so that the static resource loss caused by the failure of the server is avoided, and the reliability of acquiring the static resource is improved. However, the method acquires static resources from a plurality of servers through the back-end route, so that the maintenance workload is large, the workload of staff is increased, and the operation cost is increased.
The technical problems to be solved by the invention are as follows: how to realize the sharing of a mapping table of global domain name-static resource configuration by developers, and manage static resource files such as icons, fonts and the like of different agents in a configuration mode, so that the association relation between the domain name and the agent static resource files is established without maintaining a plurality of service nodes.
Disclosure of Invention
The main purpose of the invention is to provide a method for dynamically loading different static resources according to domain name mapping, by registering the domain name independently used for the agent, a server is arranged in a SaaS system as a static resource library, corresponding static resources are saved for each agent path, and the front end uses the domain name to acquire the corresponding static resources through a mapping table. All static resources are saved by setting a server, and the static resources are acquired in a domain name mapping mode when loading is needed, so that the static resources are convenient to maintain and uniformly manage by staff.
In order to achieve the above purpose, the technical scheme adopted in the application is as follows:
a method for dynamically loading different static resources according to domain name mapping, comprising the steps of:
step 1: registering a corresponding domain name for each agent and setting a corresponding static resource;
step 2: setting a server as a static resource database; setting corresponding file paths for different static resources and storing the file paths in a server;
step 3: setting a static resource database mapping table, and pairing domain names, static resources and file paths;
step 4: and analyzing and acquiring the domain name according to the request path, acquiring the static resource corresponding to the domain name from the server according to the static resource database mapping table, and loading the static resource.
Preferably, the static resource is an icon, a font and audio.
Preferably, the domain name is a primary domain name or a secondary domain name.
Preferably, the server is provided with an interface; the interface is used for sending the static resources corresponding to the domain name to the front end according to the static resource database mapping table.
Preferably, the step 4 specifically includes: the front end analyzes and obtains the domain name according to the request path, requests the interface of the server, obtains the static resource corresponding to the domain name from the server through the static resource database mapping table, and loads the static resource at the corresponding position.
Preferably, the step 4 further includes: if the domain name does not have a corresponding static resource, then a default static resource is used.
Preferably, the default static resources are icons, font styles and audio data that are self-contained in the system.
Preferably, in the step 1, setting the corresponding static resource specifically includes: and storing the icon, the font style and the audio data corresponding to the agent.
Meanwhile, a device for implementing any of the above methods for dynamically loading different static resources according to domain name mapping is also provided, including:
registration unit: the method comprises the steps of registering a corresponding domain name for each agent and setting a corresponding static resource;
and a storage unit: for setting a server as a static resource database; setting corresponding file paths for different static resources and storing the file paths in a server;
pairing unit: the static resource database mapping table is used for setting a static resource database mapping table and pairing domain names, static resources and file paths;
a loading unit: and the static resource database mapping table is used for analyzing and acquiring the domain name according to the request path, acquiring the static resource corresponding to the domain name from the server and loading the static resource.
Compared with the prior art, the scheme has the following beneficial effects:
according to the method for dynamically loading different static resources according to domain name mapping, in the SaaS system, a mapping table of global domain name-static resource configuration can be shared globally, static resource files of each agent are stored in a service node, different static resource storage paths are maintained for each domain name, when developers log in and load websites through introducing the solution, the front end can dynamically acquire the static resource file configuration through a domain name request server interface, the corresponding static resource files are obtained at a target service node, dynamic loading of static resource files such as icons and fonts is realized, and the problem that the static resources are stored through a plurality of servers, so that maintenance workload is large is avoided. The workload of workers is reduced, and the enterprise cost is reduced.
Drawings
Fig. 1 is a flowchart of a file system protection method of an internet of things device of embodiment 1;
fig. 2 is a block diagram of a file system protection apparatus of an internet of things device according to embodiment 2.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the implementations of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations.
Example 1
Referring to fig. 1, a method for dynamically loading different static resources according to domain name mapping is mainly applied to a SaaS system. The software operating service is (Software as a Service, saaS for short) that enables users to use cloud-based applications via internet connections. Common examples are email, calendar and office tools. It does not require the user to install the software product on his own computer or server.
The method comprises the following steps:
step 1: registering a corresponding domain name for each agent and setting a corresponding static resource; the setting of the corresponding static resources is specifically as follows: and storing the icon, the font style and the audio data corresponding to the agent.
Firstly, a unique domain name is registered for each agent, the domain names of different agents are different, and the domain name is used as the identification information of the agent, so that personalized customized static resources of the agent can be conveniently obtained. And, the agent provides personalized custom icons, font styles and audio data for storage, or designs exclusive icons, font styles and audio data for the agent for storage.
Step 2: setting a server as a static resource database; setting corresponding file paths for different static resources and storing the file paths in a server;
a server is arranged in the SaaS system to serve as a static resource database, and the server serves as a static resource database shared globally by the whole SaaS system, so that a front end can quickly acquire corresponding static resources from the server when an agent logs in to access a website. And setting the unique file path for the static resources of each agent, and storing the unique file path, so that the static resources can be conveniently obtained by using the file path subsequently.
For example: currently, there are A, B agents, for which domain names corresponding to a.com and b.com are registered, static resources such as corresponding icons, fonts and the like are stored in different file paths in a target server, and the static resources can be respectively placed under the file paths corresponding to the/opt/server/A and the/opt/server/B, so that subsequent searching and management are facilitated, and the static resources under the designated file paths can be acquired through the domain names.
Step 3: setting a static resource database mapping table, and pairing domain names, static resources and file paths;
designing a database table structure, and pairing the domain name, the static resource and the file path of each agent, wherein the pairing structure is as follows: the domain name, the corresponding icon path, the corresponding font attribute, etc. of the agent are saved by utilizing the database table. The maintenance and unified management of the staff are facilitated, and the workload of the staff is reduced.
Step 4: the front end analyzes and obtains the domain name according to the request path, requests the interface of the server, obtains the static resource corresponding to the domain name from the server through the static resource database mapping table, and loads the static resource at the corresponding position. If the domain name does not have a corresponding static resource, then a default static resource is used.
When the agent logs in to access the website, the front end firstly analyzes the request path and takes the corresponding domain name information in the request path, for example, the access path is https:// baidu.com/web, and the taken domain name information is baidu.com; then requesting a server interface, conveying the domain name to the server interface, and searching a mapping table of a static resource database by the server interface through the domain name to obtain a corresponding static resource, namely an icon path corresponding to the agent and a corresponding font attribute, and sending the corresponding static resource to the front end; after the front end receives static resource information corresponding to the domain name, loading the corresponding static resource file on a login page or other places needing to dynamically load the static resource file, thereby completing personalized customization of the agent.
And secondly, not all agents need personalized customization, when the agents do not need personalized customization, the agents log in to access the website, the front end analyzes the request path and obtains the corresponding domain name information in the request path, and if the server interface does not find the static resources corresponding to the domain name in the resource database mapping table, the static resources of the SaaS system are used, so that the requirements of different agents are met.
Preferably, the static resource is an icon, a font and audio.
Preferably, the domain name is a primary domain name or a secondary domain name.
In this embodiment, the domain name is preferably a secondary domain name, and one primary domain name may be provided with a plurality of secondary domain names. Because the primary domain name is charged and the secondary domain name is free, the agent only customizes static resources in a personalized way, the concrete essence is not changed, and the enterprise cost can be reduced by using the secondary domain name. Of course, the primary domain name can be selected according to actual requirements.
Preferably, the server is provided with an interface; the interface is used for sending the static resources corresponding to the domain name to the front end according to the static resource database mapping table.
The server interface is equivalent to a transfer station, receives the domain name resolved by the front end, searches the static resource corresponding to the domain name in the resource database mapping table, and sends the static resource to the front end.
Preferably, the default static resources are icons, font styles and audio data that are self-contained in the system.
The invention has the advantages that:
in the method, static resources are dynamically loaded in the SaaS system by a domain name mapping method, so that a server which is globally set by a plurality of agents is realized, the server stores customized static resources required by the agents, a plurality of code systems are not required to be deployed, and a large amount of manpower and material resources are avoided.
And secondly, the method only needs to operate through the front end, does not need to operate through the rear end, uses a server to store static resources, is convenient for the staff to maintain and uniformly manage, does not need to judge through a mapping table by a personalized customized agent, and directly adopts default static resources if the corresponding static resources are not found, so that the workload of the staff is reduced.
Example 2
An apparatus for implementing any of the above methods for dynamically loading different static resources according to domain name mapping, comprising:
registration unit: the method comprises the steps of registering a corresponding domain name for each agent and setting a corresponding static resource;
and a storage unit: for setting a server as a static resource database; setting corresponding file paths for different static resources and storing the file paths in a server;
pairing unit: the static resource database mapping table is used for setting a static resource database mapping table and pairing domain names, static resources and file paths;
a loading unit: and the static resource database mapping table is used for analyzing and acquiring the domain name according to the request path, acquiring the static resource corresponding to the domain name from the server and loading the static resource.
In this embodiment, the specific workflow of the present apparatus is: firstly, the agent registers the own domain name through the registration unit, the domain name can be a primary domain name or a secondary domain name, then the agent provides own static resources such as icons, font attributes, audio data and the like or requests our generation to be designed in the registration unit, and the registration unit stores the static resources in the SaaS system. Then, the storage unit sets a server for storing all the static resources, and stores the static resources stored by the registration unit in the server, and sets different storage paths for different static resources, so that the subsequent searching through the domain name is facilitated, and meanwhile confusion among different static resources is avoided. Then, the pairing unit sets a static resource database mapping table to pair the domain name, the static resource and the file path of each agent, so that the file path of the corresponding static resource is obtained according to the domain name, and the corresponding static resource is called through the file path. Finally, when the agent logs in to the loading website, the loading unit analyzes and acquires the domain name according to the request path, the loading unit sends the domain name to the server interface, the server interface searches a file path opposite to the domain name in the static resource database mapping table, then the loading unit can acquire corresponding static resources, including icons, font attributes, audio data and the like customized by the agent in a personalized way, and loads the corresponding static resource files on a login page or other places needing dynamic loading of the static resource files.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the spirit and principles of the invention, the scope of which is defined by the claims and their equivalents.

Claims (9)

1. A method for dynamically loading different static resources according to domain name mapping, comprising the steps of:
step 1: registering a corresponding domain name for each agent and setting a corresponding static resource;
step 2: setting a server as a static resource database; setting corresponding file paths for different static resources and storing the file paths in a server;
step 3: setting a static resource database mapping table, and pairing domain names, static resources and file paths;
step 4: and analyzing and acquiring the domain name according to the request path, acquiring the static resource corresponding to the domain name from the server according to the static resource database mapping table, and loading the static resource.
2. The method for dynamically loading different static resources according to domain name mapping according to claim 1, wherein the static resources are icons, fonts, and audio.
3. The method for dynamically loading different static resources according to domain name mapping of claim 1, wherein the domain name is a primary domain name or a secondary domain name.
4. The method for dynamically loading different static resources according to domain name mapping of claim 1, wherein the server is provided with an interface; the interface is used for sending the static resources corresponding to the domain name to the front end according to the static resource database mapping table.
5. The method for dynamically loading different static resources according to domain name mapping according to claim 4, wherein the step 4 is specifically: the front end analyzes and obtains the domain name according to the request path, requests the interface of the server, obtains the static resource corresponding to the domain name from the server through the static resource database mapping table, and loads the static resource at the corresponding position.
6. The method for dynamically loading different static resources according to domain name mapping according to claim 1, wherein said step 4 further comprises: if the domain name does not have a corresponding static resource, then a default static resource is used.
7. The method for dynamically loading different static resources according to domain name mapping according to claim 6, wherein the default static resources are icons, font styles and audio data that are self-contained in the system.
8. The method for dynamically loading different static resources according to domain name mapping according to claim 1, wherein in the step 1, setting the corresponding static resources specifically includes: and storing the icon, the font style and the audio data corresponding to the agent.
9. An apparatus for implementing the method for dynamically loading different static resources according to domain name mapping as claimed in any one of claims 1 to 8, comprising:
registration unit: the method comprises the steps of registering a corresponding domain name for each agent and setting a corresponding static resource;
and a storage unit: for setting a server as a static resource database; setting corresponding file paths for different static resources and storing the file paths in a server;
pairing unit: the static resource database mapping table is used for setting a static resource database mapping table and pairing domain names, static resources and file paths;
a loading unit: and the static resource database mapping table is used for analyzing and acquiring the domain name according to the request path, acquiring the static resource corresponding to the domain name from the server and loading the static resource.
CN202311751478.3A 2023-12-18 2023-12-18 Method and device for dynamically loading different static resources according to domain name mapping Pending CN117743717A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311751478.3A CN117743717A (en) 2023-12-18 2023-12-18 Method and device for dynamically loading different static resources according to domain name mapping

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311751478.3A CN117743717A (en) 2023-12-18 2023-12-18 Method and device for dynamically loading different static resources according to domain name mapping

Publications (1)

Publication Number Publication Date
CN117743717A true CN117743717A (en) 2024-03-22

Family

ID=90260369

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311751478.3A Pending CN117743717A (en) 2023-12-18 2023-12-18 Method and device for dynamically loading different static resources according to domain name mapping

Country Status (1)

Country Link
CN (1) CN117743717A (en)

Similar Documents

Publication Publication Date Title
CN112118565B (en) Multi-tenant service gray level publishing method, device, computer equipment and storage medium
CN110310034B (en) Service arrangement and business flow processing method and device applied to SaaS
CN107590001B (en) Load balancing method and device, storage medium and electronic equipment
US8069224B2 (en) Method, equipment and system for resource acquisition
US8832130B2 (en) System and method for implementing on demand cloud database
CN111460129B (en) Method, device, electronic equipment and storage medium for generating identification
US10243919B1 (en) Rule-based automation of DNS service discovery
CN111290828A (en) Dynamic routing using container orchestration services
US8856365B2 (en) Computer-implemented method, computer system and computer readable medium
CN110830374B (en) Method and device for gray level release based on SDK
US10972564B2 (en) System and method for automating actions in distributed computing
US11243921B2 (en) Database expansion system, equipment, and method of expanding database
US20110238760A1 (en) Systems and methods for identifying contacts as users of a multi-tenant database and application system
US9390156B2 (en) Distributed directory environment using clustered LDAP servers
CN113495921A (en) Routing method and device of database cluster
CN110851468A (en) Method and device for making simulation response to test request of client
CN109684093A (en) Data processing method and system
CN112015696A (en) Data access method, data relationship setting method, data access device, data relationship setting device and storage medium
CN107357557B (en) Information updating method and device
US20030115243A1 (en) Distributed process execution system and method
US20090234858A1 (en) Use Of A Single Service Application Instance For Multiple Data Center Subscribers
CN113282589A (en) Data acquisition method and device
CN111382953A (en) Dynamic process generation method and device
CN111444148A (en) Data transmission method and device based on MapReduce
CN117743717A (en) Method and device for dynamically loading different static resources according to domain name mapping

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination