CN112241504A - Timing method and timing device - Google Patents

Timing method and timing device Download PDF

Info

Publication number
CN112241504A
CN112241504A CN201910641875.2A CN201910641875A CN112241504A CN 112241504 A CN112241504 A CN 112241504A CN 201910641875 A CN201910641875 A CN 201910641875A CN 112241504 A CN112241504 A CN 112241504A
Authority
CN
China
Prior art keywords
timing
user interface
time
attribute information
component
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910641875.2A
Other languages
Chinese (zh)
Inventor
徐远朝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910641875.2A priority Critical patent/CN112241504A/en
Publication of CN112241504A publication Critical patent/CN112241504A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the application discloses a timing method and a timing device, wherein the timing method is applied to the timing device, the timing device comprises a timing logic component and a timing user interface component which are mutually independent, and the timing method comprises the following steps: acquiring timing attribute information through a timing logic component; performing logic processing on the timing attribute information through a timing logic component to obtain timing information; sending the timing information to a timing user interface component through a timing logic component; and updating the timing user interface based on the timing information through the timing user interface component. According to the method and the device, the timing logic and the timing user interface are split, when different user interface effects are needed, the timing attribute information corresponding to the different user interface effects is input, the timing user interface effects can be rapidly adjusted through the input timing attribute information, the timing logic does not need to be changed, the high reuse of the calculation logic can be realized, and the development efficiency is improved.

Description

Timing method and timing device
Technical Field
The present application relates to the field of timing technologies, and in particular, to a timing method and a timing device.
Background
Timing is a common effect in web pages. Timing (forward timing) for calculating time spent, such as timing the time spent on answering; there is also a countdown of how much time remains, such as a countdown of second kill clumps; even some timing requires a pause function. The different timings may appear to be different on the web page, but the basic principle is consistent, typically every 1s update. In the prior art, the following problems exist: a set of components with user interface effects are packaged according to different functions, such as a forward timing set, a backward timing set and a pause function. For packaging various different functions, on one hand, not only several sets of timing logic need to be written and maintained, but also only one user interface can be reproduced if the user interface has larger change, and a good reuse is not achieved.
That is, in the prior art, different timing logics need to be written for different user interface effects, so that the reuse of the timing logics cannot be realized, and the development efficiency is low.
Disclosure of Invention
The embodiment of the application provides a timing method and a timing device, which can realize the repeated use of timing logic and improve the development efficiency.
In one aspect, the present application provides a timing method, where the timing method is applied to a timing device, where the timing device includes a timing logic component and a timing user interface component that are independent of each other, and the timing method includes:
acquiring timing attribute information through the timing logic component;
determining timing information according to the timing attribute information through the timing logic component;
sending the timing information to the timing user interface component through the timing logic component;
and updating the timing user interface based on the timing information through the timing user interface component.
Wherein the timing information includes a timing time value and a timing state, and the determining, by the timing logic component, the timing information according to the timing attribute information includes:
determining a timing status based on the timing attribute information;
if the timing state is the starting timing state, determining a timing type based on the timing attribute information;
acquiring current time;
determining the timed time value based on the timing type and the current time.
Wherein the determining a timing status based on the timing attribute information comprises:
and when a timing state input value with a true logic value exists in the timing attribute information, the timing state is the start of timing.
Wherein the determining a timing type based on the timing attribute information comprises:
when countdown deadline time exists in the timing attribute information, determining that the timing type is countdown;
and when the countdown deadline does not exist in the timing attribute information, determining that the timing type is forward timing.
Wherein said determining said timed time value based on said type of timing and a current time comprises:
and if the timing type is countdown, determining the difference between the countdown deadline time and the current time as the timing time value.
Wherein determining a difference between the countdown deadline and the current time as the timing time value comprises:
and when the difference between the countdown deadline and the current time is greater than a preset value, determining the difference between the countdown deadline and the current time as the timing time value.
Wherein said determining said timed time value based on said type of timing and a current time comprises:
if the timing type is forward timing, acquiring timing starting time;
and determining the difference value between the current time and the starting timing time as the timing time value.
Wherein the determining the difference between the current time and the starting timing time as the timing time value comprises:
and when the timing attribute information has initialization time, adding the difference value between the current time and the starting timing time to the initialization time to obtain a timing time value.
Wherein the timing information further includes a timing state adjustment function, and the sending the timing information to the timing user interface component through the timing logic component includes:
taking the timing user interface component as a child element, taking the timing state, the timing time value and the timing state adjusting function as attributes, cloning the elements, and sending the timing state, the timing time value and the timing state adjusting function to the timing user interface component
In one aspect, the present application provides a timing device comprising a timing logic module and a timing user interface module,
the timing logic module is used for acquiring timing attribute information;
the timing logic module is used for determining timing information according to the timing attribute information;
the timing logic module is used for sending timing information to the timing user interface component;
and the timing user interface module is used for updating the timing user interface based on the timing information.
The timing information comprises a timing time value and a timing state, and the timing logic module is specifically used for determining the timing state based on the timing attribute information;
if the timing state is the starting timing state, determining the timing type based on the timing attribute information;
acquiring current time;
a timed time value is determined based on the timing type and the current time.
The timing logic module is specifically configured to, when a timing state input value whose logic value is true exists in the timing attribute information, start timing in the timing state.
The timing logic module is specifically configured to determine a timing type based on the timing attribute information, and includes:
when the countdown deadline time exists in the timing attribute information, determining the timing type as countdown;
and when the countdown deadline does not exist in the timing attribute information, determining that the timing type is forward timing.
The timing logic module is specifically used for determining the difference between the countdown deadline time and the current time as a timing time value if the timing type is countdown.
The timing logic module is specifically used for determining the difference between the countdown deadline and the current time as a timing time value when the difference between the countdown deadline and the current time is greater than a preset value.
The timing logic module is specifically used for acquiring timing starting time if the timing type is forward timing;
and determining the difference between the current time and the starting timing time as a timing time value.
The timing logic module is specifically configured to, when there is initialization time in the timing attribute information, add a difference between the current time and the time to start timing to the initialization time to obtain a timing time value.
The timing information further comprises a timing state adjusting function, and the timing logic module is specifically used for cloning elements by taking the timing user interface component as a sub-element and taking the timing state, the timing time value and the timing state adjusting function as attributes, and sending the timing state, the timing time value and the timing state adjusting function to the timing user interface component.
The embodiment of the application provides a timing method, which is applied to a timing device, wherein the timing device comprises a timing logic component and a timing user interface component which are mutually independent, and the timing method comprises the following steps: acquiring timing attribute information through a timing logic component; performing logic processing on the timing attribute information through a timing logic component to obtain timing information; sending the timing information to a timing user interface component through a timing logic component; and updating the timing user interface based on the timing information through the timing user interface component. According to the embodiment of the application, the timing logic and the timing user interface are separated, when different user interface effects are needed, timing attribute information corresponding to the different user interface effects is input, the input timing attribute information is processed through the calculation logic component to obtain the timing information, then the timing user interface component is used for rendering based on the timing information, the user interface effect can be rapidly adjusted through the input timing attribute information, the timing logic does not need to be changed, the high reuse of the calculation logic can be achieved, and the development efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of a timing system according to an embodiment of the present application;
FIG. 2 is a flow chart illustrating an embodiment of a timing method provided in an embodiment of the present application;
fig. 3 is a schematic flow chart of another embodiment of the timing method provided in the embodiment of the present application;
FIG. 4 is a schematic view of a timing user interface scenario of the timing method of the present application;
FIG. 5 is a schematic view of another timing user interface scenario of the timing method of the present application;
FIG. 6 is a schematic view of another timing user interface scenario of the timing method of the present application;
FIG. 7 is a schematic view of another timing user interface scenario of the timing method of the present application;
FIG. 8 is a schematic structural diagram of an embodiment of a timing device provided in an embodiment of the present application;
fig. 9 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. 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 application.
Referring to fig. 1, fig. 1 is a schematic view of a timing system according to an embodiment of the present disclosure. The timing system may comprise a timing device, which may in particular be integrated in the terminal. The timing system may also include at least one terminal. At least one terminal is connected with the server through a network, and information interaction is further carried out through the network.
In the embodiment of the application, the timing device comprises a timing logic component and a timing user interface component which are independent from each other. The Component (Component) is a simple encapsulation of data and methods. In C + + Builder, a component is a specific object derived from TComponent. The components may have their own properties and methods. An attribute is a simple visitor to component data. The method is some simple and visible function of the component. The use of components can enable drag-and-drop programming, fast property handling, and true object-oriented design. The timing logic component encapsulates the core portion of the timing logic responsible for processing all logic related to timing and passing data to the timing user interface component. And rendering the data received by the timing user interface component. After the timing device obtains the timing user interface effect rendered by the timing user interface component, a user can operate the timing user interface at the terminal, so that the timing function is realized. The timing logic is separated from the user interface effect, the timing logic assembly is responsible for processing all logic related to timing and transmitting data to the timing user interface effect, so that the high reuse of the timing logic is achieved, the development efficiency is improved, unified maintenance and upgrading are facilitated, and the like.
The timing device in the embodiment of the application is mainly used for acquiring timing attribute information through the timing logic component; determining timing information according to the timing attribute information through a timing logic component; sending the timing information to a timing user interface component through a timing logic component; and updating the timing user interface based on the timing information through the timing user interface component.
It should be noted that the scenario diagram of the timing system shown in fig. 1 is only an example, and the timing system and the scenario described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not form a limitation on the technical solution provided in the embodiment of the present application, and as a person having ordinary skill in the art knows that along with the evolution of the timing system and the occurrence of a new service scenario, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
The following is a detailed description of specific embodiments.
In the embodiments of the present application, description will be made from the viewpoint of a timing device, which may be specifically integrated in a terminal.
The application provides a timing method, which is applied to a timing device, wherein the timing device comprises a timing logic component and a timing user interface component which are mutually independent, and the timing method comprises the following steps: acquiring timing attribute information through a timing logic component; determining timing information according to the timing attribute information through a timing logic component; sending the timing information to a timing user interface component through a timing logic component; and updating the timing user interface based on the timing information through the timing user interface component.
Referring to fig. 2, fig. 2 is a schematic flow chart of an embodiment of a timing method provided in an embodiment of the present application, where the timing method includes:
and S11, acquiring timing attribute information through the timing logic component.
In some embodiments of the present application, the timing attribute information is obtained through an API interface of the timing logic component. An API (Application Programming Interface) is a predefined function or a convention for linking different components of a software system. The goal is to provide applications and developers the ability to access a set of routines based on certain software or hardware without having to access native code or understand the details of the internal workings.
For example, the developer writes the timing attribute information from the server side through the API interface, and the timing attribute information may include: the timing state input value, the countdown deadline time, the initialization time and the like are determined according to the user interface effect obtained according to specific needs. And after the developer writes the timing attribute information through the API, the timing attribute information is acquired through the timing logic component. Wherein, the timing state input value may be "TRUE" or "FALSE"; the countdown deadline may be "1 day", "3 hours", or "100 seconds", etc.; the initialization time may be "0 second" or "10 seconds", and the like, and may be input according to specific requirements.
And S12, determining timing information according to the timing attribute information through the timing logic component.
In the embodiment of the present application, the timing information includes a timing time value and a timing state.
In a specific embodiment, determining, by the timing logic component, the timing information according to the timing attribute information may include the following steps:
(1) the timing status is determined based on the timing attribute information.
In a specific embodiment, it is determined whether a timing state input value whose logic value is true exists in the timing attribute information, if so, the timing state is determined to be the start of timing, and if not, the timing state is determined to be the pause of timing or the end of timing. For example, if the input value of the timing state in the timing attribute information is "TRUE", the timing state is determined to be the start of timing; and if the timing state input value in the timing attribute information is 'FALSE', determining that the timing state is the time suspension or the end of the timing.
(2) And if the timing state is the starting timing state, determining the timing type based on the timing attribute information.
Specifically, it is determined whether the timing type is countdown. For example, whether countdown deadline exists in the timing attribute information is judged, and when the countdown deadline exists in the timing attribute information, the timing type is determined to be countdown; and when the countdown deadline does not exist in the timing attribute information, determining that the timing type is forward timing.
(3) And acquiring the current time.
Specifically, the current time is obtained by calling a timer component. For example, the current time is obtained as 9 days, 10 hours, 8 minutes, 8 seconds. The timer component is a basic component and is used for system timing and displaying the text of how much time passes from a certain timing starting time.
Specifically, a timer component is called according to a preset frequency to obtain the current time. The predetermined frequency may be 1HZ, 0.5HZ, or other values, which are not limited in this application. Namely, the numerical value of the current time is obtained in real time, so that the timing update is carried out.
(4) A timed time value is determined based on the timing type and the current time.
In some embodiments of the present application, if the timing type is countdown, a difference between a countdown deadline and a current time is determined as a timing time value.
In a specific embodiment, when the difference between the countdown deadline and the current time is greater than a preset value, the difference between the countdown deadline and the current time is determined as a count time value. For example, if the countdown expiration time is 9 days, 10 hours, 8 minutes, 18 seconds, and the current time is 9 days, 10 hours, 8 minutes, 8 seconds, the count-up time value is determined to be 10 seconds. Along with the change of the current time, the timing time value changes along with the change of the current time, and the timing function is realized.
In another embodiment, it is determined whether the difference between the countdown deadline and the current time is greater than a predetermined value. When the difference between the countdown deadline time and the current time is greater than a preset value, determining the difference between the countdown deadline time and the current time as a timing time value; and when the difference between the countdown deadline and the current time is not greater than a preset value, suspending timing or ending timing. The preset value is set according to specific situations, for example, 0 or other values, and the application is not limited thereto.
In some embodiments of the present application, if the timing type is forward timing, the start timing time is obtained. And determining the difference between the current time and the starting timing time as a timing time value. Specifically, a timer component is called to obtain the timing starting time. For example, if the start time is 9 days, 10 hours, 8 minutes, 18 seconds, and the current time is 9 days, 10 hours, 8 minutes, 18 seconds, the timer value is 0. After the timing is started, the timing time value changes along with the change of the current time so as to realize the timing function.
In a specific embodiment, whether the timing attribute information has initialization time is judged, and when the initialization time exists in the timing attribute information, the difference value between the current time and the starting timing time is added to the initialization time to obtain a timing time value; and when the initialization time does not exist in the timing attribute information, determining the difference value between the current time and the starting timing time as a timing time value. The initialization time is set as the case may be, for example, 0s, 10 s. Since the timer has an initialization time and does not start counting from 0, the count time value is obtained from the initialization time, and the timer can be applied to counting with the initialization time.
And S13, sending the timing information to the timing user interface component through the timing logic component.
In this embodiment, the timing information further includes a timing state adjustment function. Specifically, the timing state adjustment function is a pause start function. After the timing time value is obtained, the timing logic component sends the timing time value, the timing state and the timing state adjusting function to the timing user interface component by a method of cloning elements.
Specifically, the method for cloning elements takes element as a starting point, clones and returns a new React element. The generated elements will have the prop of the original element, with the new prop being a shallow merge. The new sub-element will replace the existing sub-element and key and ref will be preserved. The method receives three parameters, note the data type of the parameters: the first parameter is the necessary parameter: type (reactelement); the second parameter is an optional parameter: [ PROPS (object) ], the third parameter is an optional parameter: [ CHILDREN (ReactElement) ]. The first parameter is: parent React element for cloning. The second parameter is: adding new props to the React element generated after cloning or covering part or all of the props cloned from the parent. The third parameter: a new children is added to the newly generated React element, replacing the children cloned from the parent.
Specifically, the element cloning is performed by taking the timing user interface component as a child element and taking the timing state, the timing time value and the timing state adjusting function as attributes, and the timing state, the timing time value and the timing state adjusting function are sent to the timing user interface component. By cloning the element, the timing user interface component has the attribute of timing information.
In a specific embodiment, when the difference between the countdown deadline time and the current time is greater than a preset value; and judging whether the difference between the countdown deadline and the current time is greater than a preset value or not, if the difference between the countdown deadline and the current time is not greater than the preset value, calling a pause start function, and sending the timing time value, the timing state and the pause start function to a timing user interface component by a method of cloning elements by a timing logic component. The predetermined value is greater than the preset value, for example, the predetermined value is 1 day, 2 days, and the like, which is not limited in the present application. When the difference between the countdown deadline time and the current time is not more than a preset value, the timing is considered to be common countdown, and the timing needs to be controlled by a pause starting function; when the difference between the countdown deadline time and the current time is greater than a preset value, the countdown is regarded as the countdown from a certain future time point, and a pause starting function can not be called, so that the timing user interface is simple.
In another specific embodiment, when the initialization time exists in the timing attribute information, the pause start function is called, and the timing logic component sends the timing time value, the timing state and the pause start function to the timing user interface component through a method of cloning elements.
And S14, updating the timing user interface based on the timing information through the timing user interface component.
And when the timing user interface component has the attribute of the timing information, updating the timing user interface based on the timing information.
Furthermore, after receiving the updated timing user interface through the terminal, the user can control the timing logic component through the timing user interface. For example, after the user touches the start/pause button of the timing user interface, the timing user interface component runs a pause start function, sends an operation instruction of the user to the timing logic component, and updates the time according to the operation instruction of the user.
In a specific embodiment, if an operation instruction for suspending/ending timing is obtained, the timing logic component suspends/ends timing. And if an operation instruction for starting timing of a user is obtained, timing information is determined according to the timing attribute information through the timing logic component.
Different from the prior art, an embodiment of the present application provides a timing method, where the timing method is applied to a timing device, the timing device includes a timing logic component and a timing user interface component that are independent of each other, and the timing method includes: acquiring timing attribute information through a timing logic component; performing logic processing on the timing attribute information through a timing logic component to obtain timing information; sending the timing information to a timing user interface component through a timing logic component; and updating the timing user interface based on the timing information through the timing user interface component. According to the embodiment of the application, the timing logic and the timing user interface are separated, when different user interface effects are needed, timing attribute information corresponding to the different user interface effects is input, the input timing attribute information is processed through the calculation logic component to obtain the timing information, then the timing user interface component is used for rendering based on the timing information, the user interface effect can be rapidly adjusted through the input timing attribute information, the timing logic does not need to be changed, the high reuse of the calculation logic can be achieved, and the development efficiency is improved.
The timing method in the embodiment of the present application is described below with reference to a specific application scenario.
Referring to fig. 3, fig. 3 is a schematic flow chart of another embodiment of a timing method according to an embodiment of the present application. The timing method flow can comprise the following steps:
and S21, acquiring timing attribute information.
In the embodiment of the present application, the implementation of S21 may specifically refer to the specific implementation process of S11, and is not described herein again.
S22, based on the time measurement attribute information, determines whether the time measurement state is the start of time measurement.
In a specific embodiment, it is determined whether a timing state input value whose logic value is true exists in the timing attribute information, if so, the timing state is determined to be the start of timing, and if not, the timing state is determined to be the pause of timing or the end of timing. For example, if the input value of the timing state in the timing attribute information is "TRUE", the timing state is determined to be the start of timing; and if the timing state input value in the timing attribute information is 'FALSE', determining that the timing state is the time suspension or the end of the timing.
S23, pause or end timing.
And when the timing state is judged not to be the starting timing state based on the timing attribute information, indicating that the timing is not carried out at the moment, and pausing or ending the timing.
And S24, acquiring the current time.
Specifically, the current time is obtained by calling a timer component. For example, the current time is obtained as 9 days, 10 hours, 8 minutes, 8 seconds. The timer component is a basic component and is used for system timing and displaying the text of how much time passes from a certain timing starting time.
Specifically, a timer component is called according to a preset frequency to obtain the current time. The predetermined frequency may be 1HZ, 0.5HZ, or other values, which are not limited in this application. Namely, the numerical value of the current time is obtained in real time, so that the timing update is carried out.
S25, based on the time attribute information, determines whether the time type is countdown.
Specifically, it is determined whether the timing type is countdown. For example, whether countdown deadline exists in the timing attribute information is judged, and when the countdown deadline exists in the timing attribute information, the timing type is determined to be countdown; and when the countdown deadline does not exist in the timing attribute information, determining that the timing type is not countdown and the timing type is forward timing.
And S261, judging whether the difference between the countdown deadline and the current time is greater than a preset value.
If the timing type is determined to be countdown, whether the difference between countdown deadline time and current time is greater than a preset value is judged. The preset value is set according to specific situations, for example, 0 or other values, and the application is not limited thereto. When the difference between the countdown deadline and the current time is greater than the preset value, go to step 262; when the difference between the countdown deadline and the current time is not greater than the preset value, indicating that the countdown has expired, the counting may be suspended or ended, and step 23 is performed.
And S262, determining the difference between the countdown deadline and the current time as a timing time value.
In a specific embodiment, when the difference between the countdown deadline and the current time is greater than a preset value, the difference between the countdown deadline and the current time is determined as a count time value. For example, if the countdown expiration time is 9 days, 10 hours, 8 minutes, 18 seconds, and the current time is 9 days, 10 hours, 8 minutes, 8 seconds, the count-up time value is determined to be 10 seconds. Along with the change of the current time, the timing time value changes along with the change of the current time, and the timing function is realized.
S271, whether the initialization time exists in the timing attribute information is judged.
In a specific embodiment, it is determined whether there is an initialization time in the timing attribute information, and when there is an initialization time in the timing attribute information, it indicates that the timing is forward timing with the initialization time, S272 is performed; if the initialization time does not exist in the timer attribute information, indicating that the timer is normal forward timer, S273 is performed.
And S272, adding the difference value between the current time and the starting timing time to the initialization time to obtain a timing time value.
In a specific embodiment, the difference between the current time and the starting timing time is added to the initialization time to obtain the timing time value. For example, if the start time is 9 days, 10 hours, 8 minutes, 18 seconds, the current time is 9 days, 10 hours, 8 minutes, 18 seconds, and the initialization time is 31s, the timer value is 31 s. After the timing is started, the timing time value changes along with the change of the current time so as to realize the timing function.
And S273, determining the difference between the current time and the timing starting time as a timing time value.
In a particular embodiment, a start timing time is obtained. Specifically, a timer component is called to obtain the timing starting time. And determining the difference between the current time and the starting timing time as a timing time value. For example, if the start time is 9 days, 10 hours, 8 minutes, 18 seconds, and the current time is 9 days, 10 hours, 8 minutes, 18 seconds, the timer value is 0. After the timing is started, the timing time value changes along with the change of the current time so as to realize the timing function.
And S28, sending the timing information to the timing user interface component through the timing logic component.
Specifically, the element cloning is performed by taking the timing user interface component as a child element and taking the timing state, the timing time value and the timing state adjusting function as attributes, and the timing state, the timing time value and the timing state adjusting function are sent to the timing user interface component. By cloning the element, the timing user interface component has the attribute of timing information.
In a particular embodiment, the timing information further includes a timing state adjustment function. Specifically, the timing state adjustment function is a pause start function. After the timing time value is obtained, the timing logic component sends the timing time value, the timing state and the timing state adjusting function to the timing user interface component by a method of cloning elements.
And S29, updating the timing user interface based on the timing information through the timing user interface component.
And when the timing user interface component has the attribute of the timing information, updating the timing user interface based on the timing information.
Furthermore, after receiving the updated timing user interface through the terminal, the user can control the timing logic component through the timing user interface. For example, after the user touches the start/pause button of the timing user interface, the timing user interface component runs a pause start function, sends an operation instruction of the user to the timing logic component, and updates the time according to the operation instruction of the user.
And S291, acquiring an operation instruction of suspending/ending timing by the user.
If the operation instruction for suspending/ending the timing by the user is acquired, S23 is executed. Namely, the timing control is performed according to the user instruction.
And S292, acquiring an operation instruction for starting timing by the user.
If the operation command for starting the timing by the user is acquired, S24 is executed again. Namely, the timing is updated according to the user instruction.
Different from the prior art, an embodiment of the present application provides a timing method, where the timing method is applied to a timing device, the timing device includes a timing logic component and a timing user interface component that are independent of each other, and the timing method includes: acquiring timing attribute information through a timing logic component; performing logic processing on the timing attribute information through a timing logic component to obtain timing information; sending the timing information to a timing user interface component through a timing logic component; and updating the timing user interface based on the timing information through the timing user interface component. According to the embodiment of the application, the timing logic and the timing user interface are separated, when different user interface effects are needed, timing attribute information corresponding to the different user interface effects is input, the input timing attribute information is processed through the calculation logic component to obtain the timing information, then the timing user interface component is used for rendering based on the timing information, the user interface effect can be rapidly adjusted through the input timing attribute information, the timing logic does not need to be changed, the high reuse of the calculation logic can be achieved, and the development efficiency is improved.
Further, referring to fig. 4, fig. 4 is a schematic view of a timing user interface scene of the timing method of the present application.
In the embodiment of the present application, in order to obtain the user interface shown in fig. 4, a user writes timing attribute information through an API interface: the clocking state input value is "TURE". The process of the timing device to the timing user interface as shown in fig. 4 is then as follows:
the timing device obtains a timing state input value of 'TURE' through a timing logic component;
the timing device judges the timing state as starting timing according to the input value of the timing state as 'TURE' through the timing logic component;
the timing device acquires the current time of 9 days, 10 hours, 8 minutes and 8 seconds through a timing logic component;
the timing device judges whether the timing type is countdown or not based on the timing attribute information through the timing logic component, namely, judges that the timing type is forward timing;
the timing device acquires the starting timing time of 9 days, 10 hours, 6 minutes and 37 seconds through a timing logic component, and determines the difference 91S between the current time and the starting timing time as a timing time value;
the timing device sends a timing state and a timing time value to the timing user interface component through the timing logic component and by a method of cloning elements;
the timing device performs timing user interface rendering according to the timing state and the timing time value through the timing user interface component to obtain the timing user interface shown in fig. 4.
Further, referring to fig. 5, fig. 5 is a schematic view of another timing user interface scenario of the timing method of the present application.
In the embodiment of the present application, in order to obtain the user interface shown in fig. 5, a user writes timing attribute information through an API interface: the timer status input value is "tune" and the initialization time is "30 s". The process of the timing device obtaining the timing user interface shown in fig. 5 is as follows:
the timing device acquires a timing state input value of 'TURE' and an initialization time of '30 s' through a timing logic component;
the timing device judges the timing state as starting timing according to the input value of the timing state as 'TURE' through the timing logic component;
the timing device acquires the current time of 9 days, 10 hours, 8 minutes and 8 seconds through a timing logic component;
the timing device judges whether the timing type is countdown or not based on the timing attribute information through the timing logic component, namely, judges that the timing type is forward timing;
the timing device obtains the starting timing time of 9 days, 10 hours, 8 minutes and 8 seconds through a timing logic component, and judges that the initialization time is '30 s';
the timing device adds the difference value of the current time and the starting timing time with the initialization time through a timing logic component to obtain a timing time value, and the timing time value is determined to be 30 s;
the timing device calls a pause starting function through a timing logic component;
the timing device sends a timing state, a timing time value and a pause starting function to the timing user interface component through the timing logic component and by a method of cloning elements;
the timing device performs timing user interface rendering according to the timing state and the timing time value through the timing user interface component to obtain the timing user interface shown in fig. 5. When the user clicks the 'pause timing' button, the timing logic component pauses the timing.
Further, referring to fig. 6, fig. 6 is a schematic view of another timing user interface scenario of the timing method of the present application.
In the embodiment of the present application, in order to obtain the user interface shown in fig. 6, a user writes timing attribute information through an API interface: the timer status input value is "tune" and the countdown deadline is "9 days, 10 hours, 8 minutes, 16 seconds". The process of the timing device obtaining the timing user interface shown in fig. 6 is as follows:
the timing device acquires a timing state input value of 'TURE' and a countdown deadline of '9 days, 10 hours, 8 minutes and 16 seconds' through a timing logic component;
the timing device judges the timing state as starting timing according to the input value of the timing state as 'TURE' through the timing logic component;
the timing device acquires the current time of 9 days, 10 hours, 8 minutes and 8 seconds through a timing logic component;
the timing device judges the timing type to be countdown based on the timing attribute information through the timing logic component;
the timing device judges the difference between the countdown deadline and the current time to be 8s and larger than 0 through a timing logic component;
the timing device determines the difference between the countdown deadline and the current time as a timing time value and determines the timing time value as 8s through a timing logic component;
the timing device calls a pause starting function through a timing logic component;
the timing device sends a timing state, a timing time value and a pause starting function to the timing user interface component through the timing logic component and by a method of cloning elements;
the timing device performs timing user interface rendering according to the timing state and the timing time value through the timing user interface component to obtain the timing user interface shown in fig. 6. When the user clicks the 'pause countdown' button, the timing logic component pauses timing.
Further, referring to fig. 7, fig. 7 is a schematic view of another timing user interface scenario of the timing method of the present application.
In the embodiment of the present application, in order to obtain the user interface shown in fig. 7, a user writes timing attribute information through an API interface: the timer status input value is "tune" and the countdown deadline is "10 days, 21 hours, 20 minutes, 35 seconds". The process of the timing device obtaining the timing user interface shown in fig. 7 is as follows:
the timing device acquires a timing state input value of 'TURE' and a countdown deadline of '10 days, 21 hours, 20 minutes and 35 seconds' through a timing logic component;
the timing device judges the timing state as starting timing according to the input value of the timing state as 'TURE' through the timing logic component;
the timing device acquires the current time of 9 days, 10 hours, 8 minutes and 8 seconds through a timing logic component;
the timing device judges the timing type to be countdown based on the timing attribute information through the timing logic component;
the timing device judges that the difference between the countdown deadline and the current time is '12 minutes and 27 seconds at 11 hours in 1 day' and is greater than 0 through a timing logic component;
the timing device determines the difference between the countdown deadline and the current time as a timing time value through a timing logic component, and determines the timing time value as '1 day, 11 hours, 12 minutes, 27 seconds';
the timing device sends a timing state and a timing time value to the timing user interface component through the timing logic component and by a method of cloning elements;
the timing device performs timing user interface rendering according to the timing state and the timing time value through the timing user interface component to obtain the timing user interface shown in fig. 7.
Obviously, the timing information is obtained only by inputting the timing attribute input values corresponding to different timing user interface effects and performing logic motion on the timing logic component according to the timing attribute input values. And then, sending the timing information to a timing user interface component, and rendering the timing user interface according to the timing information and presenting the timing user interface to a user. The timing logic is not required to be modified at all, and various timing user interface effects can be obtained only by controlling the input value of the timing attribute. Through carrying out effectual split to traditional timing effect, not only kept the independence and reusing of core timing logic part like this, can also seamless adaptation various timing user interface effect's change, but wide application in various scenes that need the timing such as webpage and APP. Not only improves the development efficiency in the future, but also facilitates the later maintenance and upgrading and the like.
In order to better implement the timing method provided by the embodiments of the present application, the embodiments of the present application further provide a timing device based on the timing method. Wherein the noun is the same as that in the timing method, and the details of the implementation can be referred to the description in the method embodiment.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an embodiment of a timing device according to the present application, where the timing device may include a timing logic module 401 and a timing user interface module 402, which are as follows:
the timing logic module 401 is configured to obtain timing attribute information;
the timing logic module 401 is configured to determine timing information according to the timing attribute information;
the timing logic module 401 is configured to send timing information to the timing user interface component;
the timing user interface module 402 is configured to update the timing user interface based on the timing information.
The timing information includes a timing time value and a timing state, and the timing logic module 401 is specifically configured to determine the timing state based on the timing attribute information;
if the timing state is the starting timing state, determining the timing type based on the timing attribute information;
acquiring current time;
a timed time value is determined based on the timing type and the current time.
The timing logic module 401 is specifically configured to, when a timing state input value whose logic value is true exists in the timing attribute information, determine that the timing state is a start timing state.
The timing logic module 401 is specifically configured to determine a timing type based on the timing attribute information, including:
when the countdown deadline time exists in the timing attribute information, determining the timing type as countdown;
and when the countdown deadline does not exist in the timing attribute information, determining that the timing type is forward timing.
The timing logic module 401 is specifically configured to determine a difference between a countdown deadline and a current time as a timing time value if the timing type is countdown.
The timing logic module 401 is specifically configured to determine a difference between the countdown deadline and the current time as a timing time value when the difference between the countdown deadline and the current time is greater than a preset value.
The timing logic module 401 is specifically configured to, if the timing type is forward timing, obtain a timing start time;
and determining the difference between the current time and the starting timing time as a timing time value.
The timing logic module 401 is specifically configured to, when there is an initialization time in the timing attribute information, add a difference between the current time and the time to start timing to the initialization time to obtain a timing time value.
The timing information further includes a timing state adjustment function, and the timing logic module 401 is specifically configured to clone an element with the timing user interface component as a child element and with the timing state, the timing time value, and the timing state adjustment function as attributes, and send the timing state, the timing time value, and the timing state adjustment function to the timing user interface component.
Different from the prior art, the embodiment of the application provides a timing device, which comprises a timing logic module and a timing user interface module, wherein the timing logic module is used for acquiring timing attribute information; the timing logic module is used for determining timing information according to the timing attribute information; the timing logic module is used for sending timing information to the timing user interface component; and the timing user interface module is used for updating the timing user interface based on the timing information. According to the embodiment of the application, the timing logic and the timing user interface are separated, when different user interface effects are needed, timing attribute information corresponding to the different user interface effects is input, the input timing attribute information is processed through the calculation logic component to obtain the timing information, then the timing user interface component is used for rendering based on the timing information, the user interface effect can be rapidly adjusted through the input timing attribute information, the timing logic does not need to be changed, the high reuse of the calculation logic can be achieved, and the development efficiency is improved.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
The embodiment of the present application further provides a terminal, as shown in fig. 9, which shows a schematic structural diagram of the terminal according to the embodiment of the present application, specifically:
the terminal may include components such as a processor 501 of one or more processing cores, memory 502 of one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will appreciate that the terminal structure shown in fig. 9 does not constitute a limitation of the terminal, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 501 is a control center of the terminal, connects various parts of the entire terminal using various interfaces and lines, and performs various functions of the terminal and processes data by running or executing software programs and/or modules stored in the memory 502 and calling data stored in the memory 502, thereby performing overall monitoring of the terminal. Optionally, processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly handles operations of storage media, user interfaces, application programs, and the like, and the modem processor mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 501.
The memory 502 may be used to store software programs and modules, and the processor 501 executes various functional applications and data processing by operating the software programs and modules stored in the memory 502. The memory 502 may mainly include a storage program area and a storage data area, wherein the storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for operating a storage medium, at least one function, and the like; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
The terminal further comprises a power supply 503 for supplying power to each component, and preferably, the power supply 503 can be logically connected with the processor 501 through a power management storage medium, so that functions of managing charging, discharging, power consumption management and the like can be realized through the power management storage medium. The power supply 503 may also include any component of one or more dc or ac power sources, rechargeable storage media, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The terminal may also include an input unit 504, and the input unit 504 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the terminal may further include a display unit and the like, which will not be described in detail herein. Specifically, in this embodiment, the processor 501 in the terminal loads the executable file corresponding to the process of one or more application programs into the memory 502 according to the following instructions, and the processor 501 runs the application programs stored in the memory 502, so as to implement various functions as follows:
acquiring timing attribute information through a timing logic component; performing logic processing on the timing attribute information through a timing logic component to obtain timing information; sending the timing information to a timing user interface component through a timing logic component; and updating the timing user interface based on the timing information through the timing user interface component.
Different from the prior art, the timing logic and the timing user interface are split, when different user interface effects are needed, timing attribute information corresponding to the different user interface effects is input, the input timing attribute information is processed through the calculation logic assembly to obtain timing information, then the timing user interface assembly is used for rendering based on the timing information, the user interface effect can be rapidly adjusted through the input timing attribute information, the timing logic does not need to be changed, the high reuse of the calculation logic can be achieved, and the development efficiency is improved.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present application provides a storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the timing methods provided by the present application. For example, the instructions may perform the steps of:
acquiring timing attribute information through a timing logic component; performing logic processing on the timing attribute information through a timing logic component to obtain timing information; sending the timing information to a timing user interface component through a timing logic component; and updating the timing user interface based on the timing information through the timing user interface component.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the storage medium can execute the steps in any timing method provided in the embodiments of the present application, beneficial effects that can be achieved by any timing method provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
Different from the prior art, the timing logic and the timing user interface are split, when different user interface effects are needed, timing attribute information corresponding to the different user interface effects is input, the input timing attribute information is processed through the calculation logic assembly to obtain timing information, then the timing user interface assembly is used for rendering based on the timing information, the user interface effect can be rapidly adjusted through the input timing attribute information, the timing logic does not need to be changed, the high reuse of the calculation logic can be achieved, and the development efficiency is improved.
The timing method and the timing device provided by the embodiments of the present application are described in detail above, and the principle and the implementation of the present application are explained in the present application by applying specific examples, and the description of the embodiments above is only used to help understanding the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A timing method is applied to a timing device, the timing device comprises a timing logic component and a timing user interface component which are independent from each other, and the timing method comprises the following steps:
acquiring timing attribute information through the timing logic component;
determining timing information according to the timing attribute information through the timing logic component;
sending the timing information to the timing user interface component through the timing logic component;
and updating the timing user interface based on the timing information through the timing user interface component.
2. The timing method according to claim 1, wherein the timing information includes a timing time value and a timing status, and the determining, by the timing logic component, the timing information according to the timing attribute information includes:
determining a timing status based on the timing attribute information;
if the timing state is the starting timing state, determining a timing type based on the timing attribute information;
acquiring current time;
determining the timed time value based on the timing type and the current time.
3. The timing method according to claim 2, wherein the determining a timing status based on the timing attribute information includes:
and when a timing state input value with a true logic value exists in the timing attribute information, the timing state is the start of timing.
4. The timing method according to claim 2, wherein said determining a timing type based on the timing attribute information comprises:
when countdown deadline time exists in the timing attribute information, determining that the timing type is countdown;
and when the countdown deadline does not exist in the timing attribute information, determining that the timing type is forward timing.
5. The timing method of claim 4, wherein said determining the timing time value based on the timing type and the current time comprises:
and if the timing type is countdown, determining the difference between the countdown deadline time and the current time as the timing time value.
6. The timing method according to claim 5, wherein determining a difference between the countdown deadline and the current time as the timing time value comprises:
and when the difference between the countdown deadline and the current time is greater than a preset value, determining the difference between the countdown deadline and the current time as the timing time value.
7. The timing method of claim 4, wherein said determining the timing time value based on the timing type and the current time comprises:
if the timing type is forward timing, acquiring timing starting time;
and determining the difference value between the current time and the starting timing time as the timing time value.
8. The timing method according to claim 7, wherein the determining the difference between the current time and the starting timing time as the timing time value comprises:
and when the timing attribute information has initialization time, adding the difference value between the current time and the starting timing time to the initialization time to obtain a timing time value.
9. The timing method of any one of claims 2-8, wherein the timing information further comprises a timing state adjustment function, and wherein sending the timing information to the timing user interface component via the timing logic component comprises:
and taking the timing user interface component as a child element, taking the timing state, the timing time value and the timing state adjusting function as attributes, cloning the elements, and sending the timing state, the timing time value and the timing state adjusting function to the timing user interface component.
10. A timing device, comprising a timing logic module and a timing user interface module,
the timing logic module is used for acquiring timing attribute information;
the timing logic module is used for determining timing information according to the timing attribute information;
the timing logic module is used for sending the timing information to the timing user interface component;
and the timing user interface module is used for updating the timing user interface based on the timing information.
CN201910641875.2A 2019-07-16 2019-07-16 Timing method and timing device Pending CN112241504A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910641875.2A CN112241504A (en) 2019-07-16 2019-07-16 Timing method and timing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910641875.2A CN112241504A (en) 2019-07-16 2019-07-16 Timing method and timing device

Publications (1)

Publication Number Publication Date
CN112241504A true CN112241504A (en) 2021-01-19

Family

ID=74166911

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910641875.2A Pending CN112241504A (en) 2019-07-16 2019-07-16 Timing method and timing device

Country Status (1)

Country Link
CN (1) CN112241504A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506805A (en) * 2021-01-29 2021-03-16 卡斯柯信号(北京)有限公司 User interface countdown testing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110072371A1 (en) * 2009-09-18 2011-03-24 Microsoft Corporation Application programming interface for user interface creation
CN103914292A (en) * 2013-01-04 2014-07-09 杭州勒卡斯广告策划有限公司 RIA (Rich Internet Application) based user interface generation method and device
CN106598556A (en) * 2015-10-15 2017-04-26 阿里巴巴集团控股有限公司 User interface generation method and device
CN106681715A (en) * 2016-12-09 2017-05-17 北京五八信息技术有限公司 Timing function implementation method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110072371A1 (en) * 2009-09-18 2011-03-24 Microsoft Corporation Application programming interface for user interface creation
CN103914292A (en) * 2013-01-04 2014-07-09 杭州勒卡斯广告策划有限公司 RIA (Rich Internet Application) based user interface generation method and device
CN106598556A (en) * 2015-10-15 2017-04-26 阿里巴巴集团控股有限公司 User interface generation method and device
CN106681715A (en) * 2016-12-09 2017-05-17 北京五八信息技术有限公司 Timing function implementation method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506805A (en) * 2021-01-29 2021-03-16 卡斯柯信号(北京)有限公司 User interface countdown testing method and device

Similar Documents

Publication Publication Date Title
US20200034725A1 (en) Methods and system for managing predictive models
CN108563579B (en) White box testing method, device and system and storage medium
CN111290768B (en) Updating method, device, equipment and medium of containerized application system
CN109840115A (en) RecyclerView paging loading method and device in a kind of android system
US11768668B2 (en) Methods, apparatuses and computer program products for improving productivity for building applications
CN114089974B (en) Cloud code development system, method, device, equipment and storage medium
CN113342386A (en) Hot updating method for go server and related equipment
CN113254217A (en) Service message processing method and device and electronic equipment
CN112241504A (en) Timing method and timing device
US20080010315A1 (en) Platform management of high-availability computer systems
CN116560802B (en) Virtual machine load-based virtual machine self-adaptive thermal migration method and system
CN112328225A (en) Page operation method and operation system thereof
CN107479982B (en) data synchronization method and terminal
CN116088842A (en) AI algorithm engine system and method applied to Internet of things platform
CN110941476B (en) Control method, control device and control equipment for virtual machine live migration
CN114237824A (en) Fault positioning method and device, computer readable medium and electronic equipment
CN111080250B (en) Flow backspacing compensation method and device, storage medium and electronic equipment
CN113051122A (en) Performance data acquisition method, performance data acquisition device, electronic equipment and medium
CN109189498B (en) Android horizontal and vertical screen data synchronization method and device, terminal and readable medium
CN112426722A (en) Node map hot updating method and device, storage medium and computer equipment
CN112925658A (en) Bridging method and device
WO2015183442A1 (en) Methods and system for managing predictive models
CN111124386A (en) Unity-based animation event processing method, device, equipment and storage medium
CN115134240B (en) Intelligent scene optimization method and device, storage medium and electrical equipment
CN115129323B (en) Method, device and equipment for processing data resource packet 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