CN111835852B - Method for transmitting data between WEB page and FTP server and related equipment thereof - Google Patents

Method for transmitting data between WEB page and FTP server and related equipment thereof Download PDF

Info

Publication number
CN111835852B
CN111835852B CN202010687569.5A CN202010687569A CN111835852B CN 111835852 B CN111835852 B CN 111835852B CN 202010687569 A CN202010687569 A CN 202010687569A CN 111835852 B CN111835852 B CN 111835852B
Authority
CN
China
Prior art keywords
ftp
server
data
user
request
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.)
Active
Application number
CN202010687569.5A
Other languages
Chinese (zh)
Other versions
CN111835852A (en
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.)
Shenzhen Saiante Technology Service Co Ltd
Original Assignee
Shenzhen Saiante Technology Service 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 Shenzhen Saiante Technology Service Co Ltd filed Critical Shenzhen Saiante Technology Service Co Ltd
Priority to CN202010687569.5A priority Critical patent/CN111835852B/en
Publication of CN111835852A publication Critical patent/CN111835852A/en
Application granted granted Critical
Publication of CN111835852B publication Critical patent/CN111835852B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

The embodiment of the application belongs to the technical field of management, is applied to the field of intelligent government affairs, and relates to a method for transmitting data between a WEB page and an FTP server and relevant equipment thereof, wherein the method comprises the following steps: deploying a WEB server in nodeJS, and controlling a WEB page to send an ajax request to the WEB server according to the selection of a user; receiving and converting the ajax request through a WEB server to generate a request to be sent, wherein the request to be sent comprises an execution operation; acquiring and searching whether the FTP authority of the user comprises an execution operation; if yes, detecting whether the FTP or SFTP channel is established; if not, establishing an FTP or SFTP channel between the WEB server and the FTP server by root authority, and controlling the WEB server to send a request to be sent to the FTP server; and controlling the WEB server to receive the returned data sent by the FTP server and transmitting the returned data to the FTP file preview interface. The FTP authority information of the user may be stored in the blockchain node. The method and the device avoid the condition that the FTP server is down due to the fact that the number of the channels connected with the FTP server is too large.

Description

Method for transmitting data between WEB page and FTP server and related equipment thereof
Technical Field
The present application relates to the field of management technologies, and in particular, to a method for data transmission between a WEB page and an FTP server and a related device thereof.
Background
With the gradual development of computers, the interaction between information is gradually carried out through the computers when people go deep into the daily life of people. However, since various transmission modes are layered, file transmission protocols are different.
For FTP (File Transfer Protocol), when data in an FTP server is to be acquired, a corresponding FTP client needs to be downloaded and installed to complete data interaction, however, if the number of channels connected to the FTP server in the working process is too large, the FTP server is easily halted.
Disclosure of Invention
The embodiment of the application aims to provide a method for transmitting data between a WEB page and an FTP server and relevant equipment thereof, and the condition that the FTP server is down due to the fact that the number of channels connected with the FTP server is too large is avoided.
In order to solve the above technical problem, an embodiment of the present application provides a method for data transmission between a WEB page and an FTP server, which adopts the following technical solutions:
a method for transmitting data between a WEB page and an FTP server comprises the following steps:
deploying a WEB server in nodeJS, and controlling the WEB page to send an ajax request to the WEB server according to the selection of a user when the fact that the user logs in and opens the WEB page is detected, wherein the WEB page is an FTP file preview interface;
receiving the ajax request through the WEB server, converting the ajax request according to a preset format, and generating a request to be sent, wherein the request to be sent comprises an execution operation;
acquiring a preset FTP permission of a current user, searching whether the FTP permission comprises a permission for executing the execution operation, if so, detecting whether an FTP channel or an SFTP channel is established, if not, establishing the FTP channel or the SFTP channel between a WEB server and the FTP server by using root permission, and controlling the WEB server to send the request to be sent to the FTP server through the FTP channel or the SFTP channel so as to indicate the FTP server to execute the request to be sent; and
and controlling the WEB server to receive return data sent by the FTP server and transmitting the return data to the FTP file preview interface.
In order to solve the above technical problem, an embodiment of the present application further provides a device for data transmission between a WEB page and an FTP server, where the following technical solutions are adopted:
a device for data transmission between a WEB page and an FTP server comprises:
the sending module is used for deploying a WEB server in nodeJS, and controlling the WEB page to send an ajax request to the WEB server according to the selection of a user when the fact that the user logs in and opens the WEB page is detected, wherein the WEB page is an FTP file preview interface;
the conversion module is used for receiving the ajax request through the WEB server, converting the ajax request according to a preset format and generating a request to be sent, wherein the request to be sent comprises an execution operation;
the establishing module is used for acquiring the preset FTP permission of the current user, searching whether the FTP permission comprises the permission for executing the operation, if so, detecting whether an FTP channel or an SFTP channel is established, if not, establishing the FTP channel or the SFTP channel between a WEB server and the FTP server by using root permission, and controlling the WEB server to send the request to be sent to the FTP server through the FTP channel or the SFTP channel so as to indicate the FTP server to execute the request to be sent; and
and the receiving module is used for controlling the WEB server to receive the return data sent by the FTP server and transmitting the return data to the FTP file preview interface.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
a computer device comprises a memory and a processor, wherein computer readable instructions are stored in the memory, and the processor executes the computer readable instructions to realize the steps of the method for transmitting data between the WEB page and the FTP server.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
a computer readable storage medium, which stores computer readable instructions, and when the computer readable instructions are executed by a processor, the steps of the method for data transmission between a WEB page and an FTP server are implemented.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
the method has the advantages that the flow is simple, JS (Java script) language is adopted for writing, the problem that the existing FTP transmission depends on a traditional FTP client side to finish data interaction is solved, the request is sent to a WEB server through a WEB view webpage, and the WEB server transmits the request to the FTP server. The user can conveniently and better operate the file on the FTP server at any time and any place without downloading the FTP client. Traditionally, each user can create an FTP channel, waste of connection channels is solved, only one FTP channel needs to be created at present, all connections only need to complete operation through one root account number, the utilization rate of the FTP channel is improved, and the problem that the FTP server is called to crash due to the fact that the number of the FTP connections is too large in the working process is solved.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for WEB page and FTP server data transfer according to the present application;
FIG. 3 is a schematic structural diagram of an embodiment of an apparatus for data transmission between a WEB page and an FTP server according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Reference numerals: 200. a computer device; 201. a memory; 202. a processor; 203. a network interface; 300. a device for transmitting data between the WEB page and the FTP server; 301. a sending module; 302. a conversion module; 303. establishing a module; 304. and a receiving module.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the method for data transmission between the WEB page and the FTP server provided in the embodiments of the present application is generally executed by a server/terminal device, and accordingly, a device for data transmission between the WEB page and the FTP server is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continuing reference to FIG. 2, a flowchart of one embodiment of a method for WEB page data transfer with an FTP server in accordance with the present application is shown. The method for transmitting the data between the WEB page and the FTP server comprises the following steps:
s1: the method comprises the steps that a WEB server is deployed in nodeJS, and when a user is detected to log in and open a WEB page, the WEB page is controlled to send an ajax request to the WEB server according to the selection of the user, wherein the WEB page is an FTP file preview interface.
In this embodiment, a WEB page in the present application refers to a WEB page side or a WEB client side, and controls the WEB page to send an ajax request to a WEB server (WEB server), where the ajax request belongs to an asynchronous request. The selection of the user comprises operations of uploading files, downloading files, uploading files in batches, downloading files in batches, deleting files in batches, creating folders or renaming folders and the like, and a corresponding ajax request is generated according to the selection of the user. nodeJS is a JavaScript runtime environment based on Chrome V8 engine. An FTP Server (File Transfer Protocol Server) is a computer that provides files and access services on the internet. FTP is File transfer protocol (File transfer protocol), a protocol specifically used to transfer files. The server supporting the FTP protocol is an FTP server.
In this embodiment, an electronic device (for example, the server/terminal device shown in fig. 1) on which the method for data transmission between a WEB page and an FTP server operates may control the WEB page to send an ajax request to the WEB server through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
S2: and receiving the ajax request through the WEB server, converting the ajax request according to a preset format, and generating a request to be sent, wherein the request to be sent comprises an execution operation.
In this embodiment, the ajax request received by the WEB server is a request sent by a WEB client/a WEB page, where the ajax request carries a request packet, and the request packet is converted into a packet conforming to the FTP protocol, specifically, according to a preset mapping relationship, a field in the request packet is converted and then filled into a preset template conforming to the FTP protocol, so as to complete conversion from the ajax request to the request to be sent. The ajax request comprises a request type (get/post), wherein the get represents a request message, and the post represents a return message. The ajax request also includes the url of the request and the execution operation, etc. For example, the code is represented as: ajax ({ type: "GET", url: "; }). For example: and if the execution operation in the request message is downloading the file, converting the downloading file into a Download conforming to the FTP protocol, and filling the Download into a preset template conforming to the FTP protocol. And filling the url in the request message into the position corresponding to the url in the preset template conforming to the FTP protocol to generate a request to be sent.
Specifically, in step S2, that is, the step of receiving the ajax request through the WEB server and converting the ajax request according to a preset format to generate a request to be sent includes:
receiving the ajax request through the WEB server;
detecting the current user state;
if the user state is not expired, converting the ajax request according to a preset format to generate a request to be sent;
and if the user state is overdue, returning to a login page, and displaying that the user state is overdue or the FTP permission does not exist on the login page.
In this embodiment, the current user status is detected by the WEB server. Before the ajax request conversion is carried out, the login state of the user is confirmed, so that meaningless operation is avoided, and meanwhile, the data security is improved.
In step S1, that is, when it is detected that the user logs in and opens the WEB page, the step of controlling the WEB page to send the ajax request to the WEB server according to the selection of the user includes:
when the user login is detected, randomly generating a token;
when the time length of a user for logging in the system exceeds the preset time length, taking the token of the user off the line so as to enable the token to be in a non-logging state;
when detecting that a user opens a WEB page, controlling the WEB page to send an ajax request to the WEB server according to the selection of the user, wherein the ajax request carries the token;
the step of detecting the current user state comprises:
checking whether the token is a login state;
if the token is in the logged-in state, judging that the user state is not expired;
and if the token is in the unregistered state, judging that the user state is overdue.
In this embodiment, token is a token (temporary) in computer identity authentication, and is a string of character strings generated by the server, which is used as an identifier for the client to request. Be provided with predetermined length of time in this application, if the time behind the user login system exceeds predetermined length of time, then will token rolls off the production line, and the user need log in the system again, has increased the security of data, prevents that the user from logging in the back and continuing online, and other people maliciously operate during this period. And meanwhile, the load pressure of the system is released, and the concurrency is reduced.
S3: acquiring a preset FTP permission of a current user, searching whether the FTP permission comprises a permission for executing the operation, if so, detecting whether an FTP channel or an SFTP channel is established, if not, establishing the FTP channel or the SFTP channel between a WEB server and the FTP server by using root permission, and controlling the WEB server to send the request to be sent to the FTP server through the FTP channel or the SFTP channel so as to indicate the FTP server to execute the request to be sent.
In this embodiment, if the FTP authority does not have the authority to execute the operation, returning an unauthorized message to the FTP file preview interface; and if the FTP channel or the SFTP channel is established, directly controlling the WEB server to transmit the request to be transmitted to the FTP server through the FTP channel or the SFTP channel. The code to create the SFTP channel is: connect (options). then (). The SFTP channel is an encryption type FTP channel. The execution operation comprises file uploading, file downloading, file batch uploading, file batch downloading, file deletion, file batch deletion, folder creation, folder renaming and the like. The FTP authority comprises the authority for uploading files, the authority for downloading files, the authority for uploading files in batches, the authority for downloading files in batches, the authority for deleting files in batches, the authority for creating folders, the authority for renaming folders and the like. And configuring at least one item of addition, deletion, viewing and modification or 0 item as FTP permission by the user according to actual requirements in advance. root rights, also called root rights, are higher than administeror rights, root is a super Administrator user account in Linux and unix systems that has a high to high degree of rights in the overall system that all objects he can operate. Obtaining root rights means that the highest rights of the system have been obtained, and all operations of addition, deletion, modification and check can be performed on any file in the system (including system files). In the prior art, a channel is established for each user through an FTP client, and if the user is not used, the channel is idle, so that resources are wasted. All channels are created by using root rights, so that resource waste caused by creating a plurality of FTP channels is reduced. Only one channel needs to be established, each user can use the root authority FTP channel, and an FTP channel does not need to be established for each user. After the channel is established, a user operation request is executed, and the request is sent to the corresponding FTP server, so that data interaction is completed, the utilization rate of the FTP channel is improved, and the problem that the FTP server is called to crash due to the fact that the number of connections of the FTP in the working process is too large is solved.
Specifically, in step S3, if yes, the step of detecting whether the FTP channel or the SFTP channel is created includes:
if yes, checking the authority level corresponding to the user, and searching the level corresponding to the execution operation in a preset table;
comparing the permission level with the level corresponding to the execution operation;
and if the execution operation level is not higher than the authority level of the user, detecting whether an FTP channel or an SFTP channel is established.
In this embodiment, it is determined whether the FTP authority of the current user includes the authority to execute the execution operation, if yes, the authority level corresponding to the user is checked, the level corresponding to the execution operation is searched in a preset table, if the level corresponding to the execution operation is not higher than the authority level of the user, it is detected whether an FTP channel or an SFTP channel is created, if the level corresponding to the execution operation is higher than the authority level of the user, it is returned to a front-end page, and an operation failure with insufficient level is displayed. For example, the following steps are carried out: the FTP authority of a certain user comprises the authority for uploading files and the authority for renaming folders, the authority level corresponding to the user is C level, the execution operation requested by the user is uploading files, and the level corresponding to the uploading files is A level; and confirming that the FTP authority of the current user already comprises the authority for uploading the file, and further comparing the corresponding grade of the uploaded file with the authority grade of the user, wherein the grade of the uploaded file is grade A and is higher than the C-grade authority grade of the user, so that a prompt of insufficient grade is returned. The strictness of the control of the execution operation is effectively increased, and the safety of information protection is increased. It should be noted that, in the embodiments of the present application, the embodiment that may or may not include the comparison authority level and the level corresponding to the execution operation may be selected according to actual needs.
In addition, the ajax request carries a token of the current user, where the token is randomly generated when the user logs in, and in step S3, that is, the step of obtaining the preset FTP authority of the current user includes:
verifying the identity of the user through the token;
and if the verification is successful, acquiring the preset FTP permission of the current user.
In this embodiment, the ajax request carries a request packet, and the request packet includes a token of the current user; and returning if the verification fails. Token is also used for identity authentication, and after the authentication is passed, the identity is proved not to be stolen, the login user is proved to be the employee of the company, and further the user is proved to have the user authority, and then the returned data can be transmitted to the FTP file preview interface in the subsequent steps.
The ajax request also carries a user name, and the step of verifying the identity of the user through the token comprises the following steps:
acquiring a token and a user name of a user through the WEB server;
sending the token and the user name of the user to a pre-deployed authority center, wherein the authority center is deployed in nodeJS and is connected with the WEB server;
controlling the authority center to verify the identity of the user through the token;
if the verification is successful, the step of obtaining the preset FTP permission of the current user comprises the following steps:
and if the verification is successful, acquiring a preset FTP permission according to the user name.
In this embodiment, the request message carried by the Ajax request further includes a user name. The user name and the FTP authority have one-to-one or one-to-many mapping relation; the authority is controlled by the authority center. According to the method and the device, token verification and FTP permission are separated, the independent management of FTP user permission is avoided, the management problem is brought, the computer disorder is prevented, and the data security performance is improved. The authority verification is handed to a third-party certification authority (authority center), so that the user can control the authority more accurately, the burden of the WEB server is reduced, and the response and transmission speed of the WEB server are increased.
It should be mentioned that the above-mentioned specific verification process of another embodiment regarding checking the level of the FTP authority corresponding to the user may also be transmitted to the authority center for verification, and in addition, the following specific verification process of the data authority in the present application may also be transmitted to the authority center for verification according to actual needs.
S4: and controlling a WEB server to receive return data sent by the FTP server and transmitting the return data to the FTP file preview interface.
In this embodiment, the returned data is a return packet, for example: when the execution operation is to delete the file, the data is successfully deleted after the data is returned. When the execution operation is downloading a file, the returned data is the downloaded data. The data processing process of the WEB server and the data interaction process between the WEB server and the FTP server are recorded through the log, and the log record is stored in a database connected with the WEB server, so that the log record can be conveniently traced and checked later.
Specifically, in step S4, that is, the step of controlling the WEB server to receive the returned data sent by the FTP server and transmit the returned data to the FTP file preview interface includes:
controlling a WEB server to receive return data sent by the FTP server;
detecting whether the current execution operation is downloading;
if the current execution operation is downloading, filtering the returned data to generate downloaded data;
and transmitting the downloaded data to the FTP file preview interface.
In this embodiment, since the FTP channel or the SFTP channel is established through root, all data in the FTP server can be obtained. Therefore, after the returned data is received, the data needs to be filtered, and only the data meeting the requirements is returned to the FTP file preview interface. The returned data with the content being deleted successfully does not need to be filtered. But filtering is required for the downloaded data. The FTP authority is only used for controlling whether the user has the authority of uploading files, downloading files, uploading files in batches, downloading files in batches, deleting files in batches, creating folders or renaming folders. But not the specific data downloaded by the user. Therefore, when the return data is received, the return data needs to be filtered.
The method further comprises the steps of recording the returned data through the log before and after the returned data are filtered, and storing the log record into a database connected with the WEB server so as to check the returned condition through the log record at a later period.
Wherein, the ajax request carries a user name, the step of filtering the return data and generating download data comprises:
extracting the user name in the ajax request;
acquiring preset data authority according to the user name, wherein the user name and the data authority are in one-to-one or one-to-many mapping relation;
acquiring a file name bound with the data authority in advance;
determining whether the returned data contains a file comprising the file name;
if so, taking the data in the file as download data;
and if not, intercepting the returned data.
In this embodiment, after the returned data is obtained, the data is filtered according to the data authority. Transmission of non-compliant backhaul data to the user is prevented.
In addition, in step S3, the step of controlling the WEB server to transmit the request to be sent to an FTP server through an FTP channel or an SFTP channel includes:
controlling the WEB server to transmit the request to be sent to an FTP server through an FTP channel or an SFTP channel, acquiring a data file list from the FTP server, and returning and displaying the data file list to the FTP file preview interface;
in step S4, the step of transmitting the return data to the FTP file preview interface includes:
and transmitting the returned data to the FTP file preview interface, acquiring a data file list from the FTP server, and returning and displaying the data file list to the FTP file preview interface.
In this embodiment, when the execution operation of the user is to upload files, upload files in batches, delete files in batches, create folders, or rename folders, after the execution is successful, the data file list in the FTP server changes, a new data file list is obtained again at this time, and the data file list is returned to and displayed on the FTP file preview interface, so that the user can know whether the execution is successful or not. Rather than determining whether the execution was successful based solely on the backtransmission data.
Before and after the FTP server executes the request, the request is respectively returned to a data file list (list) in the FTP server of the user, so that the user can conveniently check and confirm the file list. For example: if the user requests to delete the file A, the file A should exist in the data file list before the FTP server executes the request, and the file A in the data file list should be deleted but should not exist after the FTP server executes the request. If the file A still exists at the moment and the FTP server returns returned data which is successfully deleted, the user can know that the file A is not deleted in time through the returned data file list, and the problem that the user can only know the execution condition through the returned data and cannot know the execution condition in time when the FTP server goes out of danger and is disordered is solved.
In addition, the method and the device record the selection operation of the user on the FTP file preview interface, the data display condition and other contents in a log mode. The method can also record the selection operation of the user on the FTP file preview interface, the data display condition and other contents in a DOM snapshot mode, wherein DOM snapshots can be generated according to preset time node intervals, namely, the selection operation of the user between the current time node and the previous time node on the FTP file preview interface, the data display condition and other contents are generated into one DOM snapshot to be stored, and therefore, when the subsequent tracing problem is facilitated, the specific operation content and the data display condition can be visually checked.
It should be emphasized that, in order to further ensure the privacy and security of the FTP authority information of the user, the FTP authority information can also be stored in a node of a block chain.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The method has the advantages that the flow is simple, JS (Java script) language is adopted for writing, the problem that the existing FTP transmission depends on a traditional FTP client side to finish data interaction is solved, the request is sent to a WEB server through a WEB view webpage, and the WEB server transmits the request to the FTP server. The user can conveniently and better operate the file on the FTP server at any time and any place without downloading the FTP client. Traditionally, each user can create an FTP channel, waste of connection channels is solved, only one FTP channel needs to be created at present, all connections only need to complete operation through one root account number, the utilization rate of the FTP channel is improved, and the problem that the FTP server is called to crash due to the fact that the number of the FTP connections is too large in the working process is solved.
This application can be applied to in the wisdom government affairs field to promote the construction in wisdom city.
The development of this application is based on nodeJS environment completely, abandons traditional other languages, and the pure front-end personnel of help are connected with FTP server establishment fast, realize functions such as the list acquisition of file, file upload, file deletion, authority distribution, fine and front-end integration, improve debugging speed. The system is developed under the nodeJS environment, is convenient to deploy, has low requirements on computer configuration, and is convenient to debug due to the fact that front-end personnel can well control authority.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, can include processes of the embodiments of the methods described above. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of an apparatus for data transmission between a WEB page and an FTP server, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 3, the apparatus 300 for data transmission between a WEB page and an FTP server according to this embodiment includes: a sending module 301, a converting module 302, a building module 303 and a receiving module 304. Wherein: the sending module 301 is configured to deploy a WEB server in nodeJS, and when detecting that a user logs in and opens a WEB page, control the WEB page to send an ajax request to the WEB server according to selection of the user, where the WEB page is an FTP file preview interface; the conversion module 302 is configured to receive the ajax request through the WEB server, convert the ajax request according to a preset format, and generate a request to be sent, where the request to be sent includes an execution operation; the establishing module 303 is configured to obtain a preset FTP permission of a current user, search whether the FTP permission includes a permission to execute the execution operation, if yes, detect whether an FTP channel or an SFTP channel is created, and if the FTP channel or the SFTP channel is not created, establish the FTP channel or the SFTP channel between a WEB server and the FTP server with root permission, and control the WEB server to send the request to be sent to the FTP server through the FTP channel or the SFTP channel, so as to instruct the FTP server to execute the request to be sent; and the receiving module is used for controlling the WEB server to receive the return data sent by the FTP server and transmitting the return data to the FTP file preview interface.
In this embodiment, the flow of the application is simple, and the data interaction is completed by using js (java script) language for writing, which solves the problem that the existing FTP transmission depends on the conventional FTP client. The user can conveniently and better operate the file on the FTP server at any time and any place without downloading the FTP client. Traditionally, each user can create an FTP channel, waste of connection channels is solved, only one FTP channel needs to be created at present, all connections only need to complete operation through one root account number, the utilization rate of the FTP channel is improved, and the problem that the FTP server is called to crash due to the fact that the number of the FTP connections is too large in the working process is solved.
Specifically, the conversion module 302 includes a receiving submodule, a detecting submodule, a conversion submodule, and a returning submodule, where the receiving submodule is configured to receive the ajax request through the WEB server; the detection submodule is used for detecting the current user state; the conversion module is used for converting the ajax request according to a preset format to generate a request to be sent when the user state is not expired; and the return submodule is used for returning a login page when the user state is overdue and displaying that the user state is overdue or the FTP permission does not exist on the login page.
The sending module 301 comprises a generating submodule, a downloading submodule and a sending submodule; the generation submodule is used for randomly generating a token when the login of a user is detected; the offline sub-module is used for offline a token of the user when the time length of the user for logging in the system exceeds the preset time length so as to enable the token to be in an unregistered state; the sending submodule is used for controlling the WEB page to send an ajax request to the WEB server according to the selection of a user when the WEB page is detected to be opened by the user, wherein the ajax request carries the token; the detection submodule comprises a checking unit and a judging unit; the checking unit is used for checking whether the token is in a login state; the judging unit is used for judging that the user state is not expired when the token is in the logged-in state, and judging that the user state is expired when the token is in the logged-in state.
The establishing module 303 comprises a checking sub-module, a comparing sub-module and a level sub-module, wherein the checking sub-module is used for checking the permission level corresponding to the user when the permission level is included, and searching the level corresponding to the executing operation in a preset table; the comparison submodule is used for comparing the authority level with the level corresponding to the execution operation; and the level sub-module is used for detecting whether an FTP channel or an SFTP channel is established or not when the level of the execution operation is not higher than the authority level of the user.
The ajax request carries a token of a current user, wherein the token is randomly generated when the user logs in, and the establishing module 303 further comprises a verification sub-module and an obtaining sub-module; the verification sub-module is used for verifying the identity of the user through the token; and the obtaining submodule is used for obtaining the preset FTP permission of the current user when the verification is successful.
The ajax request also carries a user name, and the verification submodule comprises an acquisition unit, a sending unit and a verification unit; the acquiring unit is used for acquiring a token and a user name of a user through the WEB server; the sending unit is used for sending the token and the user name of the user to a pre-deployed authority center, and the authority center is deployed in nodeJS and connected with the WEB server; the authentication unit is used for controlling the authority center to authenticate the identity of the user through the token; and the obtaining submodule is also used for obtaining the preset FTP permission according to the user name when the verification is successful.
The receiving module 304 comprises a control submodule, a detection operation submodule, a filtering submodule and a transmission submodule; the control submodule is used for controlling a WEB server to receive return data sent by the FTP server; the detection operation sub-module is used for detecting whether the current execution operation is downloading; the filtering submodule is used for filtering the returned data to generate downloaded data when the current execution operation is downloading; and the transmission submodule is used for transmitting the downloaded data to the FTP file preview interface.
The ajax request carries a user name, and the receiving module 304 comprises an extraction submodule, an acquisition permission submodule, an acquisition name submodule, a determination submodule, a data submodule and an interception submodule; the extraction submodule is used for extracting the user name in the ajax request; the permission obtaining sub-module is used for obtaining preset data permission according to the user name, wherein the user name and the data permission are in one-to-one or one-to-many mapping relation; the name acquisition submodule is used for acquiring a file name which is bound with the data authority in advance; the determining submodule is used for determining whether the returned data contains a file comprising the file name; the data submodule is used for taking the data in the file as the download data when the return data contains the file comprising the file name; the interception submodule is used for intercepting the returned data when the returned data does not contain the file comprising the file name.
In some optional implementation manners of this embodiment, the establishing module 303 is further configured to control the WEB server to transmit the request to be sent to an FTP server through an FTP channel or an SFTP channel, obtain a data file list from the FTP server, and return and display the data file list to the FTP file preview interface; the receiving module 304 is further configured to transmit the returned data to the FTP file preview interface, obtain a data file list from the FTP server, and return and display the data file list to the FTP file preview interface.
In some optional implementation manners of this embodiment, the apparatus 300 further includes a log module, configured to record the returned data through a log, and store the log record in a database connected to the WEB server.
The method has the advantages that the flow is simple, JS (Java script) language is adopted for writing, the problem that the existing FTP transmission depends on a traditional FTP client side to finish data interaction is solved, the request is sent to a WEB server through a WEB view webpage, and the WEB server transmits the request to the FTP server. The user can conveniently and better operate the file on the FTP server at any time and any place without downloading the FTP client. Traditionally, each user can create an FTP channel, waste of connection channels is solved, only one FTP channel needs to be created at present, all connections only need to complete operation through one root account number, the utilization rate of the FTP channel is improved, and the problem that the FTP server is called to crash due to the fact that the number of the FTP connections is too large in the working process is solved.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4, fig. 4 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 200 comprises a memory 201, a processor 202, a network interface 203 communicatively connected to each other via a system bus. It is noted that only computer device 200 having components 201 and 203 is shown, but it is understood that not all of the illustrated components are required and that more or fewer components may alternatively be implemented. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 201 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 201 may be an internal storage unit of the computer device 200, such as a hard disk or a memory of the computer device 200. In other embodiments, the memory 201 may also be an external storage device of the computer device 200, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 200. Of course, the memory 201 may also include both internal and external storage devices of the computer device 200. In this embodiment, the memory 201 is generally used for storing an operating system installed in the computer device 200 and various application software, such as computer readable instructions of a method for data transmission between a WEB page and an FTP server. Further, the memory 201 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 202 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 202 is generally operative to control overall operation of the computer device 200. In this embodiment, the processor 202 is configured to execute computer readable instructions stored in the memory 201 or process data, for example, execute computer readable instructions of a method for data transmission between the WEB page and the FTP server.
The network interface 203 may comprise a wireless network interface or a wired network interface, and the network interface 203 is generally used for establishing communication connection between the computer device 200 and other electronic devices.
In the embodiment, the utilization rate of the FTP channel is improved, and the problem that the FTP server is called to crash due to the fact that the number of the FTP channels connected in the working process is too large is solved.
The present application further provides another embodiment, which is to provide a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, which are executable by at least one processor, so as to cause the at least one processor to execute the steps of the method for data transmission between a WEB page and an FTP server as described above.
In the embodiment, the utilization rate of the FTP channel is improved, and the problem that the FTP server is called to crash due to the fact that the number of the FTP channels connected in the working process is too large is solved.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A method for transmitting data between a WEB page and an FTP server is characterized by comprising the following steps:
deploying a WEB server in nodeJS, and controlling the WEB page to send an ajax request to the WEB server according to the selection of a user when the fact that the user logs in and opens the WEB page is detected, wherein the WEB page is an FTP file preview interface;
receiving the ajax request through the WEB server, converting the ajax request according to a preset format, and generating a request to be sent, wherein the request to be sent comprises an execution operation;
acquiring a preset FTP permission of a current user, searching whether the FTP permission comprises a permission for executing the execution operation, if so, detecting whether an FTP channel or an SFTP channel is established, if not, establishing the FTP channel or the SFTP channel between a WEB server and the FTP server by using root permission, and controlling the WEB server to send the request to be sent to the FTP server through the FTP channel or the SFTP channel so as to indicate the FTP server to execute the request to be sent; and
and controlling the WEB server to receive return data sent by the FTP server and transmitting the return data to the FTP file preview interface.
2. The method according to claim 1, wherein the step of controlling the WEB server to receive the returned data from the FTP server and transmitting the returned data to the FTP file preview interface comprises:
controlling a WEB server to receive return data sent by the FTP server;
detecting whether the current execution operation is downloading;
if the current execution operation is downloading, filtering the returned data to generate downloaded data;
and transmitting the downloaded data to the FTP file preview interface.
3. The method for data transmission between a WEB page and an FTP server according to claim 2, wherein the ajax request carries a user name, and the step of filtering the returned data and generating the downloaded data comprises:
extracting the user name in the ajax request;
acquiring preset data authority according to the user name, wherein the user name and the data authority are in one-to-one or one-to-many mapping relation;
acquiring a file name bound with the data authority in advance;
determining whether the returned data contains a file comprising the file name;
if so, taking the data in the file as download data;
and if not, intercepting the returned data.
4. The method for data transmission between a WEB page and an FTP server according to claim 1, wherein the step of controlling the WEB server to transmit the request to be transmitted to the FTP server through an FTP channel or an SFTP channel comprises:
controlling the WEB server to transmit the request to be sent to an FTP server through an FTP channel or an SFTP channel, acquiring a data file list from the FTP server, and returning and displaying the data file list to the FTP file preview interface;
the step of transmitting the return data to the FTP file preview interface includes:
and transmitting the returned data to the FTP file preview interface, acquiring a data file list from the FTP server, and returning and displaying the data file list to the FTP file preview interface.
5. The method for data transmission between a WEB page and an FTP server according to any one of claims 1 to 4, wherein the ajax request carries a token and a user name of a current user, wherein the token is randomly generated when the user logs in, and the step of obtaining the preset FTP authority of the current user comprises:
extracting a token and a user name in the ajax request, and sending the token and the user name of the user to a pre-deployed authority center, wherein the authority center is deployed in nodeJS and is connected with the WEB server;
controlling the authority center to verify the identity of the user through the token;
and if the verification is successful, acquiring a preset FTP permission according to the user name.
6. The method for data transmission between a WEB page and an FTP server according to claim 1, wherein if yes, the step of detecting whether an FTP channel or an SFTP channel has been created comprises:
if yes, checking the authority level corresponding to the user, and searching the level corresponding to the execution operation in a preset table;
comparing the permission level with the level corresponding to the execution operation;
and if the execution operation level is not higher than the authority level of the user, detecting whether an FTP channel or an SFTP channel is established.
7. The method for data transmission between a WEB page and an FTP server according to claim 1, wherein the step of receiving the ajax request through the WEB server, converting the ajax request according to a preset format, and generating a request to be sent comprises:
receiving the ajax request through the WEB server;
detecting the current user state;
if the user state is not expired, converting the ajax request according to a preset format to generate a request to be sent;
and if the user state is overdue, returning to a login page, and displaying that the user state is overdue or the FTP permission does not exist on the login page.
8. A device for transmitting data between a WEB page and an FTP server is characterized by comprising:
the sending module is used for deploying a WEB server in nodeJS, and controlling the WEB page to send an ajax request to the WEB server according to the selection of a user when the fact that the user logs in and opens the WEB page is detected, wherein the WEB page is an FTP file preview interface;
the conversion module is used for receiving the ajax request through the WEB server, converting the ajax request according to a preset format and generating a request to be sent, wherein the request to be sent comprises an execution operation;
the establishing module is used for acquiring the preset FTP permission of the current user, searching whether the FTP permission comprises the permission for executing the operation, if so, detecting whether an FTP channel or an SFTP channel is established, if not, establishing the FTP channel or the SFTP channel between a WEB server and the FTP server by using root permission, and controlling the WEB server to send the request to be sent to the FTP server through the FTP channel or the SFTP channel so as to indicate the FTP server to execute the request to be sent; and
and the receiving module is used for controlling the WEB server to receive the return data sent by the FTP server and transmitting the return data to the FTP file preview interface.
9. A computer device comprising a memory and a processor, wherein the memory stores computer readable instructions, and the processor when executing the computer readable instructions implements the steps of the method for data transmission between a WEB page and an FTP server according to any one of claims 1 to 7.
10. A computer readable storage medium, wherein computer readable instructions are stored on the computer readable storage medium, and when executed by a processor, the computer readable instructions implement the steps of the method for data transmission between the WEB page and the FTP server according to any one of claims 1 to 7.
CN202010687569.5A 2020-07-16 2020-07-16 Method for transmitting data between WEB page and FTP server and related equipment thereof Active CN111835852B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010687569.5A CN111835852B (en) 2020-07-16 2020-07-16 Method for transmitting data between WEB page and FTP server and related equipment thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010687569.5A CN111835852B (en) 2020-07-16 2020-07-16 Method for transmitting data between WEB page and FTP server and related equipment thereof

Publications (2)

Publication Number Publication Date
CN111835852A CN111835852A (en) 2020-10-27
CN111835852B true CN111835852B (en) 2022-04-19

Family

ID=72923304

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010687569.5A Active CN111835852B (en) 2020-07-16 2020-07-16 Method for transmitting data between WEB page and FTP server and related equipment thereof

Country Status (1)

Country Link
CN (1) CN111835852B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7467211B1 (en) * 1999-10-18 2008-12-16 Cisco Technology Inc. Remote computer system management through an FTP internet connection
CN105100230A (en) * 2015-07-09 2015-11-25 无锡天脉聚源传媒科技有限公司 File transmission method and device
CN109861973A (en) * 2018-12-21 2019-06-07 北京天融信网络安全技术有限公司 Information transferring method, device, electronic equipment and computer-readable medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567893A (en) * 2009-05-26 2009-10-28 中兴通讯股份有限公司 Method and system for uploading files in WEB application

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7467211B1 (en) * 1999-10-18 2008-12-16 Cisco Technology Inc. Remote computer system management through an FTP internet connection
CN105100230A (en) * 2015-07-09 2015-11-25 无锡天脉聚源传媒科技有限公司 File transmission method and device
CN109861973A (en) * 2018-12-21 2019-06-07 北京天融信网络安全技术有限公司 Information transferring method, device, electronic equipment and computer-readable medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Linux 使用root用户FTP上传;ntc10095;《CSDN》;20160721;第1,2页 *
信息系统管理平台安全问题与对策分析;潘威华;《江苏科技信息》;20150910;第1-4页 *

Also Published As

Publication number Publication date
CN111835852A (en) 2020-10-27

Similar Documents

Publication Publication Date Title
US20220276910A1 (en) Dynamically integrating a client application with third-party services
CN103023875B (en) A kind of account management system and method
CN109040316B (en) HTTP service processing method and device
CN109936621B (en) Information security multi-page message pushing method, device, equipment and storage medium
JP2017107342A (en) Authentication cooperation system, authentication cooperation method, authorization server, application server, and program
CN106874778B (en) Intelligent terminal file acquisition and data recovery system and method based on android system
CN103780700A (en) Application system and method for achieving compatibility and sharing among multi-source heterogeneous systems
WO2022095518A1 (en) Automatic interface test method and apparatus, and computer device and storage medium
US20190097811A1 (en) Open, secure electronic signature system and associated method
CN111382985A (en) To-do message integrated pushing system and working method
KR101357135B1 (en) Apparatus for Collecting Log Information
WO2017174013A1 (en) Data storage management method and apparatus, and data storage system
CN111680477A (en) Method and device for exporting spreadsheet file, computer equipment and storage medium
US9332405B2 (en) Short message backup method, mobile terminal, and server
KR20170041523A (en) Method for providing scraping service, server and system thereof
US20150058935A1 (en) Out-of-Path, Content-Addressed Writes with Untrusted Clients
CN114996675A (en) Data query method and device, computer equipment and storage medium
CN108418797B (en) Webpage access method and device, computer equipment and storage medium
US20170235924A1 (en) System and Network for Controlling Content and Accessibility
CN112579929B (en) Method and device for constructing visual blockchain browser page
CN111222153B (en) Application program authority management method and device and storage medium
CN113064562A (en) Man-machine interaction printing method and system based on block chain
CN111835852B (en) Method for transmitting data between WEB page and FTP server and related equipment thereof
CN112860662A (en) Data blood relationship establishing method and device, computer equipment and storage medium
CN111797297A (en) Page data processing method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210220

Address after: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant after: Shenzhen saiante Technology Service Co.,Ltd.

Address before: 1-34 / F, Qianhai free trade building, 3048 Xinghai Avenue, Mawan, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong 518000

Applicant before: Ping An International Smart City Technology Co.,Ltd.

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant