CN107301053B - Picture configuration method and device and electronic terminal - Google Patents

Picture configuration method and device and electronic terminal Download PDF

Info

Publication number
CN107301053B
CN107301053B CN201710536090.XA CN201710536090A CN107301053B CN 107301053 B CN107301053 B CN 107301053B CN 201710536090 A CN201710536090 A CN 201710536090A CN 107301053 B CN107301053 B CN 107301053B
Authority
CN
China
Prior art keywords
network request
function
network
picture
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
CN201710536090.XA
Other languages
Chinese (zh)
Other versions
CN107301053A (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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710536090.XA priority Critical patent/CN107301053B/en
Publication of CN107301053A publication Critical patent/CN107301053A/en
Application granted granted Critical
Publication of CN107301053B publication Critical patent/CN107301053B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a picture configuration method, a picture configuration device and an electronic terminal, wherein the method comprises the steps of initializing a picture configuration function when a starting function of the electronic terminal is started; responding to a user picture configuration instruction and calling a class function in a picture configuration function; calling a primary network request function in the class functions, and calling a secondary network request function according to a picture loading calling function defined in the primary network request function; calling a third-level network request function according to a first network request tool class in the second-level network request function to initiate a network request; judging whether the parameter value recalled when the network request is initiated through the third-level network request function is a preset value or not, if so, successfully requesting the network, and storing the parameter value recalled to the second-level network request function; and downloading the corresponding network picture according to the picture URL in the parameter value, displaying and storing. The invention can effectively improve the real-time performance in the network picture configuration process and reduce the network flow waste.

Description

Picture configuration method and device and electronic terminal
Technical Field
The invention relates to the technical field of Internet application development, in particular to a picture configuration method and device and an electronic terminal.
Background
The inventor researches and discovers that the existing electronic terminal still has a plurality of problems in the using process, for example, in the process of giving virtual gifts or browsing pictures by a user, two picture configuration modes are generally adopted, one mode is to directly store picture information in a local file for calling the pictures, but the configuration mode can cause the problems that the pictures of the old version cannot be changed when a new version is released every time; the other method is to download the pictures in real time by connecting a network, but the configuration mode has the problems of traffic waste, incapability of realizing picture configuration and the like when the network connection is not smooth or fails, so that how to realize the real-time performance in the network picture configuration process and avoid the traffic waste becomes a research hotspot of technicians in the field.
Disclosure of Invention
In view of this, embodiments of the present invention provide a picture configuration method, a device, and an electronic terminal, which can effectively improve and guarantee real-time performance in a picture configuration process, avoid network traffic waste, and effectively improve customer experience.
The preferred embodiment of the present invention provides a picture configuration method, applied to an electronic terminal, comprising:
initializing a picture configuration function when a starting function of the electronic terminal is started;
responding to a user picture configuration instruction and calling a class function in the picture configuration function, wherein the class function comprises a statement file of a network picture request method;
calling a primary network request function in the class function, and calling a secondary network request function according to a picture loading calling function defined in the primary network request function;
calling a tertiary network request function according to a first network request tool class in the secondary network request function to initiate a network request;
judging whether the parameter value recalled when the network request is initiated through the third-level network request function is a preset threshold value or not, if so, successfully requesting the network, and storing the parameter value recalled into the second-level network request function;
and downloading the corresponding network picture according to the picture URL in the parameter value, displaying and storing.
In an option of the preferred embodiment of the present invention, the method further comprises:
if the parameter value of the callback is not a preset threshold value, judging whether the request times of initiating the network request through the three-level network request function are greater than preset times or not;
if the request times are larger than the preset times, stopping initiating the network request, and loading the historical network pictures stored in the secondary network request function to the corresponding network positions for displaying;
if the request times are less than or equal to the preset times, the tertiary network request function repeatedly initiates network requests according to a preset time interval, and whether the parameter value of each callback is the preset threshold value is judged.
In the selection of the preferred embodiment of the present invention, the parameter value includes an error code and request data acquired from a background, the preset threshold includes a preset value and a preset data type, the step of determining whether a parameter value recalled when a network request is initiated by the third-level network request function is a preset value, and if so, the network request is successful includes:
judging whether the error code is a preset value or not and whether the data type of the request data is a preset data type or not;
and if the error code is a preset value and the data type of the request data is a preset data type, the network request is successful.
In an alternative embodiment of the present invention, the implementation process of the three-level network request function includes the following steps:
generating a splicing character string according to the user information, and encrypting the splicing character string by adopting a preset encryption algorithm to obtain an encrypted character string;
splicing the encrypted character string to a URL of a basic network to obtain a network URL;
selecting a network request type and creating a second network request tool type according to the network request type;
and acquiring a single case in the second network request tool class, initiating a network request through the single case and the network URL, and judging whether the network request is successful according to a parameter value of a callback.
In a preferred embodiment of the invention, the predetermined encryption algorithm is an asymmetric encryption algorithm.
The preferred embodiment of the present invention further provides a picture configuring apparatus, applied to an electronic terminal, including:
the initialization module is used for initializing a picture configuration function when a starting-up starting function of the electronic terminal is started;
the first calling module is used for responding to a user picture configuration instruction and calling a class function in the picture configuration function, wherein the class function comprises a statement file of a network picture request method;
the second calling module is used for calling the primary network request function in the class function and calling the secondary network request function according to the picture loading calling function defined in the primary network request function;
the third calling module is used for calling a three-level network request function according to the first network request tool class in the two-level network request function so as to initiate a network request;
the judging module is used for judging whether the parameter value recalled when the network request is initiated through the third-level network request function is a preset threshold value or not, if so, the network request is successful, and the parameter value recalled is stored into the second-level network request function;
and the downloading module is used for downloading and storing the corresponding picture according to the picture URL in the parameter value.
In the selection of the preferred embodiment of the present invention, the determining module is further configured to determine whether the number of times of requests for initiating network requests through the tertiary network request function is greater than a preset number of times when the parameter value of the callback is not a preset threshold;
if the request times are larger than the preset times, stopping initiating the network request, and loading the historical network pictures stored in the secondary network request function to the corresponding network positions for displaying;
if the request times are less than or equal to the preset times, the tertiary network request function repeatedly initiates network requests according to a preset time interval, and whether the parameter value of each callback is the preset threshold value is judged.
In an alternative embodiment of the present invention, the third invoking module includes:
the encryption unit is used for generating a spliced character string according to the user information and encrypting the spliced character string by adopting a preset encryption algorithm to obtain an encrypted character string;
the splicing unit is used for splicing the encrypted character string to a URL of a basic network to obtain a network URL;
the creating unit is used for selecting the network request type and creating a second network request tool class according to the network request type;
and the network request unit is used for acquiring a single case in the second network request tool class, initiating a network request through the single case and the network URL, and judging whether the network request is successful according to a parameter value of the callback.
The preferred embodiment of the present invention further provides an electronic terminal, which includes a memory, a processor and the image configuration device, wherein the image configuration device is installed in the memory and includes one or more software function modules executed by the processor.
A preferred embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and the computer program realizes the steps of the above-mentioned picture configuring method when executed.
Compared with the prior art, the invention realizes logic layering in the picture configuration process by adopting a multi-level function calling technology, improves code reusability and calling convenience, and meanwhile, the invention can also effectively ensure the real-time performance in the network picture configuration process and reduce network flow waste.
Furthermore, the invention adds a fault-tolerant mechanism in the picture configuration process, thereby effectively improving the stability of the interface.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic view of an application scenario of a picture configuration method and apparatus according to an embodiment of the present invention.
Fig. 2 is a block diagram of a server according to an embodiment of the present invention.
Fig. 3 is a flowchart illustrating a picture configuration method according to an embodiment of the present invention.
Fig. 4 is a sub-flow diagram of a picture configuration method according to an embodiment of the present invention.
Fig. 5 is a schematic block structure diagram of a picture configuring apparatus according to an embodiment of the present invention.
Fig. 6 is a block diagram of the third calling module shown in fig. 5.
Icon: 10-a server; 100-a memory; 200-a processor; 300-a communication unit; 400-picture configuration means; 402-an initialization module; 404-a first calling module; 406-a second calling module; 408-a third calling module; 4080-an encryption unit; 4082-splicing unit; 4084-creating unit; 4086-network request unit; 410-a judgment module; 412-download module; 20-a network; 30-electronic terminal.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
Fig. 1 is a schematic view of an application scenario of a picture configuration method and device according to an embodiment of the present invention. The application scenario may include the server 10, the network 20, and the electronic terminal 30, wherein the electronic terminal 30 may be a plurality of terminals. The server 10 is capable of communicating with the electronic terminal 30 via a network 20.
Alternatively, in this embodiment, the server 10 may be, but is not limited to, a Web server, a data server, and the like, and may also be an electronic device having a processing function, such as a computer, a Mobile Internet Device (MID), and the like. The electronic terminal 30 may be, but is not limited to, a smart phone, a Personal Computer (PC), a tablet PC, a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), and the like. The network 20 may be, but is not limited to, a wired network or a wireless network.
Referring to fig. 2, the server 10 may include a memory 100, a processor 200, and a communication unit 300. The memory 100, the processor 200 and the communication unit 300 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The memory 100 stores software functional modules stored in the memory 100 in the form of software or firmware (firmware), and the processor 200 executes various functional applications and data processing by running software programs and modules stored in the memory 100, such as the picture configuration apparatus 400 in the embodiment of the present invention, so as to implement the picture configuration method in the embodiment of the present invention.
The Memory 100 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 100 is used for storing programs, and the processor 200 executes the programs after receiving execution instructions. Further, the software programs and modules in the memory 100 may also include an operating system. Which may include various software components and/or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.) and may communicate with various hardware or software components to provide an operating environment for other software components.
The processor 200 may be an integrated circuit chip having signal processing capabilities. The Processor 200 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like. But may also be a Digital Signal Processor (DSP)), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or any conventional processor or the like.
The communication unit 300 is configured to establish a communication connection between the server 10 and an external communication terminal through the network 20, so as to implement transceiving operations of network signals and data information, where the network signals may include wireless signals or wired signals.
It will be appreciated that the configuration shown in fig. 2 is merely illustrative and that the server 10 may include more or fewer components than shown in fig. 2 or may have a different configuration than shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
Referring to fig. 3, an embodiment of the present invention further provides a picture configuring method applicable to the electronic terminal 30, and the method steps defined by the related flow of the method can be implemented by the processor 200. The specific flow shown in fig. 3 will be described in detail below.
Step S402, initializing a picture configuration function when the power-on start function of the electronic terminal 30 is started.
In actual implementation, the picture configuration function is pre-stored in the electronic terminal 30, and is loaded and initialized when the electronic terminal 30 is started through the boot function. The boot startup function may be implemented by a function "didfinishlaunchwithoptions".
It should be noted that the picture configuration function is loaded only once when the computer is started, and the picture configuration function is loaded once without entering a page every time, so that the network flow overhead can be effectively saved.
Step S404, responding to a user picture configuration instruction and calling a class function in the picture configuration function, wherein the class function comprises a statement file of a network picture request method.
Step S406, a primary network request function in the class function is called, and a secondary network request function is called according to a picture loading calling function defined in the primary network request function.
In this embodiment, after the initialization of the picture configuration function is completed, when a user needs to access a network page and needs to load a network picture, a first-level network request function in a class function of the picture configuration function may be called by responding to a picture configuration instruction sent by the user. The primary network request function is predefined and stored in the class function, and is used for calling the secondary network request function according to a picture configuration instruction sent by a user, and the primary network request function does not set a return value and a corresponding parameter value. In practical implementation, the class function may be implemented by a function "DYLevelTool", and the primary network request function may be implemented by a function "requestLevelImgList".
Optionally, the declaration document of the class function is also prestored in the declaration document of the class function.
It should be noted that, in this embodiment, the primary network request function is simple to set, and is only used for calling an outer-layer function.
Step S408, a third-level network request function is called according to the first network request tool class in the second-level network request function to initiate a network request.
In this embodiment, the secondary network request function is used to perform separate processing of some service layers, for example, storing network pictures. In addition, in this embodiment, the call to the third-level network request function needs to be implemented through the first network request tool class in the second-level network request function. The three-level network request function may be implemented by a function 'getLevelImageList'.
Further, as shown in fig. 4, the implementation of the three-level network request function includes the following sub-steps.
And a substep S4080 of generating a spliced character string according to the user information and encrypting the spliced character string by adopting a preset encryption algorithm to obtain an encrypted character string.
The user information may include a nickname of the user, the current time, and other information related to the user. In the actual implementation process, when a user sends a picture configuration instruction, user information can be converted and spliced according to preset rules to form a spliced character string. In addition, the preset encryption algorithm used in encrypting the concatenated string may be, but is not limited to, an asymmetric encryption algorithm.
Substep S4082, concatenating the encrypted string to the URL of the base network to obtain the network URL.
In this embodiment, the encrypted string may be spliced to the URL of the base network in a form of a prefix. It should be noted that the basic network may be a network in a development environment, or may be a formal environment network applied in an operation situation. For example, when the basic network is a network in a development environment, the URL of the basic network is a URL of a network in a current development environment; and when the basic network is a formal environment network, the URL of the basic network is the URL of the network in the current formal environment.
Substep S4084 selects a network request type and creates a second network request tool class according to the network request type.
Substep S4086, obtaining a single instance in the second network request tool class, initiating a network request through the single instance and the network URL, and determining whether the network request is successful according to a parameter value of the callback.
In this embodiment, the network request type in sub-step S4084 may be a GET function or a POST function, where the GET function refers to requesting data from a specified resource, and the POST function refers to submitting data to be processed to a specified resource. In actual implementation, the corresponding network request type can be selected according to the picture configuration instruction sent by the user, the second network tool class is further created, finally, a single instance in the second network request tool class is obtained, and the network request is initiated through the single instance and the network URL. In practical implementation, the second network request tool class may be implemented by the function "AFInstanceManager", and the singleton manager therein is obtained by the function "shared manager".
Further, after completing the initiation of the network request, the third-level network request function may call back a corresponding parameter value, for example, but not limited to, the following three parameter values.
Parameter 1 error code of errorCode request function.
Parameter 2: errorMessage, request function error information (network request failure).
Parameter 3 data request data obtained from background (network request success).
It should be understood that when the parameter value judgment is performed, one or more of the above parameter values may be selected according to actual conditions.
Step S410, determining whether a parameter value recalled when the network request is initiated by the third-level network request function is a preset threshold value, if so, performing step S412, otherwise, performing step S416.
In this embodiment, the parameter value may be an error code of the request function and request data obtained from a background, and the preset threshold includes a preset value corresponding to the error code and a preset data type corresponding to the request data.
Step S412, the network request is successful, and the parameter value of the callback is saved in the secondary network request function.
In this embodiment, when determining the parameter value of the callback, the network request may be determined to be successful only when the error code is the preset value and the data type of the request data is the preset data type.
It should be noted that the URL of the picture is included in the request data of the callback, so that the parameter value of the callback can be saved in the secondary network request function after the network request is successful.
And step S414, downloading the corresponding network picture according to the picture URL in the parameter value, displaying and storing.
In this embodiment, after downloading the corresponding network picture according to the picture URL in the callback data, the network picture may be stored in the secondary network request function, so as to directly call the stored network picture to improve user experience when the next network request fails.
Step S416, determining whether the number of times of requests for initiating network requests through the third-level network request function is greater than a preset number of times, if so, performing step S418, otherwise, performing step S410.
Step S418, if the number of times of the request is greater than the preset number of times, stopping initiating the network request, and loading the historical network picture stored in the secondary network request function to the corresponding network location for displaying.
In this embodiment, a fault tolerance mechanism is set when initiating a network request to improve the stability of the network interface and the success probability of the network request. In other words, when the network request initiated by the three-level network request function fails, the stability of the network interface and the probability of success of the network request can be improved by repeatedly sending the same network request. Specifically, the step S418 or the step S410 may be determined to be executed by setting a preset number of times and a preset time interval, and determining whether the number of times of request is greater than the preset number of times when the network request fails. Optionally, the preset times and the preset time interval may be flexibly designed according to actual situations, which is not limited in this embodiment.
For example, in an actual implementation, assuming that the preset number of times is 5 and the preset time interval is 5 seconds, when the number of requests is less than or equal to 5, the tertiary network request function "requestanchorelevelimgllist" may be called again by delaying the delay method by 5 seconds through the function "dispatch _ after" while adding 1 to the number of requests, and if the number of requests is greater than 5 and the parameter value of the callback is still different from the preset threshold value, that is, the network picture cannot be obtained, the network picture stored in the secondary network request function last time may be directly loaded at the corresponding network location to be displayed to the user, thereby improving the user experience.
It should be noted that the reason for the network request failure may be, but is not limited to, a network connection interruption or a poor network signal, etc.
Further, based on the above description, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed, implements the steps described in the method embodiment corresponding to fig. 3 or fig. 4.
Referring to fig. 5, an embodiment of the invention further provides a picture configuring apparatus 400 applicable to the electronic terminal 30. The picture configuring apparatus 400 includes an initializing module 402, a first calling module 404, a second calling module 406, a third calling module 408, a determining module 410, and a downloading module 412.
The initialization module 402 is configured to initialize a picture configuration function when the power-on start-up function of the electronic terminal 30 is started. Specifically, in this embodiment, the initialization module 402 can be used to execute step S402 in fig. 3, and the detailed description of step S402 can be referred to for a specific operation method.
The first calling module 404 is configured to respond to a user picture configuration instruction and call a class function in the picture configuration function, where the class function includes a statement file of a method for requesting a network picture. Specifically, in this embodiment, the first calling module 404 may be configured to execute step S404 in fig. 3, and the detailed description of step S404 may be referred to for a specific operation method.
The second calling module 406 is configured to call a primary network request function in the class function, and call a secondary network request function according to a picture loading calling function defined in the primary network request function. Specifically, in this embodiment, the second calling module 406 may be configured to execute step S406 in fig. 3, and the detailed description of step S406 may be referred to for a specific operation method.
The third calling module 408 is configured to call a third-level network request function according to the first network request tool class in the second-level network request function to initiate a network request. Specifically, in this embodiment, the third invoking module 408 may be configured to execute step S408 in fig. 3, and the detailed description of step S408 may be referred to for a specific operation method. In actual implementation, as shown in fig. 6, the third invoking module 408 includes an encrypting unit 4080, a splicing unit 4082, a creating unit 4084, and a network requesting unit 4086.
The encryption unit 4080 is configured to generate a spliced character string according to the user information, and encrypt the spliced character string by using a preset encryption algorithm to obtain an encrypted character string. Specifically, in this embodiment, the encryption unit 4080 may be configured to execute step S4080 in fig. 4, and the detailed description of step S4080 may be referred to for a specific operation method.
The splicing unit 4082 is configured to splice the encrypted character string to a URL of a base network to obtain a network URL. Specifically, in this embodiment, the splicing unit 4082 may be configured to perform step S4082 in fig. 4, and the specific operation method may refer to the detailed description of step S4082.
The creating unit 4084 is configured to select a network request type and create a second network request tool class according to the network request type. Specifically, in this embodiment, the creating unit 4084 may be configured to execute step S4084 in fig. 4, and a specific operation method may refer to the detailed description of step S4084.
The network request unit 4086 is configured to obtain a single instance in the second network request tool class, initiate a network request through the single instance and the network URL, and determine whether the network request is successful according to a parameter value of the callback. Specifically, in this embodiment, the network requesting unit 4086 may be configured to execute step S4086 in fig. 4, and the detailed description of step S4086 may be referred to in a specific operation method.
The determining module 410 is configured to determine whether a parameter value recalled when a network request is initiated through the third-level network request function is a preset threshold, if so, the network request is successful, and store the parameter value recalled into the second-level network request function. Specifically, in this embodiment, the determining module 410 may be configured to execute step S410, step S416, and step S418 in fig. 3, and the specific operation method may refer to the detailed description of step S410, step S416, or step S418.
The downloading module 412 is configured to download and store the corresponding network picture according to the picture URL in the parameter value.
Specifically, in this embodiment, the downloading module 412 may be configured to execute step S412 in fig. 3, and the detailed description of step S412 may be referred to for a specific operation method.
In summary, the method, the apparatus, and the electronic terminal 30 for picture configuration provided in the embodiments of the present invention can implement logical layering in a picture configuration process by using a multi-level function call technology, so as to improve reusability and call convenience of codes, and meanwhile, the present invention can also effectively ensure real-time performance in a network picture configuration process, and reduce network traffic waste.
In addition, the invention adds a fault-tolerant mechanism in the picture configuration process, effectively improves the stability of the interface, improves the user experience, and has simple method and strong applicability.
In the description of the present invention, the terms "disposed", "connected" and "connected" should be interpreted broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In the embodiments provided in the embodiments of the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to a predetermined number of embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code. The module, segment, or portion of code, comprises one or a predetermined number of elements designed to implement a specified logical function.
It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A picture configuration method is applied to an electronic terminal and is characterized by comprising the following steps:
initializing a picture configuration function when a starting function of the electronic terminal is started;
responding to a user picture configuration instruction and calling a class function in the picture configuration function, wherein the class function comprises a statement file of a network picture request method;
calling a primary network request function in the class function, and calling a secondary network request function according to a picture loading calling function defined in the primary network request function;
calling a tertiary network request function according to a first network request tool class in the secondary network request function to initiate a network request;
judging whether the parameter value recalled when the network request is initiated through the third-level network request function is a preset threshold value or not, if so, successfully requesting the network, and storing the parameter value recalled into the second-level network request function;
downloading a corresponding network picture according to the picture URL in the parameter value, displaying and storing the network picture;
if the parameter value of the callback is not a preset threshold value, judging whether the request times of initiating the network request through the three-level network request function are greater than preset times or not;
if the request times are larger than the preset times, stopping initiating the network request, and loading the historical network pictures stored in the secondary network request function to the corresponding network positions for displaying;
if the request times are less than or equal to the preset times, the tertiary network request function repeatedly initiates network requests according to a preset time interval, and whether the parameter value of each callback is the preset threshold value is judged.
2. The picture configuration method according to claim 1, wherein the parameter values include error codes and request data acquired from a background, the preset threshold includes a preset value and a preset data type, and the step of determining whether the parameter values recalled when the network request is initiated through the three-level network request function are the preset values, and if yes, the network request is successful includes:
judging whether the error code is a preset value or not and whether the data type of the request data is a preset data type or not;
and if the error code is a preset value and the data type of the request data is a preset data type, the network request is successful.
3. The picture configuration method according to claim 1, wherein the implementation process of the three-level network request function comprises the following steps:
generating a splicing character string according to the user information, and encrypting the splicing character string by adopting a preset encryption algorithm to obtain an encrypted character string;
splicing the encrypted character string to a URL of a basic network to obtain a network URL;
selecting a network request type and creating a second network request tool type according to the network request type;
and acquiring a single case in the second network request tool class, initiating a network request through the single case and the network URL, and judging whether the network request is successful according to a parameter value of a callback.
4. The picture arrangement method according to claim 3, wherein the predetermined encryption algorithm is an asymmetric encryption algorithm.
5. A picture configuration device applied to an electronic terminal is characterized by comprising:
the initialization module is used for initializing a picture configuration function when a starting-up starting function of the electronic terminal is started;
the first calling module is used for responding to a user picture configuration instruction and calling a class function in the picture configuration function, wherein the class function comprises a statement file of a network picture request method;
the second calling module is used for calling the primary network request function in the class function and calling the secondary network request function according to the picture loading calling function defined in the primary network request function;
the third calling module is used for calling a three-level network request function according to the first network request tool class in the two-level network request function so as to initiate a network request;
the judging module is used for judging whether the parameter value recalled when the network request is initiated through the third-level network request function is a preset threshold value or not, if so, the network request is successful, and the parameter value recalled is stored into the second-level network request function;
the downloading module is used for downloading and storing the corresponding picture according to the picture URL in the parameter value;
the judging module is further configured to judge whether the number of times of requests for initiating network requests through the tertiary network request function is greater than a preset number of times when the parameter value of the callback is not a preset threshold; if the request times are larger than the preset times, stopping initiating the network request, and loading the historical network pictures stored in the secondary network request function to the corresponding network positions for displaying; if the request times are less than or equal to the preset times, the tertiary network request function repeatedly initiates network requests according to a preset time interval, and whether the parameter value of each callback is the preset threshold value is judged.
6. The picture configuring device according to claim 5, wherein the third invoking module comprises:
the encryption unit is used for generating a spliced character string according to the user information and encrypting the spliced character string by adopting a preset encryption algorithm to obtain an encrypted character string;
the splicing unit is used for splicing the encrypted character string to a URL of a basic network to obtain a network URL;
the creating unit is used for selecting the network request type and creating a second network request tool class according to the network request type;
and the network request unit is used for acquiring a single case in the second network request tool class, initiating a network request through the single case and the network URL, and judging whether the network request is successful according to a parameter value of the callback.
7. An electronic terminal, characterized in that it comprises a memory, a processor and a picture arrangement device as claimed in claim 5 or 6, said picture arrangement device being installed in said memory and comprising one or more software functional modules executed by said processor.
8. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed, implements the steps in the picture arrangement method according to any of the claims 1-4.
CN201710536090.XA 2017-07-04 2017-07-04 Picture configuration method and device and electronic terminal Active CN107301053B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710536090.XA CN107301053B (en) 2017-07-04 2017-07-04 Picture configuration method and device and electronic terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710536090.XA CN107301053B (en) 2017-07-04 2017-07-04 Picture configuration method and device and electronic terminal

Publications (2)

Publication Number Publication Date
CN107301053A CN107301053A (en) 2017-10-27
CN107301053B true CN107301053B (en) 2020-12-15

Family

ID=60135576

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710536090.XA Active CN107301053B (en) 2017-07-04 2017-07-04 Picture configuration method and device and electronic terminal

Country Status (1)

Country Link
CN (1) CN107301053B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110691108B (en) * 2018-07-04 2022-09-09 武汉斗鱼网络科技有限公司 Picture downloading and saving method and electronic equipment
CN109302467B (en) * 2018-09-19 2021-07-23 武汉斗鱼网络科技有限公司 Message distribution method, device, terminal and storage medium
CN110278271B (en) * 2019-06-24 2022-04-12 厦门美图之家科技有限公司 Network request control method and device and terminal equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598679A (en) * 2016-12-21 2017-04-26 北京奇虎科技有限公司 Method and device for loading picture resources

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100444163C (en) * 2005-03-29 2008-12-17 腾讯科技(深圳)有限公司 Configuration method for webpage display
JP5884542B2 (en) * 2012-02-17 2016-03-15 株式会社リコー Apparatus, information processing system, information processing method, and information processing program
CN103309695B (en) * 2012-03-15 2017-12-08 腾讯科技(深圳)有限公司 A kind of loading figure calibration method and terminal
JP5782055B2 (en) * 2013-01-31 2015-09-24 京セラドキュメントソリューションズ株式会社 Image forming apparatus
CN103617165B (en) * 2013-10-22 2017-02-15 小米科技有限责任公司 Picture loading method, device and terminal
CN105183346B (en) * 2015-08-27 2019-03-01 努比亚技术有限公司 Image display apparatus and method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598679A (en) * 2016-12-21 2017-04-26 北京奇虎科技有限公司 Method and device for loading picture resources

Also Published As

Publication number Publication date
CN107301053A (en) 2017-10-27

Similar Documents

Publication Publication Date Title
EP3605323B1 (en) Method for generating network slice template and for applying network slice template, and apparatus
US8112116B2 (en) Bidirectional dynamic offloading of tasks between a host and a mobile device
WO2017147873A1 (en) Profile download method, and related devices and system
CN109391673B (en) Method, system and terminal equipment for managing update file
US20220239688A1 (en) Remote Attestation Mode Negotiation Method for Combined Device and Related Device
CN107301053B (en) Picture configuration method and device and electronic terminal
CN109600769B (en) Communication method and device
CN114281573A (en) Workflow data interaction method and device, electronic device and readable storage medium
CN114422618B (en) Cloud-protogenesis-based IOT platform protocol adaptation method, device, equipment and medium
CN110855746A (en) Middleware management method, electronic device and storage medium
CN111143031A (en) Method and device for changing capacity of virtual machine
CN110741617B (en) Resource updating method and device, computer equipment and storage medium
CN111314355B (en) Authentication method, device, equipment and medium of VPN (virtual private network) server
WO2004019208A2 (en) Method and apparatus for just-in-time provisioning application-related information at a communication device
CN110620695B (en) Data processing method and related equipment
CN112818270A (en) Data cross-domain transfer method and device and computer equipment
EP3188071B1 (en) Application accessing control method and device
CN115776461A (en) Screen projection method, equipment and storage medium
CN112685613B (en) Resource package query method and device and information processing system
US11757976B2 (en) Unified application management for heterogeneous application delivery
CN114039962A (en) Node selection method, system, electronic device and storage medium
CN114296823A (en) Information processing method and device for decoupling between service modules
CN113093995A (en) Cloud disk data migration method and system
CN110708199A (en) Method, device, electronic equipment and medium for upgrading terminal equipment
CN110716764A (en) Sharing method and device of public configuration, computer equipment and storage medium

Legal Events

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