H5 Native Data Upload Method, Device, Computer Equipment and Medium

Through the combination of the H5 end and the native end, the coordinated work of the storage platform and the backend is used to achieve the decoupling of data upload and business scenarios, solving the problems of redundant code and inefficient development in the existing technology, and improving development efficiency and code maintainability.

CN114996617BActive Publication Date: 2025-07-01CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210723421.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2025-07-01
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

In the prior art, data upload and business scenarios cannot be decoupled, resulting in a large amount of redundant and duplicate code, which is not easy to maintain and inefficient in development.

Method used

Receive upload instructions through the H5 end, obtain the upload object based on the native end, and send its identification information to the native end. The native end uploads the object to the storage platform based on the identification information and returns the object key information to the H5 end. The H5 end sends the object key information to the backend, and the backend obtains the upload object link from the storage platform based on the key information and returns it to the H5 end. Finally, the H5 end displays the upload object based on the link.

Benefits of technology

It realizes decoupling of data upload and business scenarios, reduces redundant code, and improves development efficiency and code maintainability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114996617B_ABST
    Figure CN114996617B_ABST
Patent Text Reader

Abstract

The embodiment of the present application belongs to the technical field of operation and maintenance process optimization, and relates to a native-based data upload method for H5, including receiving an upload instruction at the H5 side, obtaining an upload object based on the native side, and sending the identification information of the upload object to the native side; the native side obtains the corresponding upload object according to the identification information, uploads the upload object to the storage platform, and sends the object key information returned by the received storage platform to the H5 side; the H5 side sends the object key information to the backend; the backend receives the service request data carrying the object key information sent by the H5 side, obtains the link of the corresponding upload object from the storage platform according to the object key information, and returns the link to the H5 side. The present application also provides a native-based data upload device, a computer device and a medium for H5. In addition, the present application relates to blockchain technology, and the link can be stored in the blockchain. The present application realizes the decoupling of data upload and business scenarios, can avoid duplicate code, and saves time and effort.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of process optimization in operation and maintenance, and particularly to an H5 native-based data upload method, device, computer device, and medium. Background Art

[0002] For the upload scenario, there are existing technologies for both APP (Application) and H5 to achieve. However, the upload solutions implemented by each have deficiencies. H5 supports the upload of pictures and videos. However, some models do not support the function of taking pictures for upload, and the page display of the uploaded video is not friendly. In addition, H5 upload can bypass the APP file access permission, which is not conducive to the protection of personal privacy. APP can also implement picture / video upload. However, it has the problem of version update and iteration. Users must update the APP version to enjoy the corresponding functions, which is not suitable for scenarios with frequent upload modifications.

[0003] In addition, there is currently also a form of cooperation between H5 and APP native to complete the upload function. However, this upload method is still tightly coupled with the business scenario, and the interfaces and storage locations for each business upload are different, resulting in the inability to decouple the upload logic from the business scenario. Each business scenario needs to be implemented separately, which will generate a large amount of redundant and repetitive code, making the code difficult to maintain, with low development efficiency, and wasting a lot of manpower at the same time. Summary of the Invention

[0004] The purpose of the embodiments of this application is to propose an H5 native-based data upload method, device, computer device, and medium to solve the technical problems in the related art that the data upload cannot be decoupled from the business scenario, resulting in a large amount of redundant and repetitive code, difficult code maintenance, and low development efficiency.

[0005] To solve the above technical problems, the embodiments of this application provide an H5 native-based data upload method, which adopts the following technical solutions:

[0006] The H5 side receives an upload instruction, obtains an upload object based on the native side, and sends the identification information of the upload object to the native side;

[0007] The native side obtains the corresponding upload object according to the identification information, uploads the upload object to the storage platform, and sends the object key information returned by the received storage platform to the H5 side;

[0008] The H5 side sends the object key information to the backend;

[0009] The backend receives a service data request carrying object key information sent from the H5 side, obtains the link of the corresponding upload object from the storage platform according to the object key information in the service data request, and returns the link to the H5 side;

[0010] The H5 side displays the corresponding upload object based on the link.

[0011] Further, the step of obtaining the upload object based on the native side and sending the identification information of the upload object to the native side includes:

[0012] The H5 side obtains all upload objects through the native side and determines whether the selected current upload object is a video;

[0013] If the current upload object is a video, intercept the first frame image of the current upload object and send the identification information of the first frame image to the native side;

[0014] If the current upload object is not a video, send the identification information of the current upload object to the native side.

[0015] Further, the step of the native side obtaining the corresponding upload object according to the identification information and uploading the upload object to the storage platform includes:

[0016] The native side finds the corresponding upload object from the file directory according to the identification information;

[0017] Call the upload interface and transmit the upload object to the storage platform through the upload interface.

[0018] Further, the step of sending the object key information returned by the storage platform received to the H5 side includes:

[0019] The native side encapsulates the object key information into JSON data and sends the JSON data to the H5 side.

[0020] Further, before the step of obtaining the link of the corresponding upload object from the storage platform, it also includes:

[0021] The storage platform finds the link of the corresponding upload object according to the object key information;

[0022] Call the backend interface and send the link to the backend.

[0023] Further, before the step of the storage platform finding the corresponding upload object according to the object key information, it also includes:

[0024] The storage platform sends a permission authentication request to the H5 side and receives the authentication data sent by the H5 side based on the permission authentication request;

[0025] Verify the authentication data;

[0026] When the verification is passed, execute the step of the storage platform finding the link of the corresponding upload object according to the object key information;

[0027] When the verification fails, return a verification error message to the H5 side.

[0028] Further, after the step of sending the object key information returned by the storage platform received to the H5 side, the following steps are also included:

[0029] The H5 side determines whether the upload object is uploaded successfully according to the object key information;

[0030] If the upload is successful, execute the step of the H5 side sending the object key information to the backend;

[0031] If the upload is not successful, the H5 side re-receives the upload instruction.

[0032] To solve the above technical problems, an H5 native data upload device is further provided in an embodiment of the present application. The device includes an H5 side, a native side, and a backend, and adopts the following technical solutions:

[0033] The H5 side is used to receive an upload instruction, obtain an upload object based on the native side, and send the identification information of the upload object to the native side;

[0034] The native side is used to obtain the corresponding upload object according to the identification information, upload the upload object to the storage platform, and send the object key information returned by the storage platform received to the H5 side;

[0035] The H5 side is used to send the object key information to the backend;

[0036] The backend is used to receive the service request data carrying the object key information sent by the H5 side, obtain the link of the corresponding upload object from the storage platform according to the object key information, and return the link to the H5 side;

[0037] The H5 side is used to display the corresponding upload object based on the link.

[0038] To solve the above technical problems, a computer device is further provided in an embodiment of the present application, and the following technical solutions are adopted:

[0039] The computer device includes a memory and a processor. Computer-readable instructions are stored in the memory, and when the processor executes the computer-readable instructions, the steps of the above-mentioned H5 native-based data upload method are implemented.

[0040] To solve the above technical problems, an embodiment of the present application also provides a computer-readable storage medium, adopting the following technical solution:

[0041] Computer-readable instructions are stored on the computer-readable storage medium, and when the computer-readable instructions are executed by the processor, the steps of the above-mentioned H5 native-based data upload method are implemented.

[0042] Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects:

[0043] In the present application, the H5 end receives an upload instruction, obtains an upload object based on the native end, and sends the identification information of the upload object to the native end; the native end obtains the corresponding upload object according to the identification information, uploads the upload object to the storage platform, and sends the object key information received from the storage platform back to the H5 end; the H5 end sends the object key information to the backend; the backend receives the service request data carrying the object key information sent by the H5 end, obtains the link of the corresponding upload object from the storage platform according to the object key information, and returns the link to the H5 end; the H5 end displays the corresponding upload object based on the link; after the data is uploaded to the storage platform by the H5 end through the native end in the present application, the H5 end sends a service data request to the backend, and the backend can obtain the corresponding data from the storage platform for service processing and return the obtained data to the H5 end, which can decouple the work content of the H5 end, the native end, and the backend, realize the decoupling of data upload and service scenarios, and complete the process tasks of the service scenario by configuring the communication interface, which can avoid duplicate code, save time and effort, improve development efficiency, and at the same time, improve the maintainability of the code. Description of the Drawings

[0044] To more clearly illustrate the solutions in the present application, the following will briefly introduce the drawings required for the description of the embodiments of the present application. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0045] Figure 1 It is an exemplary system architecture diagram to which the present application can be applied;

[0046] Figure 2 A flowchart of an embodiment of the H5 native-based data upload method according to the present application;

[0047] Figure 3 It is a schematic structural diagram of an embodiment of an H5 native-based data upload device according to the present application;

[0048] Figure 4 It is a schematic structural diagram of an embodiment of a computer device according to the present application. Detailed implementation manners

[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs; the terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above drawings are intended to cover non-exclusive inclusion. The terms "first", "second", etc. in the specification and claims of this application or the above drawings are used to distinguish different objects and not to describe a specific order.

[0050] Referring to "embodiments" herein means that specific features, structures, or characteristics described in connection with the embodiments can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.

[0051] In order to enable those skilled in the technical field to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0052] This application provides an H5 native-based data upload method, which can be applied to a system architecture 100 as Figure 1 shown. The system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0053] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0054] The terminal devices 101, 102, and 103 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, and so on.

[0055] The server 105 can be a server that provides various services, such as a background server that supports the pages displayed on the terminal devices 101, 102, and 103.

[0056] It should be noted that the H5 native-based data upload method provided by the embodiments of the present application is generally executed by the server / terminal device. Correspondingly, the H5 native-based data upload device is generally set in the server / terminal device.

[0057] It should be understood that Figure 1 the numbers of the terminal devices, the network, and the server in

[0058] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 2 Continuing to refer to

[0059] shows a flowchart of an embodiment of the H5 native-based data upload method according to the present application, including the following steps:

[0060] Step S201, the H5 side receives an upload instruction, obtains an upload object based on the native side, and sends the identification information of the upload object to the native side.

[0061] Among them, the H5 side is generally an H5 page, and the H5 page is an abbreviation of the HTML5 page. HTML5 is a language description method for constructing web content; the native side is a third-party application program that runs based on the operating system of the terminal (such as Android, iOS, and Windows Phone) and is programmed with native code, that is, the native APP.

[0062] Specifically, the object to be uploaded can be a picture and / or a video. When the user selects a picture, the base64 of the current picture is directly returned to the H5 side. When the user selects a video, the base64 of the first-frame picture of the video is returned to the H5 side. In this way, the H5 side obtains the upload object and stores the obtained upload object in a preset file directory.

[0063] In this embodiment, when the H5 side receives the base64 of the upload object, the upload object can be displayed on the page through the received base64, enabling the user to more clearly see the selected upload object.

[0064] In some alternative implementation manners, if the upload object is a video, a play button can also be added to the first-frame picture to support the user to preview the picture and play the video.

[0065] It should be noted that base64 is an encoding format and a storage format of pictures. After the user selects the upload object, the base64 corresponding to the selected upload object is transmitted to the H5 side. Correspondingly, the H5 side obtains the upload object.

[0066] In this embodiment, after the H5 side obtains the upload object, it sends the identification information of the upload object to the native side.

[0067] The communication between the H5 side and the native side can be implemented through an SDK (Software Development Kit). An interface for selecting an upload object is defined on the SDK. The H5 side calls the selection interface, and the native side can listen for the upload instruction of the H5 side. An upload interface is also configured on the SDK. The H5 side calls this upload interface to send the identification information of the upload object to the native side. Among them, the identification information can be the ID of the upload object, which is not limited here.

[0068] Step S202: The native side obtains the corresponding upload object according to the identification information, uploads the upload object to the storage platform, and sends the object key information returned by the received storage platform to the H5 side.

[0069] In this embodiment, the native side locates the corresponding upload object according to the identification information of the upload object and uploads the upload object to the storage platform.

[0070] Specifically, the native side locates the corresponding upload object from the file directory according to the identification information sent by the H5 side, and calls the upload interface to transmit the obtained upload object to the storage platform.

[0071] In this embodiment, the H5 side uploads the selected upload object to the storage platform through the native side, which can utilize the native side file access permission to improve the security of file upload.

[0072] In this embodiment, after the native end uploads the upload object to the storage platform, the storage platform returns the object key information of the upload object to the native end. After receiving the object key information, the native end returns it to the H5 end. The H5 end determines whether the upload object is successfully uploaded according to the received object key information. If it is not successfully uploaded, it returns to step S201.

[0073] Among them, the object key information includes but is not limited to identification information, file type, file name, file size, etc.

[0074] Step S203, the H5 end sends the object key information to the backend.

[0075] In this embodiment, the H5 end calls the submission interface to send the object key information to the backend. The backend can obtain the corresponding upload object from the storage platform according to these key information to implement the business process.

[0076] Among them, the submission interface is also pre-configured on the SDK.

[0077] Step S204, the backend receives the business data request carried with the object key information sent by the H5 end, obtains the link of the corresponding upload object from the storage platform according to the object key information, and returns the link to the H5 end.

[0078] When performing business processing, the H5 end sends the business data request carried with the object key information to the backend. The backend sends the object key information in the business data request to the storage platform. The storage platform finds the link of the corresponding upload object according to the object key information, calls the backend interface, and transmits the link to the backend. The backend can obtain the target upload object according to the link.

[0079] In this embodiment, the link can be generated according to the storage address and identification information of the upload object in the storage platform. After the native end uploads to the storage platform, the corresponding link can be generated. The link can improve the efficiency and accuracy of searching.

[0080] It should be understood that all interfaces in the embodiments of the present application can be configured through the SDK.

[0081] After the backend obtains the corresponding upload object according to the business data request, it performs business logic processing and file saving operations.

[0082] It should be emphasized that to further ensure the privacy and security of the link, the above link can also be stored in a node of a blockchain.

[0083] The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer, etc.

[0084] Step S205: The H5 terminal displays the corresponding upload object based on the link.

[0085] In this embodiment, the H5 terminal can perform page rendering. The H5 terminal obtains the corresponding upload object based on the link and renders and displays the upload object on the H5 terminal.

[0086] In this application, after the H5 terminal uploads data to the storage platform through the native terminal, the H5 terminal sends a business data request to the backend. The backend can obtain the corresponding data from the storage platform for business processing and return the obtained data to the H5 terminal. The work contents of the H5 terminal, the native terminal, and the backend can be decoupled, realizing the decoupling of data upload and business scenarios. And by configuring the communication interface, the process tasks of the business scenario can be completed, which can avoid duplicate code, save time and effort, improve development efficiency, and at the same time, improve the maintainability of the code.

[0087] In some optional implementation manners of this embodiment, the above steps of obtaining the upload object based on the native terminal and sending the identification information of the upload object to the native terminal include:

[0088] The H5 terminal obtains all upload objects through the native terminal and determines whether the selected current upload object is a video;

[0089] If the current upload object is a video, intercept the first frame picture of the current upload object and send the identification information of the first frame picture to the native terminal;

[0090] If the current upload object is not a video, send the identification information of the current upload object to the native terminal.

[0091] In this embodiment, the native terminal displays all objects to be uploaded to the user on the H5 terminal. After the user selects from the objects to be uploaded, the H5 terminal obtains the upload object.

[0092] Among them, the selection interface can support taking pictures and selecting pictures / videos from the album. When the H5 side receives an upload instruction, it determines whether to take a picture. If it is taking a picture, it calls the native side's camera function to take a picture and saves it to the album. If it is not taking a picture, it opens the album, selects the upload object from the album, and determines whether the currently selected upload object is a video. If the currently selected upload object is a video, it intercepts the first frame picture of the currently selected upload object and sends the identification information of the first frame picture to the native side. The identification information of the first frame picture is also the identification information of the current video. If the currently selected upload object is not a video, that is, the currently selected is a picture, it sends the identification information of the picture to the native side.

[0093] In this embodiment, taking pictures is supported as an upload object, and pictures or videos can also be selected as upload objects, which can meet more upload scenarios and have stronger applicability.

[0094] In some optional implementation manners, the step of sending the object key information returned by the received storage platform to the H5 side includes:

[0095] The native side encapsulates the object key information into JSON data and sends the JSON data to the H5 side.

[0096] Among them, JSON (JavaScript Object Notation) is a lightweight data exchange format, and JSON data refers to the data in JSON format received by the H5 side.

[0097] JSON can have two representation structures: object (JSONObject) and array (JSONArray). Among them, an object starts with "{" curly braces and ends with "}" curly braces. The middle part is separated by key / value pairs with ",". The keyword needs to be a string, and the value can be any other data, such as: string, number, boolean, object or null.

[0098] An array starts with "[" square brackets and ends with "]" square brackets. The middle part is separated by objects with ",". An array is an ordered collection of sub-elements, and the sub-elements can adopt object and array structures. Each sub-element has an index value, that is, the subscript of the sub-element.

[0099] In this embodiment, the object key information can be encapsulated into an object structure. Specifically, a configuration file in JSON format is obtained, and the configuration name is obtained from the object key information as the key name according to the configuration file, and then the value corresponding to the name is obtained as the key value. The key name / key value (key / value) is written into a preset data structure to obtain JSON data, and the JSON data is sent to the H5 side. The H5 side parses the received JSON data to obtain the corresponding object key information.

[0100] In this embodiment, transmitting the object key information in the form of JSON data can achieve the high efficiency of data transmission. At the same time, the configuration method in JSON format is relatively flexible.

[0101] In some alternative implementation manners, after the step of sending the object key information returned by the storage platform received to the H5 side, the following steps are further included:

[0102] The H5 side determines whether the uploaded object is successfully uploaded according to the object key information;

[0103] If the upload is successful, execute the step of the H5 side sending the object key information to the backend;

[0104] If the upload is not successful, the H5 side re-receives the upload instruction.

[0105] Among them, the H5 side receives the JSON data containing the object key information, parses the JSON data. If specific object key information is obtained through parsing, it means that the upload is successful. If the upload is successful, the object key information is sent to the backend; if the object key information parsed is blank, it means that the upload fails, and a notification of upload failure is displayed to the user, and then the upload instruction is triggered again.

[0106] In this embodiment, by determining whether the upload is successful according to the returned object key information, the user can clearly know the upload result.

[0107] In some alternative implementation manners of this embodiment, before the step that the above storage platform finds the corresponding upload object according to the object key information, the following steps are further included:

[0108] The storage platform sends a permission authentication request to the H5 side and receives the authentication data sent by the H5 side based on the permission authentication request;

[0109] Verify the authentication data;

[0110] When the verification passes, execute the step that the storage platform finds the corresponding upload object according to the object key information;

[0111] When the verification fails, return a verification error message to the H5 side.

[0112] In this embodiment, the storage platform is provided with an identity recognition function and cannot be accessed randomly. Before obtaining the upload object from the storage according to the object key information in the service data request at the back end, permission authentication is required. Only after the permission authentication is passed can the upload object be obtained, which can improve the security of data acquisition and avoid data leakage.

[0113] Among them, the permission authentication can be verified through the login status. Specifically, the storage platform sends a login request (i.e., a permission authentication request) to the H5 side. The H5 side logs in according to the login request and sends the user information (i.e., the authentication data) to the storage platform. The storage platform verifies the user information. If the verification passes, the link to the corresponding upload object is found according to the object key information. If the verification fails, the verification failure information is returned to the H5 side.

[0114] In this embodiment, the storage platform can also automatically delete invalid data to ensure the storage capacity; at the same time, it also has the function of supporting all service uploads.

[0115] This application can be used in many general-purpose or special-purpose computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This application can also be practiced in a distributed computing environment, where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0116] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), etc., or a random access memory (RAM), etc.

[0117] It should be understood that although the steps in the flowchart of the accompanying drawings are sequentially shown according to the indication of the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise clearly stated in this article, there is no strict order limit for the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.

[0118] Further reference is made to Figure 3 , as an implementation of the method shown above Figure 2 , this application provides an embodiment of an H5 native-based data upload device. This device embodiment corresponds to Figure 2 the method embodiment shown, and this device can be specifically applied to various electronic devices.

[0119] As shown in Figure 3 , the H5 native-based data upload device 300 described in this embodiment includes: an H5 side, a native side, and a backend. Among them:

[0120] The H5 side is used to receive an upload instruction, obtain an upload object based on the native side, and send the identification information of the upload object to the native side;

[0121] The native side is used to obtain the corresponding upload object according to the identification information, upload the upload object to the storage platform, and send the object key information returned by the received storage platform to the H5 side;

[0122] The H5 side is used to send the object key information to the backend;

[0123] The backend is used to receive the service request data carrying the object key information sent by the H5 side, obtain the link of the corresponding upload object from the storage platform according to the object key information in the service data request, and return the link to the H5 side;

[0124] The H5 side is used to display the corresponding upload object based on the link.

[0125] It should be emphasized that to further ensure the privacy and security of the link, the above link can also be stored in a node of a blockchain.

[0126] The above H5-based native data upload device. After the H5 side uploads data to the storage platform through the native side, the H5 side sends a business data request to the backend. The backend can obtain corresponding data from the storage platform for business processing and return the obtained data to the H5 side. It can decouple the work content of the H5 side, the native side, and the backend, realize the decoupling of data upload and business scenarios, and complete the process tasks of business scenarios by configuring communication interfaces. It can avoid duplicate code, save time and effort, improve development efficiency, and at the same time, improve the maintainability of the code.

[0127] In some alternative implementation manners of this embodiment, the H5 side includes an acquisition module, a truncation module, and a first sending module, where:

[0128] The acquisition module is used to obtain all upload objects through the native side and determine whether the selected current upload object is a video;

[0129] The truncation module is used to, when the current upload object is a video, truncate the first frame image of the current upload object and send the identification information of the first frame image to the native side;

[0130] The first sending module is used to, when the current upload object is not a video, send the identification information of the current upload object to the native side.

[0131] This embodiment can meet more upload scenarios and has stronger applicability.

[0132] In this embodiment, the native side includes a search module and a transmission module, where:

[0133] The search module is used to find the corresponding upload object from the file directory according to the identification information;

[0134] The transmission module is used to call the upload interface and transmit the upload object to the storage platform through the upload interface.

[0135] In this embodiment, the H5 side uploads the selected upload object to the storage platform through the native side, and can utilize the native side file access permission to improve the security of file upload.

[0136] In this embodiment, the native side further includes a packaging module, which is used to encapsulate the object key information into JSON data and send the JSON data to the H5 side.

[0137] In this embodiment, transmitting the object key information in the form of JSON data can achieve the high efficiency of data transmission. At the same time, the configuration method of the JSON format is relatively flexible.

[0138] In some alternative implementation manners of this embodiment, the above H5-based native data upload device further includes a storage platform, which is used for:

[0139] Find the link of the corresponding upload object according to the object key information;

[0140] Call the backend interface and send the link to the backend.

[0141] In this embodiment, the link can improve the efficiency and accuracy of the search.

[0142] In this embodiment, the storage platform includes a verification module, and the verification module is used for:

[0143] Send a permission authentication request to the H5 side and receive the authentication data sent by the H5 side based on the permission authentication request;

[0144] Verify the authentication data;

[0145] When the verification passes, execute the step of the storage platform to find the link of the corresponding upload object according to the object key information;

[0146] When the verification fails, return a verification error message to the H5 side.

[0147] In this embodiment, the upload object can be obtained only after the permission authentication passes, which can improve the security of data acquisition and avoid data leakage.

[0148] In some optional implementation manners, the H5 side further includes a confirmation module, which is used for:

[0149] Determine whether the upload object is uploaded successfully according to the object key information;

[0150] If the upload is successful, execute the step of the H5 side sending the object key information to the backend;

[0151] If the upload is not successful, the H5 side re-receives the upload instruction.

[0152] In this embodiment, by determining whether the upload is successful according to the returned object key information, the user can clearly know the upload result.

[0153] To solve the above technical problems, the embodiments of the present application also provide a computer device. For details, please refer to Figure 4 , Figure 4 This is the basic structural block diagram of the computer device in this embodiment.

[0154] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are communicatively connected to each other via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure. However, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Among them, those skilled in the art of the present technology can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0155] The computer device can be a computing device such as a desktop computer, a notebook, a palm computer, and a cloud server. The computer device can interact with the user through a keyboard, a mouse, a remote control, a touchpad, or a voice control device, etc.

[0156] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disc, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit and the external storage device of the computer device 4. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the H5 native data upload method. In addition, the memory 41 can also be used to temporarily store various data that have been output or will be output.

[0157] In some embodiments, the processor 42 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the computer-readable instructions stored in the memory 41 or process data, such as running the computer-readable instructions of the H5 native data upload method.

[0158] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0159] In this embodiment, when the processor executes the computer-readable instructions stored in the memory, the steps of the H5 native data upload method in the above embodiment are implemented. After the H5 end uploads the data to the storage platform through the native end, the H5 end sends a service data request to the backend. The backend can obtain the corresponding data from the storage platform for service processing and return the obtained data to the H5 end. The work contents of the H5 end, the native end, and the backend can be decoupled, realizing the decoupling of data upload and service scenarios. Moreover, by configuring the communication interface, the process tasks of the service scenario can be completed, avoiding duplicate code, saving time and effort, improving development efficiency, and at the same time, enhancing the maintainability of the code.

[0160] The present application also provides another implementation manner, that is, to provide a computer-readable storage medium storing computer-readable instructions, and the computer-readable instructions can be executed by at least one processor, so that the at least one processor executes the steps of the H5 native data upload method as described above. After the H5 end uploads the data to the storage platform through the native end, the H5 end sends a service data request to the backend. The backend can obtain the corresponding data from the storage platform for service processing and return the obtained data to the H5 end. The work contents of the H5 end, the native end, and the backend can be decoupled, realizing the decoupling of data upload and service scenarios. Moreover, by configuring the communication interface, the process tasks of the service scenario can be completed, avoiding duplicate code, saving time and effort, improving development efficiency, and at the same time, enhancing the maintainability of the code.

[0161] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present application.

[0162] Obviously, the above-described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The accompanying drawings show the preferred embodiments of the present application, but do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure content of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, for those skilled in the art, they can still modify the technical solutions described in the foregoing specific embodiments, or perform equivalent replacements for some of the technical features. Any equivalent structure directly or indirectly using the content of the specification and drawings of the present application in other related technical fields is similarly within the scope of the patent protection of the present application.

Claims

1. A native data upload method based on H5, characterized in that It includes the following steps: The H5 end receives an upload instruction, and the native end displays the object to be uploaded to the user through the H5 end. The H5 end obtains the upload object in response to the user's selection operation from the object to be uploaded, and sends the identification information of the upload object to the native end; The native end obtains the corresponding upload object according to the identification information, uploads the upload object to the storage platform, and sends the object key information returned by the storage platform received to the H5 end; The H5 end sends the object key information to the backend; The backend receives the service data request carrying the object key information sent by the H5 end, obtains the identification information from the object key information in the service data request, obtains the link of the corresponding upload object from the storage platform according to the identification information, and returns the link to the H5 end; The H5 end displays the corresponding upload object based on the link.

2. The H5-based native data upload method according to claim 1, characterized in that, The step of the native end obtaining the upload object and sending the identification information of the upload object to the native end includes: The H5 end obtains all upload objects through the native end and determines whether the selected current upload object is a video; If the current upload object is a video, intercept the first frame picture of the current upload object and send the identification information of the first frame picture to the native end; If the current upload object is not a video, send the identification information of the current upload object to the native end.

3. The H5 native-based data upload method according to claim 1, wherein The step of the native end obtaining the corresponding upload object according to the identification information and uploading the upload object to the storage platform includes: The native end finds the corresponding upload object from the file directory according to the identification information; Call the upload interface and transmit the upload object to the storage platform through the upload interface.

4. The H5 native-based data upload method according to claim 3, wherein The step of sending the object key information returned by the storage platform received to the H5 end includes: The native end encapsulates the object key information into JSON data and sends the JSON data to the H5 end.

5. The H5-based native data upload method according to claim 1, characterized in that, Before the step of obtaining the link of the corresponding upload object from the storage platform, it also includes: The storage platform finds the link of the corresponding upload object according to the object key information; Call the backend interface and send the link to the backend.

6. The H5 native data upload method according to claim 5, characterized in that, Before the step of the storage platform finding the corresponding upload object according to the object key information, it also includes: The storage platform sends a permission authentication request to the H5 end and receives the authentication data sent by the H5 end based on the permission authentication request; Verify the authentication data; When the verification is passed, execute the step of the storage platform finding the link of the corresponding upload object according to the object key information; When the verification fails, return a verification error message to the H5 end.

7. The H5 native-based data upload method according to claim 1, characterized in that After the step of sending the object key information returned by the storage platform received to the H5 end, it also includes: The H5 end determines whether the upload object is uploaded successfully according to the object key information; If the upload is successful, execute the step of the H5 end sending the object key information to the backend; If the upload fails, the H5 side will receive the upload instruction again.

8. A data uploading device based on H5 and native, characterized in that It includes an H5 side, a native side, and a backend, where: The H5 side is used to receive the upload instruction. The native side presents the object to be uploaded to the user through the H5 side. The H5 side obtains the upload object in response to the user's selection operation from the object to be uploaded, and sends the identification information of the upload object to the native side; The native side is used to obtain the corresponding upload object according to the identification information, upload the upload object to the storage platform, and send the object key information returned by the storage platform received to the H5 side; The H5 side is used to send the object key information to the backend; The backend is used to receive the service data request carrying the object key information sent by the H5 side, obtain the identification information from the object key information in the service data request, obtain the link of the corresponding upload object from the storage platform according to the identification information, and return the link to the H5 side; The H5 side is used to display the corresponding upload object based on the link.

9. A computer device includes a memory and a processor. Computer-readable instructions are stored in the memory. When the processor executes the computer-readable instructions, the steps of the H5 native-based data upload method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that, Computer-readable instructions are stored on the computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the H5 native-based data upload method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Information sharing method, system and device based on H5 page

    CN109327518A

  • Picture uploading method and device, computer equipment and storage medium

    CN109710337A