CN107479982A - The method and terminal of a kind of data syn-chronization - Google Patents
The method and terminal of a kind of data syn-chronization Download PDFInfo
- Publication number
- CN107479982A CN107479982A CN201710531155.1A CN201710531155A CN107479982A CN 107479982 A CN107479982 A CN 107479982A CN 201710531155 A CN201710531155 A CN 201710531155A CN 107479982 A CN107479982 A CN 107479982A
- Authority
- CN
- China
- Prior art keywords
- attribute
- value
- user interface
- binding information
- source object
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
Abstract
The present invention relates to the method and terminal of coding field, more particularly to a kind of data syn-chronization.The present invention passes through S1, default source object;S2, obtain a user interface components corresponding with the source object;S3, the first attribute of the binding source object and a user interface components the second attribute;S4, when the value of first attribute changes, the value of second attribute is updated according to the currency of first attribute.Resource utilization ratio is improved during the data that the business datum and business presentation layer realized in the generation of synchronous service logical layer is shown, system loading is reduced, so as to improve systematic function and Consumer's Experience.
Description
Technical field
The present invention relates to the method and terminal of coding field, more particularly to a kind of data syn-chronization.
Background technology
Traditional front end exploitation, it is most of to use MVC frameworks or similar framework, wherein, distributed usually using event
The data that user interface components are shown in the business datum and business presentation layer of the generation of mechanism synchronous service logical layer.When business number
When according to changing, an event is distributed, the user interface components in business presentation layer can monitor these events, if this
Individual event is the user interface components needs, and the content of event will be presented in user interface.
Such as in gaming, when player is cut, just distribute the event of one entitled " cutting ", the content of event
It is the value of player id and player's current attribute (blood volume, magic, muscle power ...).At this moment, Same Scene all players use
Family interface assembly can all receive this event, then according to player id, judge whether this event is relevant with oneself and (played in event
Family id is equal to player id corresponding to user interface components), if relevant, other attributes of event are taken out, user circle is arrived in renewal
In face.
But if current scene has 1,000 players, then while there are 1,000 players to respond the event of cutting,
But this event of real concern, simply one of player.Therefore, mechanism synchronous service is distributed using existing event to patrol
The data that user interface components are shown in the business datum and business presentation layer of the generation of volume layer, resource utilization ratio is low, system
Load is big, so as to reduce systematic function, influences Consumer's Experience.
The content of the invention
The technical problems to be solved by the invention are:How synchronous service logical layer generation business datum and traffic table
Resource utilization ratio is improved during the data that existing layer is shown.
In order to solve the above-mentioned technical problem, the technical solution adopted by the present invention is:
The present invention provides a kind of method of data syn-chronization, including:
S1, default source object;
S2, obtain a user interface components corresponding with the source object;
S3, the first attribute of the binding source object and a user interface components the second attribute;
S4, when the value of first attribute changes, according to the currency of first attribute update described second
The value of attribute.
The present invention also provides a kind of terminal of data syn-chronization, including one or more processors and memory, the storage
Device has program stored therein, and is configured to by one or more of computing device following steps:
S1, default source object;
S2, obtain a user interface components corresponding with the source object;
S3, the first attribute of the binding source object and a user interface components the second attribute;
S4, when the value of first attribute changes, according to the currency of first attribute update described second
The value of attribute.
The beneficial effects of the present invention are:The present invention is by being directly bound the attribute of source object and corresponding with source object using
The attribute of family interface assembly so that with source object binding user interface components property value with source object attribute value changes,
And the user interface components of other objects in Same Scene in addition to the source object will not respond action, realize same
Resource utilization ratio is improved during the data that the business datum and business presentation layer of step Business Logic generation are shown, is dropped
Low system loading, so as to improve systematic function and Consumer's Experience.
Brief description of the drawings
Fig. 1 is a kind of FB(flow block) of the embodiment of the method for data syn-chronization provided by the invention;
Fig. 2 is a kind of structured flowchart of the embodiment of the terminal of data syn-chronization provided by the invention;
Label declaration:
1st, processor;2nd, memory.
Embodiment
To describe the technology contents of the present invention, the objects and the effects in detail, below in conjunction with embodiment and coordinate attached
Figure is explained.
Fig. 1 to Fig. 2 is refer to,
As shown in figure 1, the present invention provides a kind of method of data syn-chronization, including:
S1, default source object;
S2, obtain a user interface components corresponding with the source object;
S3, the first attribute of the binding source object and a user interface components the second attribute;
S4, when the value of first attribute changes, according to the currency of first attribute update described second
The value of attribute.
Further, also include after the S3:
Generate binding information;The binding information includes the unique identifier of the source object, the name of first attribute
The title of title, the unique identifier of a user interface components and second attribute;
The binding information is preserved to default binding information list.
Further, the S4 is specially:
When the value of first attribute changes,
Judge to whether there is the second attribute with first attribute binding in the binding information list, if in the presence of,
The value of second attribute is updated according to the currency of first attribute.
Further, in addition to:
The binding information is deleted from the binding information list.
Further, in addition to:
Unbind first attribute and second attribute.
As shown in Fig. 2 the present invention also provides a kind of terminal of data syn-chronization, including one or more processors 1 and storage
Device 2, the memory 2 have program stored therein, and are configured to perform following steps by one or more of processors 1:
S1, default source object;
S2, obtain a user interface components corresponding with the source object;
S3, the first attribute of the binding source object and a user interface components the second attribute;
S4, when the value of first attribute changes, according to the currency of first attribute update described second
The value of attribute.
Further, also include after the S3:
Generate binding information;The binding information includes the unique identifier of the source object, the name of first attribute
The title of title, the unique identifier of a user interface components and second attribute;
The binding information is preserved to default binding information list.
Further, the S4 is specially:
When the value of first attribute changes,
Judge to whether there is the second attribute with first attribute binding in the binding information list, if in the presence of,
The value of second attribute is updated according to the currency of first attribute.
Further, in addition to:
The binding information is deleted from the binding information list.
Further, in addition to:
Unbind first attribute and second attribute.
Embodiments of the invention one are:
The present embodiment provides a kind of method of data syn-chronization, including:
S1, default source object;
For example, in gaming, it is source object to preset player's object Player;
S2, obtain a user interface components corresponding with the source object;
For example, obtain user interface components hpLabel corresponding with player's object Player, user interface components
HpLabel is used for the current blood volume for showing player's object Player;
S3, the first attribute of the binding source object and a user interface components the second attribute;
For example, the blood volume value attribute hp and nest hpLabel of binding source object attribute text, wherein, Yong Hujie
The player's blood volume value shown on face is identical with hpLabel attribute text value;
S4, generation binding information;The unique identifier of the binding information including the source object, first attribute
The title of title, the unique identifier of a user interface components and second attribute;
For example, binding information is { Player, hp, hpLabel, text }, the first category of source object, source object is represented successively
Property value, user interface components, the second property value of user interface components;
S5, the binding information is preserved to default binding information list;
S6, when the value of first attribute changes, according to the currency of first attribute update described second
The value of attribute;Specially:
When the value of first attribute changes,
Judge to whether there is the second attribute with first attribute binding in the binding information list, if in the presence of,
The value of second attribute is updated according to the currency of first attribute;
Wherein, when the value of hp attributes changes, player's object Player can send the notice of player's blood volume value changes
Message, after system notified message, automatic search binding information list checks whether to exist with player's object Player's
The user interface components of hp attributes binding, so as to find the user interface components being associated, without in current game scene
All player's objects all user interface components be carried out judging itself whether be player's object Player affiliated partner
Operation, during the business datum and the data that shows of business presentation layer of synchronous service logical layer generation improving system provides
Source utilization rate;
For example, player's object player is cut by strange beast object monster, blood volume value reduces, then the value of hp attributes is by original
100 come are changed into 80, and now, user interface components hpLabel text property values are updated to 80, and object for appreciation is shown in user interface
Family object player blood volume value is 80;
S7, unbind first attribute and second attribute;Specially:
The binding information is deleted from the binding information list;
Wherein, the binding relationship of attribute between different objects can be flexibly set, be easy to later maintenance.
Seen from the above description, the method for data synchronization that the present embodiment provides is by being directly bound player's object Player's
The user interface components hpLabel of hp attributes and player's object text attributes so that when player's object Player hp belongs to
Property value when changing, user interface components hpLabel text property values become therewith, so that showing in user interface
The player's blood volume value shown changes.The method of data synchronization that the present embodiment provides exists compared with existing event distributes mechanism
Advantages below:
Firstth, during synchronous hp property values and text property values, user circle of other objects in Same Scene
Face component will not respond action, compared with existing event distributes mechanism, in the business number of synchronous service logical layer generation
Resource utilization ratio is improved during according to the data shown with business presentation layer, system loading is reduced, so as to improve
Systematic function and Consumer's Experience;
Secondth, the method for data synchronization of mechanism realization is distributed based on event, as system complexity improves, function increases,
Event in system is various, and the later stage is difficult to safeguard;And the method for data synchronization that the present embodiment provides is tieed up by binding information list
The binding relationship of attribute between different objects is protected, without changing source code, only need to change binding information list can easily safeguard respectively
Binding relationship between object, improve the convenience of later maintenance;
3rd, distributed based on event mechanism realization method of data synchronization in event model only be responsible for event distribute and
Monitor, the specific implementation code of synchronization properties value needs to repeat to write in different user interface components, e.g., according to player couple
As the value renewal user interface components hpLabel of Player hp attributes text attributes, according to player's object Player's
The value renewal user interface components levelLabel of level attributes text attributes, the service logic of two data simultaneously operating
It is identical, is assignment operation, needs to compile when writing code using the method for data synchronization for distributing mechanism realization based on event
Write two synchronization statements that service logic is identical but parameter is different;And the method for data synchronization provided using the present embodiment only needs to compile
A synchronization statements are write, the information in binding information list synchronizes operation, reduces the redundancy of code;
4th, event, upgrade event are cut, multiple different events such as medicine event is drunk and can all trigger player's object Player
Hp property values change, when using based on event distribute mechanism realization method of data synchronization when, if hp attributes can be caused
Some logic of value changes is not provided with event and distributes mechanism, then can cause blood volume Value Data and business datum that user interface is shown
It is asynchronous;And method of data synchronization provided by the invention is directly bound two attributes, i.e., become in an object's property value
During change, the specified attribute of automatic synchronization to another object, the generation that " leakage " distribute event is avoided from source, it is same to improve data
The degree of accuracy of step.
Embodiments of the invention two are:
The present embodiment provides a kind of terminal of data syn-chronization, including one or more processors 1 and memory 2, described to deposit
Reservoir 2 has program stored therein, and is configured to perform following steps by one or more of processors 1:
S1, default source object;
S2, obtain a user interface components corresponding with the source object;
S3, the first attribute of the binding source object and a user interface components the second attribute;
S4, generation binding information;The unique identifier of the binding information including the source object, first attribute
The title of title, the unique identifier of a user interface components and second attribute;
S5, the binding information is preserved to default binding information list;
S6, when the value of first attribute changes, according to the currency of first attribute update described second
The value of attribute;Specially:
When the value of first attribute changes,
Judge to whether there is the second attribute with first attribute binding in the binding information list, if in the presence of,
The value of second attribute is updated according to the currency of first attribute;
S7, unbind first attribute and second attribute;Specially:
The binding information is deleted from the binding information list.
In summary, the method and terminal of a kind of data syn-chronization provided by the invention, by the category for being directly bound source object
Property and user interface components corresponding with source object attribute so that with source object binding user interface components property value with
The attribute value changes of source object, and the user interface components of other objects in Same Scene in addition to the source object will not be made
Response action, realize and carried during the data that the business datum and business presentation layer that synchronous service logical layer generates are shown
High resource utilization ratio, system loading is reduced, so as to improve systematic function and Consumer's Experience.Further, based on event
The method of data synchronization of mechanism realization is distributed, as system complexity improves, function increases, the event in system is various, the later stage
It is difficult to safeguard;And the binding that the method for data synchronization that the present embodiment provides passes through attribute between binding information list maintenance difference object
Relation, without changing source code, need to only change binding information list can easily safeguard binding relationship between each object, improve
The convenience of later maintenance;Further, the event model distributed based on event in the method for data synchronization of mechanism realization is only born
Duty event distributing and monitoring, and the specific implementation code of synchronization properties value needs to repeat to compile in different user interface components
Write, e.g., user interface components hpLabel text attributes are updated according to the value of player's object Player hp attributes, according to object for appreciation
The value renewal user interface components levelLabel of family object Player level attributes text attributes, two data syn-chronizations
The service logic of operation is identical, is assignment operation, is existed using the method for data synchronization that mechanism realization is distributed based on event
Two synchronization statements that service logic is identical but parameter is different need to be write when writing code;And the data for using the present embodiment to provide
Synchronous method need to only write a synchronization statements, and the information in binding information list synchronizes operation, reduced
The redundancy of code;Further, event, upgrade event are cut, multiple different events such as medicine event is drunk and can all trigger player
Object Player hp property values change, when using the method for data synchronization that mechanism realization is distributed based on event, if meeting
Cause some logic of hp attribute value changes to be not provided with event and distribute mechanism, then the blood volume Value Data that user interface can be caused to show
It is asynchronous with business datum;And method of data synchronization provided by the invention is directly bound two attributes, the i.e. category in an object
When property value changes, the specified attribute of automatic synchronization to another object, the generation that " leakage " distribute event is avoided from source,
Improve the degree of accuracy of data syn-chronization.
Embodiments of the invention are the foregoing is only, are not intended to limit the scope of the invention, it is every to utilize this hair
The equivalents that bright specification and accompanying drawing content are made, or the technical field of correlation is directly or indirectly used in, similarly include
In the scope of patent protection of the present invention.
Claims (10)
- A kind of 1. method of data syn-chronization, it is characterised in that including:S1, default source object;S2, obtain a user interface components corresponding with the source object;S3, the first attribute of the binding source object and a user interface components the second attribute;S4, when the value of first attribute changes, second attribute is updated according to the currency of first attribute Value.
- 2. the method for data syn-chronization according to claim 1, it is characterised in that also include after the S3:Generate binding information;The binding information includes the unique identifier of the source object, the title of first attribute, institute State the unique identifier of a user interface components and the title of second attribute;The binding information is preserved to default binding information list.
- 3. the method for data syn-chronization according to claim 2, it is characterised in that the S4 is specially:When the value of first attribute changes,Judge to whether there is the second attribute with first attribute binding in the binding information list, if in the presence of basis The currency of first attribute updates the value of second attribute.
- 4. the method for data syn-chronization according to claim 2, it is characterised in that also include:The binding information is deleted from the binding information list.
- 5. the method for data syn-chronization according to claim 1, it is characterised in that also include:Unbind first attribute and second attribute.
- 6. a kind of terminal of data syn-chronization, it is characterised in that including one or more processors and memory, the memory is deposited Program is contained, and is configured to by one or more of computing device following steps:S1, default source object;S2, obtain a user interface components corresponding with the source object;S3, the first attribute of the binding source object and a user interface components the second attribute;S4, when the value of first attribute changes, second attribute is updated according to the currency of first attribute Value.
- 7. the terminal of data syn-chronization according to claim 6, it is characterised in that also include after the S3:Generate binding information;The binding information includes the unique identifier of the source object, the title of first attribute, institute State the unique identifier of a user interface components and the title of second attribute;The binding information is preserved to default binding information list.
- 8. the terminal of data syn-chronization according to claim 7, it is characterised in that the S4 is specially:When the value of first attribute changes,Judge to whether there is the second attribute with first attribute binding in the binding information list, if in the presence of basis The currency of first attribute updates the value of second attribute.
- 9. the terminal of data syn-chronization according to claim 7, it is characterised in that also include:The binding information is deleted from the binding information list.
- 10. the terminal of data syn-chronization according to claim 6, it is characterised in that also include:Unbind first attribute and second attribute.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710531155.1A CN107479982B (en) | 2017-07-03 | 2017-07-03 | data synchronization method and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710531155.1A CN107479982B (en) | 2017-07-03 | 2017-07-03 | data synchronization method and terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107479982A true CN107479982A (en) | 2017-12-15 |
CN107479982B CN107479982B (en) | 2020-01-31 |
Family
ID=60595289
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710531155.1A Active CN107479982B (en) | 2017-07-03 | 2017-07-03 | data synchronization method and terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107479982B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020001614A1 (en) * | 2018-06-29 | 2020-01-02 | 杭州海康威视数字技术股份有限公司 | Ontology construction method and apparatus |
CN116319094A (en) * | 2023-05-19 | 2023-06-23 | 北京安帝科技有限公司 | Data safety transmission method, computer equipment and medium based on tobacco industry |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1555612A2 (en) * | 2004-01-02 | 2005-07-20 | Microsoft Corporation | System and method for implicit synchronization of message-queue-based user interface with an automatic code |
CN1684034A (en) * | 2004-04-13 | 2005-10-19 | 微软公司 | Application of data-binding mechanism to perform command binding |
CN1922609A (en) * | 2004-02-19 | 2007-02-28 | 高通剑桥有限公司 | Rendering a user interface |
CN100371900C (en) * | 2006-01-19 | 2008-02-27 | 华为技术有限公司 | Method and system for synchronizing data |
CN103597464A (en) * | 2011-06-13 | 2014-02-19 | 微软公司 | Techniques for adapting an interpretive runtime application to multiple clients |
-
2017
- 2017-07-03 CN CN201710531155.1A patent/CN107479982B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1555612A2 (en) * | 2004-01-02 | 2005-07-20 | Microsoft Corporation | System and method for implicit synchronization of message-queue-based user interface with an automatic code |
CN1922609A (en) * | 2004-02-19 | 2007-02-28 | 高通剑桥有限公司 | Rendering a user interface |
CN1684034A (en) * | 2004-04-13 | 2005-10-19 | 微软公司 | Application of data-binding mechanism to perform command binding |
CN100371900C (en) * | 2006-01-19 | 2008-02-27 | 华为技术有限公司 | Method and system for synchronizing data |
CN103597464A (en) * | 2011-06-13 | 2014-02-19 | 微软公司 | Techniques for adapting an interpretive runtime application to multiple clients |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020001614A1 (en) * | 2018-06-29 | 2020-01-02 | 杭州海康威视数字技术股份有限公司 | Ontology construction method and apparatus |
CN116319094A (en) * | 2023-05-19 | 2023-06-23 | 北京安帝科技有限公司 | Data safety transmission method, computer equipment and medium based on tobacco industry |
Also Published As
Publication number | Publication date |
---|---|
CN107479982B (en) | 2020-01-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103338135B (en) | A kind of method for real-time monitoring of cluster storage capacity | |
CN109542865A (en) | Distributed cluster system configuration file synchronous method, device, system and medium | |
CN103889524B (en) | Computer readable recording medium storing program for performing, data structure, netscape messaging server Netscape and the information processing terminal of information processing system, information processing method, message handling program, storing information processing program | |
CN108664660A (en) | Distributed implementation method, apparatus, equipment and the storage medium of time series database | |
CN108667867A (en) | Date storage method and device | |
CN107678918A (en) | The OSD heartbeat mechanisms method to set up and device of a kind of distributed file system | |
CN108388622A (en) | Api interface dynamic creation method, device, computer equipment and storage medium | |
CN103763368B (en) | A kind of method of data synchronization across data center | |
CN110175239A (en) | A kind of construction method and system of knowledge mapping | |
CN107301095A (en) | System operation method and operating system | |
CN109684097A (en) | A kind of parsing of JSON data and storage method based on CMSP | |
CN110311798A (en) | A kind of method and device managing virtual resource | |
CN109977093A (en) | More virtual systems based on LXC check the method and device of container log | |
CN108446373A (en) | Animation playing method, device, equipment and storage medium | |
CN105357042A (en) | High-availability cluster system, master node and slave node | |
CN107193674A (en) | The processing method and processing device of online PUSH message | |
CN107479982A (en) | The method and terminal of a kind of data syn-chronization | |
CN109783573A (en) | The method of data synchronization and terminal of multichannel push | |
CN110532059A (en) | The quota management method and device of K8s cluster management software | |
CN106709229B (en) | The method and device of NPC object priority response in a kind of game system | |
CN109726038A (en) | Method and apparatus for managing virtual machine | |
CN106856441A (en) | VIM systems of selection and device in NFVO | |
CN104166546A (en) | Implementation method and system used for data distribution service (DDS) application software and based on model driven architecture (MDA) | |
CN109783321A (en) | Monitoring data management method, device, terminal device | |
CN107609090A (en) | More copy weak consistency maintaining methods in distributed memory system |
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 |