Service processing method and apparatus

By creating coroutine scope objects and dependency injection scope objects in the video playback page, and using the dependency injection framework to manage business units, the problems of high code complexity and maintenance difficulty are solved, and efficient development and simplified maintenance are achieved.

WO2025040123A1PCT designated stage expired Publication Date: 2025-02-27SHANGHAI HODE INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/113682
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-21
Filing Date
2024-08-21
Publication Date
2025-02-27

AI Technical Summary

Technical Problem

Due to the high code complexity, maintenance difficulty and low development efficiency of video playback pages, and the integration of multiple playback pages increases code complexity and maintenance costs.

Method used

By creating target coroutine scope objects and target dependency injection scope objects, use the dependency injection framework to create target business units in target dependency injection scope objects, and run target business units under target coroutine scope objects to manage their life cycle.

Benefits of technology

It effectively reduces the amount of code, improves development efficiency, realizes self-running of business logic based on corresponding life cycles, and simplifies code maintenance and management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024113682_27022025_PF_FP_ABST
    Figure CN2024113682_27022025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application is a service processing method. The service processing method comprises: creating a target coroutine scope object; creating in a dependency injection framework a target dependency injection scope object corresponding to the target coroutine scope object; on the basis of the target coroutine scope object and the target dependency injection scope object, creating a target service unit; and operating the target service unit under the target coroutine scope object so as to manage the target service unit. The technical solution of the embodiments of the present application can create the target service unit in the target dependency injection scope object, thus effectively reducing the code quantity, and improving development efficiency. The target service unit is correspondingly operated under the target coroutine scope object, and therefore, by means of the target coroutine scope, the self-operation of a service logic based on a corresponding life cycle can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Business processing method and device

[0001] This application claims the priority of Chinese patent application number 202311055149.5 filed on August 21, 2023 and entitled “Business Processing Method and Device”. The entire content of the Chinese patent application is incorporated into this application by reference. Technical Field

[0002] The embodiments of the present application relate to the field of computer technology, and in particular to a business processing method, apparatus, computer equipment, and computer-readable storage medium. Background Art

[0003] A video platform is an online service platform used to store, manage, publish, play, and share video content. As a core user consumption scenario, the video playback page needs to handle complex services. Taking a video client as an example, the video playback page may include: the uploader's manuscript playback page, the live broadcast playback page, the animation and film playback page, and so on. Each playback page aggregates a large number of services, and it is necessary to handle the conversion of various services to the playback page and the functional display of each service on the playback page. As can be seen, the playback page has complex functions and high code complexity.

[0004] The inventors have realized that the aforementioned play page or a fusion page of multiple play pages is often difficult to maintain and has low development efficiency due to complex codes.

[0005] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a business processing method, apparatus, computer device, and computer-readable storage medium to solve or alleviate one or more technical problems raised above.

[0008] One aspect of an embodiment of the present application provides a service processing method, the method comprising:

[0009] Create the target coroutine scope object;

[0010] Creating a target dependency injection scope object corresponding to the target coroutine scope object in a dependency injection framework;

[0011] Create the target business unit according to the target coroutine scope object and the target dependency injection scope object;

[0012] The target business unit is run under the target coroutine scope object to manage the target business unit.

[0013] Optionally, the target dependency injection scope object declares a target business anchor point, and the target business anchor point includes multiple business units;

[0014] Correspondingly, creating the target business unit according to the target coroutine scope object and the target dependency injection scope object includes:

[0015] Bind the target coroutineScope object to the target dependency injectionScope object;

[0016] In the target dependency injection scope object, a target business unit is created through the target coroutine scope object and the target business anchor.

[0017] Optionally, there are multiple services, and the multiple services correspond to multiple service scopes;

[0018] The multiple business scopes are divided into multiple levels of business scopes;

[0019] In the multi-level business scope, the upper-level business scope includes one or more lower-level business scopes;

[0020] Among them, each business scope corresponds to a coroutine scope object and a dependency injection scope object;

[0021] The level of business scope corresponds to the level of coroutine scope objects and the level of dependency injection scope objects.

[0022] Optionally, the target coroutinescope object corresponds to a first-level coroutinescope object, and the target dependency injection scope object corresponds to a first-level dependency injection scope object;

[0023] The business processing method further includes:

[0024] In response to a target event, create a secondary coroutineScope object under the primary coroutineScope object;

[0025] Creating a secondary dependency injection scope object corresponding to the secondary coroutine scope object in the dependency injection framework;

[0026] Create the secondary business unit according to the secondary coroutine scope object and the secondary dependency injection scope object;

[0027] The secondary business unit is run under the secondary coroutine scope object to manage the life cycle of the secondary business unit.

[0028] Optionally, the target business unit serves as a first-level business unit, configured to serve the second-level coroutinescope object and its subordinate coroutinescope objects.

[0029] Optionally, the target service unit is used to provide a driving service event flow.

[0030] Optionally, the target coroutine scope object is a first-level coroutine scope object corresponding to the play page, and the target dependency injection scope object is a first-level dependency injection scope object corresponding to the play page; wherein the play page is configured with first and second-level services and second and second-level services; correspondingly, the service processing method further includes:

[0031] In response to selected events for the first and second level services, creating first and second level coroutine scope objects under the first level coroutine scope object and creating first and second level dependency injection scope objects under the first level dependency injection scope object;

[0032] Create first and second-level business units according to the first and second-level coroutine scope objects and the first and second-level dependency injection scope objects;

[0033] The first secondary business unit is run under the first secondary coroutine scope object to manage the life cycle of the first secondary business unit.

[0034] Optionally, the first-level secondary service and the second-level secondary service are mutually exclusive, and the service processing method further includes:

[0035] In response to a selected event for a second secondary service, destroy the first secondary coroutineScope object, and create a second secondary coroutineScope object under the first secondary coroutineScope object and a second secondary dependency injection scope object under the first dependency injection scope object;

[0036] Create a second secondary business unit according to the second secondary coroutineScope object and the second secondary dependency injection scope object;

[0037] The second secondary business unit is run under the second secondary coroutine scope object to manage the life cycle of the second secondary business unit.

[0038] Optionally, the first-level service is associated with a first-level service, wherein the first-level service is used to play one or more media objects; correspondingly, the service processing method further includes:

[0039] In response to a selected event for a first media object in the first third-level service, creating a first third-level coroutineScope object corresponding to the first media object under the first second-level coroutineScope object, and creating a first third-level dependency injectionscope object corresponding to the first media object under the first second-level dependency injection scope;

[0040] Creating a first third-level business unit corresponding to the first media object according to the first third-level coroutine scope object corresponding to the first media object and the first third-level dependency injection scope object corresponding to the first media object;

[0041] The first third-level business unit corresponding to the first media object is run under the first third-level coroutine scope object corresponding to the first media object to manage the life cycle of the first third-level business unit corresponding to the first media object.

[0042] Optionally, the business processing method further includes:

[0043] In response to a selection event for a second media object in the first third-level service, destroy the first third-level coroutineScope object corresponding to the first media object, create a first third-level coroutineScope object corresponding to the second media object under the first second-level coroutineScope object, and create a first third-level dependency injection scope object corresponding to the second media object under the first second-level dependency injection scope;

[0044] Creating the first third-level business unit corresponding to the second media object according to the first third-level coroutine scope object corresponding to the second media object and the first third-level dependency injection scope object corresponding to the second media object;

[0045] The first third-level business unit corresponding to the second media object is run under the first third-level coroutine scope object corresponding to the second media object to manage the life cycle of the first third-level business unit corresponding to the second media object.

[0046] Another aspect of an embodiment of the present application provides a service processing device, the device comprising:

[0047] The first creation module is used to create the target coroutine scope object;

[0048] A second creation module is used to create a target dependency injection scope object corresponding to the target coroutine scope object in a dependency injection framework;

[0049] A third creation module is used to create the target business unit according to the target coroutine scope object and the target dependency injection scope object;

[0050] A running module is used to run the target business unit under the target coroutine scope object to manage the target business unit.

[0051] Another aspect of an embodiment of the present application provides a computer device, including:

[0052] at least one processor; and

[0053] a memory communicatively coupled to the at least one processor;

[0054] Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.

[0055] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the following steps are implemented:

[0056] Create the target coroutine scope object;

[0057] Creating a target dependency injection scope object corresponding to the target coroutine scope object in a dependency injection framework;

[0058] Create the target business unit according to the target coroutine scope object and the target dependency injection scope object;

[0059] The target business unit is run under the target coroutine scope object to manage the target business unit.

[0060] The above technical solution adopted in the embodiments of the present application may have the following advantages:

[0061] Create a target coroutine scope object and a target dependency injection scope object. The target coroutine scope object corresponds to the target dependency injection scope object. This allows the target business unit to be created in the target dependency injection scope object through dependency injection, effectively reducing the amount of code and improving development efficiency. At the same time, the target business unit runs under the target coroutine scope object, thus realizing the self-operation of business logic based on the corresponding life cycle through the target coroutine scope object. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] The accompanying drawings illustrate exemplary embodiments and constitute a part of the specification. Together with the description of the specification, they serve to explain exemplary implementation of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals designate similar, but not necessarily identical, elements.

[0063] FIG1 schematically shows an operating environment diagram of a service processing method according to a first embodiment of the present application;

[0064] FIG2 schematically shows a workflow diagram of the fusion play page;

[0065] FIG3 schematically shows a service grouping diagram of a fusion playback page;

[0066] FIG4 schematically shows a diagram of the service scope splitting of the fusion play page;

[0067] FIG5 schematically shows a flow chart of a service processing method according to the first embodiment of the present application;

[0068] FIG6 schematically shows a flow chart of sub-steps of step S504 in FIG5 ;

[0069] FIG7 schematically shows a newly added flow chart of the service processing method according to the first embodiment of the present application;

[0070] FIG8 schematically shows a newly added flow chart of the service processing method according to the first embodiment of the present application;

[0071] FIG9 schematically shows a newly added flow chart of the service processing method according to the first embodiment of the present application;

[0072] FIG10 schematically shows a newly added flow chart of the service processing method according to the first embodiment of the present application;

[0073] FIG11 schematically shows a newly added flow chart of the service processing method according to the first embodiment of the present application;

[0074] FIG12 schematically shows an example diagram of an application of a service processing method according to the first embodiment of the present application;

[0075] FIG13 schematically shows a block diagram of a service processing device according to the second embodiment of the present application; and

[0076] FIG14 schematically shows a hardware architecture diagram of a computer device according to the third embodiment of the present application. DETAILED DESCRIPTION

[0077] In order to make the purpose, technical solutions and advantages of this application more clear, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0078] It should be noted that the descriptions of "first", "second", etc. in the embodiments of the present application are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0079] In the description of this application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed. They are only used to facilitate the description of this application and to distinguish each step. Therefore, they cannot be understood as limitations on this application.

[0080] First, an explanation of the terms used in this application is provided:

[0081] UGC (User Generated Content): User-generated content.

[0082] OGV (Occupationally Generated Video): Professionally produced copyrighted videos, such as movies, TV series, documentaries, and animations.

[0083] Scope: The visibility and validity of variable, function, object, and other names within a specific section or block of code in a program. Scope defines the accessibility and lifetime of identifiers within a program. Different languages ​​and programming environments may have different types of scope, including block scope, function scope, and global scope.

[0084] Kotlin: A statically typed programming language designed to improve development efficiency, code readability, and security. Kotlin has many features, including nullability checks, extension functions, and data classes, making writing Android apps more concise and easier to maintain. Kotlin is compatible with Java and can be widely used in Android development.

[0085] CoroutineScope: Used for coroutine lifecycle management, exception handling, and coroutine cancellation. For example, it can be used to ensure that a coroutine is started, run, and cancelled within the correct scope. CoroutineScope should be declared as a property of an entity with a well-defined lifecycle, responsible for starting child coroutines.

[0086] Dependency Injection (DI) frameworks are used to manage dependencies between components to improve code maintainability, testability, and scalability. The primary purpose of DI frameworks is to help developers separate dependencies from code, making collaboration between components more loosely coupled and easier to replace and adjust. The core idea of ​​DI is to have an object's dependencies managed by an external container, rather than created internally.

[0087] Dependency injection is the process of passing an object to another class or object so that the latter can use the functionality or data provided by the former. Dependency injection can be implemented through constructors, method parameters, properties, annotations, etc.

[0088] Dagger is a dependency injection framework. It uses annotations to mark dependencies. These annotations include @Inject, which marks dependencies to be injected, and @Component, which connects dependencies to where they are needed. Dagger uses methods provided by components to automatically inject dependencies where they are needed, eliminating the need to manually write code to create and manage dependencies.

[0089] Component: A connector for dependencies in the Dagger dependency framework. Through Component, Dagger can generate the corresponding code to complete dependency injection. That is, objects are no longer responsible for creating their own dependencies, but Dagger handles it.

[0090] Kotlin and Dagger can be used together. Developers can use Kotlin to write application logic and use Dagger to manage application dependencies, thereby achieving higher productivity and code quality during the development process.

[0091] Specialization: unique special business.

[0092] Secondly, to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the following describes the relevant technologies:

[0093] Platform-based websites typically handle complex business scenarios. Taking video clients as an example, the video playback page corresponds to the following scenarios: the video uploader's manuscript playback page, the live broadcast playback page, the animation and film playback page, and so on. Each playback page is a gathering point for a large number of businesses, requiring the conversion of various businesses to the playback page and the functional display of each business on the playback page. As can be seen, the playback page code is among the most complex in the client-side code. This is not only due to the complex functions of the playback page itself, but also because the playback page needs to integrate a large number of external business functions. Implementing complex functions means higher code complexity, and high code complexity means high maintenance costs.

[0094] The applicant has learned that, to achieve the same functionality without duplication and thus reduce development costs, related technologies combine the aforementioned multiple playback pages into a single one. However, this merging of multiple pages further increases code complexity and maintenance costs. Therefore, we need to explore a new architectural model to meet complex business requirements.

[0095] Take the fusion play page generated by the fusion of UGC play page and OGV play page as an example:

[0096] The integrated playback page consists of at least six components: general video playback services, user-generated content (UGC)-specific video playback services, OGV-specific video playback services, general playback page interactions, UGC-specific playback page interactions, and OGV-specific playback page interactions. Each component comprises a large number of services, and the specialized components are often interrelated. For example, the UGC-specific and OGV-specific screen casting services both rely on the same screen casting SDK, and most services are driven by the return values ​​of interface requests and user behavior.

[0097] Implementing all services within a converged playback page using code would create a massive mesh structure. Therefore, while still meeting the complex needs of the converged playback page, it's necessary to optimize this mesh structure to reduce code complexity and maintenance costs, ensuring maximum stability during development and subsequent iterations. Specifically, this requires better design of new business units and dependency relationships, while minimizing the maintenance costs of the mesh structure.

[0098] To this end, the embodiment of the present application provides a business processing technical solution. In this technical solution, taking the integrated playback page of the Android client as an example, in this technical solution, combined with Kotlin's coroutine and dependency injection framework Dagger, complex businesses can be decomposed into multiple relatively cohesive business unit modules according to the business's own real life cycle and driving relationship, and the amount of code can be reduced through dependency injection to improve development efficiency. Specifically, the adopted solution may include: (1) decomposing the complex and large business network into multiple independent business scopes according to different life cycles and establishing corresponding dependency injection Scope and CoroutineScope; (2) for each business scope, completing the development of the business unit based on the corresponding CoroutineScope and dependency injection; (3) based on the real business, combining the business unit and the business scope through subscription to the driving business event stream to establish a corresponding driving relationship. Although this article uses Dagger and Kotlin coroutines to implement it, similar frameworks can also be used in actual applications. For example, dependency injection can be replaced with koin, and coroutines can be replaced with Rxjava and Android Lifecycle. The core is to create business units through event subscription-driven dependency injection, so as to realize the self-operation of business logic based on the corresponding life cycle. See below for details.

[0099] Finally, for ease of understanding, an exemplary operating environment is provided below.

[0100] FIG1 schematically shows an environmental application diagram of the method according to an embodiment of the present application.

[0101] Computer devices 10000 include various types of electronic devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors or other electronic devices, etc. These computer devices can run various types and versions of software applications and operating systems, such as Android. Portable handheld devices can include cellular phones, smart phones, tablet computers, etc. Wearable devices can include head-mounted displays (such as smart glasses), etc. Gaming systems can include various handheld gaming devices, Internet-enabled gaming devices, etc. Client devices can execute a variety of different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.

[0102] Computer device 10000 may include input / output interfaces. The input interface may include a touchpad, a touch screen, a mouse, a keyboard, or other sensing elements. The input interface may be configured to receive user commands that may cause computer device 10000 to perform various operations, such as playing a video. The output interface is used to output information to the user, such as display information.

[0103] Based on the operating environment described above, the computer device 10000 may also be installed with one or more applications, such as a video playback APP (Application).

[0104] The video playback app is equipped with a fusion playback page, which is equipped with multiple services, forming a complex and large business network. According to different life cycles, the complex business network in the fusion playback page can be split into multiple independent business scopes. A business scope represents a set of services with a clear life cycle. All services under this set correspond to the same business scope. There is a parent-child relationship between multiple business scopes, which can be divided into multi-level business scopes. The upper-level business scope can include one or more lower-level business scopes.

[0105] Create a corresponding dependency injection scope object and coroutine scope object for each business scope. For each business scope, complete the development of the business unit based on the corresponding dependency injection scope object and coroutine scope object, and make the business logic run automatically based on the corresponding life cycle.

[0106] As shown in Figure 2, the workflow of the integrated playback page can be as follows: after entering the page, the server interface is requested through the incoming routing parameters of the current page, and the current business is judged based on the interface return whether it is a UGC business or an OGV business. Then, the business unit of the corresponding business is started, and the corresponding video playback business is driven by the selection logic of the corresponding business to play the video at the same time. UGC business may have multiple P (Part) in a page, and each P corresponds to an independent video material. Correspondingly, there may be multiple EP (Episode) in a quarterly collection of OGV business, and each EP also corresponds to an independent video material. As shown in Figure 3, the integrated playback page can be grouped based on the business scope, and then multiple business scopes (Scope) can be configured.

[0107] As shown in Figure 4, a video playback page (such as a converged playback page) can be configured as three layers, with a total of five business scopes:

[0108] The first layer, Page Scope, corresponds to the lifecycle of the integrated playback page itself, starting with opening the page and exiting with closing the page. During this lifecycle, services that run throughout the entire page lifecycle, such as tracking point reporting, are executed.

[0109] The second layer: Business Scope, which is a sub-Scope of the page Scope, can be divided into UGC Business Scope and OGV Business Scope, and the two will not coexist. And there will only be one business scope for the same page Scope at the same time. When the page interface returns, it decides which specific business scope to start based on the data returned by the server. If a business scope already exists, the current scope and its sub-Scope will be destroyed. In the middle of the business scope life cycle, business units unique to the UGC / OGV business run, such as UGC multi-P logic, UGC screen projection comments and other business units, OGV multi-season logic, and OGV section list.

[0110] The third layer: Video Playback Scope, divided into UGC Video Playback Scope and OGV Video Playback Scope, which correspond to the subscopes of the UGC and OGV business scopes, respectively. Since their parent scopes cannot coexist, the two scopes cannot coexist, and only one video playback scope can exist within the same business scope. Each time a new video is triggered to play, the business scope for the corresponding video is started. If a video playback scope already exists, the current scope is destroyed. During the video playback scope lifecycle, business units unique to the UGC / OGV video playback business, such as UGC previews and OGV membership authentication, run.

[0111] On a page (such as a fusion playback page), if a new business scope is not created, there will typically be only one scope: the page scope. Given that all businesses have lifecycles, if they are not split by business scope, they can typically only be bound to the page scope and run. However, the lifecycle of many businesses is much shorter than that of the page. Therefore, in this case, either the scope within the business unit needs to be manually maintained, or negligence can introduce business bugs. Furthermore, in this case, it is easy for the business to rely on incorrect data due to issues with the timing of data updates. Therefore, splitting is necessary. Multiple scopes, as shown in Figure 4, can be easily mapped to specific scopes and specific business units.

[0112] Taking the playback business as an example, suppose that the current OGV has a business unit that needs to obtain relevant information about the current season of the corresponding video after the video starts playing. When the episode is switched and the season is switched at the same time, the video information interface has been returned, so the video starts playing normally. At this time, if the season information interface has not returned, the business unit will obtain information from the season business from the previous season, which will cause a business error. After establishing the corresponding business scope and completing the dependencies between scopes, since the episode business scope is a subscope of the season business scope, the dependency injection framework will ensure that the current season information is correct when all business units under the episode business scope are started. Relying on the dependency injection framework, the current season information, such as the episode dimension data, can also be used as the initialization parameter of the episode scope, so that the episode business unit does not need to worry about the season changes, further simplifying the business code.

[0113] Specifically: Split the business unit according to Scope to obtain a series of small Scopes and corresponding business units. Each business only needs to care about the Scope related to its own business and does not need to understand all business units. At the same time, due to the isolation relationship between Scopes, code isolation can be achieved by splitting modules according to business through different Scopes, thereby reducing the cost of establishing incorrect reference relationships and code maintenance costs. Referring to the fusion playback page, the code of the fusion playback page can be divided into 4 modules: page Scope, UGCScope module, OGVScope module, and fusion module. The fusion module references the OGV module and the UGC module. The OGV module and the UGC module reference each other in isolation, but both reference the page Scope. By dividing the code into different business modules, the isolation of the code between different businesses is achieved, thereby avoiding the establishment of incorrect business unit dependencies.

[0114] Therefore, in this embodiment, the video playback APP can be designed as follows: an architectural design that supports dependency injection and uses Kotlin coroutines as dependency binding and can easily create multi-level parent-child relationship scopes.

[0115] The following describes the technical solutions of the present application through multiple embodiments using the computer device 10000 as the execution subject. It should be noted that these embodiments can be implemented in many different forms and should not be construed as being limited to the embodiments described herein.

[0116] Example 1

[0117] FIG5 schematically shows a flow chart of a service processing method according to the first embodiment of the present application.

[0118] As shown in FIG5 , the service processing method may include steps S500 to S506 , wherein:

[0119] Step S500: Create a target coroutine scope object.

[0120] Step S502: Create a target dependency injection scope object corresponding to the target coroutine scope object in the dependency injection framework.

[0121] Step S504: Create the target business unit according to the target coroutine scope object and the target dependency injection scope object.

[0122] Step S506: Run the target business unit under the target coroutine scope object to manage the target business unit.

[0123] The business processing method provided in this embodiment creates a target coroutine scope object and a target dependency injection scope object. The target coroutine scope object corresponds to the target dependency injection scope object, thereby creating a target business unit in the target dependency injection scope object through dependency injection, effectively reducing the amount of code and improving development efficiency. At the same time, the target business unit runs under the target coroutine scope object, thereby realizing the self-operation of business logic based on the corresponding life cycle through the target coroutine scope object.

[0124] 5 , each step in steps S500 to S506 and other optional steps are described in detail below.

[0125] Step S500: Create a target coroutine scope object.

[0126] The target coroutine scope object is used to manage and control the life cycle of the coroutine. The coroutines started within its scope are managed and controlled by the target coroutine scope.

[0127] Considering the complexity of numerous businesses and the differences between them, such as the different life cycles of different businesses, managing and controlling all businesses simultaneously in the same coroutine scope will make subsequent maintenance difficult and increase development difficulty.

[0128] For example, a page (such as a video playback page) may be configured with multiple businesses. These businesses may have multi-level and multi-directional connections, forming a complex and large business network. Each business has a lifecycle, which may be the same or different for each business. Therefore, the complex business network on the page can be split into multiple independent business scopes based on the lifecycle. A business scope represents a collection of businesses with a clear lifecycle, and all businesses under this collection correspond to the same business scope.

[0129] In this embodiment, a business scope can correspond to a coroutine scope. The business under the business scope can be managed by the corresponding coroutine scope. For example, when entering the target page, in order to manage the business under the target page, a target coroutine scope object corresponding to the business scope of the target page can be created. Since the target coroutine scope object corresponds to the business scope, the life cycle of the target coroutine scope object is the same as the life cycle of the business scope.

[0130] In this embodiment, the target coroutine scope object can be created by Kotlin coroutine. In some embodiments, the target coroutine scope object can also be created by RxJava, Android Lifecycle, etc., which are not limited here.

[0131] In this embodiment, a target coroutine scope object is created to subsequently manage the life cycle of the business logic under the corresponding business scope.

[0132] Step S502: Create a target dependency injection scope object corresponding to the target coroutine scope object in the dependency injection framework.

[0133] Dependency injection frameworks can be used to manage dependencies between objects. Dependency injection frameworks can inject the dependent objects required by an object from the outside to complete object creation and form a loosely coupled and easy-to-maintain code structure.

[0134] Dependency injection scope objects are used to create business units (business objects).

[0135] In the dependency injection framework, a target dependency injection scope object is created that corresponds to the target coroutine scope object. That is, the lifecycle of the target dependency injection scope object is the same as the lifecycle of the target coroutine scope object, and naturally, the same as the lifecycle of the corresponding business scope.

[0136] The target dependency injection scope object can be created through the Dagger dependency injection framework.

[0137] In some embodiments, other dependency injection frameworks may also be used, such as koin, hilt, etc., which are not limited here.

[0138] Step S504: Create the target business unit according to the target coroutine scope object and the target dependency injection scope object.

[0139] As mentioned previously, a business scope represents a collection of businesses with a well-defined lifecycle. All businesses within this collection can be mapped to the same business scope. Once the target coroutine scope and target dependency injection scope objects corresponding to the business scope have been established, the business units within the business scope can be constructed.

[0140] Specifically, the target dependency injection scope object can be used to create a target business unit of the corresponding business scope. The creation of the target business unit requires the target coroutine scope object, and the target business unit includes specific business units that rely on the target coroutine scope to run. That is, the target business unit is created by externally injecting the dependency object (target coroutine scope object) required by the target business unit.

[0141] In practice, a variety of approaches can be used to create target business units. An example approach is provided below.

[0142] In an optional embodiment, the target dependency injection scope object declares a target business anchor point, and the target business anchor point includes multiple business units.

[0143] Correspondingly, step S504 may include:

[0144] Step S600: Bind the target coroutine scope object to the target dependency injection scope object.

[0145] Step S602: Create a target business unit in the target dependency injection scope object through the target coroutine scope object and the target business anchor.

[0146] The target business anchor (Anchor object) may be a business unit list of the corresponding business scope, and is used to indicate the target business unit that needs to be created under the corresponding business scope.

[0147] There are multiple ways to bind the target CoroutineScope object to the target Dependency InjectionScope object. For example, you can pass the target CoroutineScope object as a parameter to the target Dependency InjectionScope object to achieve binding.

[0148] In this embodiment, a target business anchor is configured for a target dependency injection scope object and a target coroutine scope object is bound, thereby quickly and efficiently determining a target business unit and creating the target business unit.

[0149] Step S506: Run the target business unit under the target coroutine scope object to manage the target business unit.

[0150] The target business unit is created and runs under the target coroutine scope object. The target business unit is managed and restricted by the target coroutine scope object. For example, the target business unit automatically runs when the target coroutine scope object's lifecycle begins and automatically terminates when the target coroutine scope object's lifecycle ends.

[0151] In this embodiment, by running the target business unit under the target coroutine scope object, the business logic is self-running and self-terminating based on the corresponding life cycle, which improves the efficiency of business management and control and reduces the risk of business errors.

[0152] The above embodiment describes how to construct a target business unit under a corresponding business scope through dependency injection based on a target coroutine scope object and a target dependency injection scope object. The following further describes business scopes.

[0153] In an optional embodiment, there are multiple businesses, and the multiple businesses correspond to multiple business scopes. The multiple business scopes are divided into multi-level business scopes. In the multi-level business scope, the upper-level business scope includes one or more lower-level business scopes. Each business scope corresponds to a coroutine scope object and a dependency injection scope object. The hierarchy of the business scope corresponds to the hierarchy of the coroutine scope object and the hierarchy of the dependency injection scope object.

[0154] For example, a page (such as a video playback page) is configured with multiple businesses, and there may be multi-level and multi-directional associations between the businesses, thus forming a complex and large business network. Each business has a life cycle, and the life cycles of different businesses may be the same or different. Therefore, the complex business network in the page can be split into multiple independent business scopes based on the life cycle. A business scope represents a set of businesses with a clear life cycle, and all businesses under this set correspond to the same business scope. There may be a parent-child relationship between multiple business scopes, and they can be divided into multi-level business scopes. The upper-level business scope can include one or more lower-level business scopes. The life cycle of the upper-level business scope must be greater than or equal to that of the lower-level business scope.

[0155] Create a corresponding dependency injection scope object and coroutine scope object for each business scope. For each business scope, complete business development based on the corresponding dependency injection scope object and coroutine scope object, and make the business logic run automatically based on the corresponding life cycle.

[0156] There is a correspondence between business scopes, dependency injection scope objects, and coroutine scope objects. Accordingly, there is a correspondence between the levels of business scopes, coroutine scope objects, and dependency injection scope objects.

[0157] In this embodiment, by breaking down a complex business network according to its lifecycle, a series of smaller business scopes and corresponding services can be obtained. Developers of each service only need to focus on the business scope associated with their own service, without having to understand all business units, thus reducing development costs. Code isolation achieved through different business scopes reduces maintenance costs caused by establishing incorrect reference relationships and mitigates the risk of incorrectly establishing business dependencies.

[0158] The above embodiment introduces the hierarchy and corresponding relationship of business scopes. The following describes how to establish corresponding dependency injection scope objects and coroutine scope objects when there are multiple levels of business scopes, and how to complete the construction of business units at the corresponding levels.

[0159] In an optional embodiment, the target coroutine scope object corresponds to a first-level coroutine scope object, and the target dependency injection scope object corresponds to a first-level dependency injection scope object.

[0160] Correspondingly, the service processing method may further include steps S700 to S706, wherein:

[0161] Step S700: In response to a target event, create a secondary coroutineScope object under the primary coroutineScope object.

[0162] Step S702: Create a secondary dependency injection scope object corresponding to the secondary coroutine scope object under the primary dependency injection scope object.

[0163] Step S704: Create the secondary business unit according to the secondary coroutine scope object and the secondary dependency injection scope object.

[0164] Step S706: Run the secondary business unit under the secondary coroutine scope object to manage the life cycle of the secondary business unit.

[0165] For example, a business scope can include a primary business scope and a secondary business scope. A primary business scope is the parent business scope of a secondary business scope. A primary business scope can create a corresponding primary coroutine scope object and a primary dependency injection scope object.

[0166] The target event may be a user requesting the computer device 10000 to start a business unit in the secondary business scope. In response to the target event, a secondary coroutine scope object may be created under the primary coroutine scope object. The primary coroutine scope object and the secondary coroutine scope object also have a parent-child relationship. A secondary dependency injection scope object corresponding to the secondary coroutine scope object is created under the primary dependency injection scope object. In this way, a corresponding secondary coroutine scope object and a secondary dependency injection scope object are also established for the secondary business scope. Then, a secondary business unit may be created, and the secondary business unit may be made to self-run and self-terminate based on the corresponding life cycle.

[0167] In this embodiment, a corresponding secondary coroutine scope and secondary dependency injection scope are established for the secondary business scope, which efficiently realizes the creation, self-operation and destruction of the secondary business unit and refines the management and control of the secondary business unit.

[0168] In an optional embodiment, the target business unit serves as a first-level business unit, configured to serve the second-level coroutineScope object and its subordinate coroutineScope objects.

[0169] The secondary coroutine scope object is restricted by the primary coroutine scope object. When the primary coroutine scope object ends, the secondary coroutine scope object must also end, and vice versa.

[0170] A second-level coroutineScope object can reference the first-level business unit of a first-level coroutineScope object because the lifecycle of the parent coroutineScope object is greater than or equal to that of the child coroutineScope object, but not vice versa. In other words, a first-level business unit can provide services to a second-level coroutineScope object. If a third-level business scope exists under a second-level business scope, the corresponding third-level coroutineScope object can also reference the first-level business unit.

[0171] In this embodiment, the lifecycle of a first-level coroutine scope object is greater than or equal to that of a second-level coroutine scope object. Therefore, a second-level coroutine scope object can be referenced without affecting the first-level business unit. That is, a first-level business unit can serve a second-level coroutine scope object and its subordinate coroutine scope objects. The business logic at different levels is relatively independent, which can reduce maintenance costs. A first-level business unit can provide services for multiple second-level coroutine scope objects, reducing the need to write the same functions multiple times, improving code reusability, and reducing development costs.

[0172] In an optional embodiment, the target service unit is used to provide a driving service event flow.

[0173] Target business units can be used to monitor and capture various operational events to provide a driving business event stream. Operational events can include user actions, external system interactions, scheduled tasks, and so on. For example, operational events may include a user request to start a business unit, a user request to switch a business unit, or a user request to update business content. Target business units can include interface business units and driver business units. The interface business unit can be used to request data return from the server based on current parameters. The driver business unit can be used to subscribe to the return value of the interface business unit, that is, to subscribe to the driving business event stream.

[0174] By subscribing to the driven business event stream, you can promptly open and switch to the corresponding business unit and business content. For example, the driven business unit can subscribe to the driven business event stream through Collectlatest, thereby creating a corresponding coroutine scope object based on the driven business event stream, so that the corresponding business unit can be created and self-run based on the coroutine scope object. Among them, Collectlatest needs to run under a coroutine scope object, that is, under the target coroutine scope object of the target business unit. Whenever Collectlatest receives a new result (new return value) of the driven business event stream, Collectlatest can create a subordinate coroutine scope object of the current coroutine scope object (target coroutine scope object). The corresponding business logic can be run in the subordinate coroutine scope object. It should be noted that other methods can also be used to subscribe to the driven business event stream, which is not limited here.

[0175] In this embodiment, the target business unit is used to provide a driving business event stream to create a lower-level coroutine scope object. Based on the real business, the business unit and the business scope are combined by subscribing to the driving business event stream to establish a corresponding driving relationship. The back pressure problem caused by frequent changes in events can be solved by driving the business event stream. For example, when events change frequently, a new coroutine scope object will be generated each time the driving business event stream is used, and the previous coroutine scope object will be cancelled, thereby achieving performance optimization.

[0176] The following will describe in detail how the target business unit serves the lower-level coroutine scope object to complete the startup, switching and update of the corresponding business unit in combination with multiple exemplary embodiments.

[0177] In an optional embodiment, the target coroutine scope object is a first-level coroutine scope object corresponding to the playback page, and the target dependency injection scope object is a first-level dependency injection scope object corresponding to the playback page; wherein the playback page is configured with first and second-level services and second and second-level services.

[0178] Correspondingly, the service processing method may further include steps S800 to S804:

[0179] Step S800: In response to selected events for the first and second level services, create first and second level coroutine scope objects under the first level coroutine scope object and create first and second level dependency injection scope objects under the first level dependency injection scope object.

[0180] Step S802: Create first and second level business units according to the first second level coroutine scope object and the first second level dependency injection scope object.

[0181] Step S804: Run the first secondary business unit under the first secondary coroutine scope object to manage the life cycle of the first secondary business unit.

[0182] In conjunction with Figures 2-4, when entering the playback page, you can create a first-level coroutine scope object (PageCoroutineScope) with the same lifecycle as the playback page, and create a first-level dependency injection scope object (PageCoroutineScope) corresponding to the first-level coroutine scope object in the dependency injection framework. Based on PageCoroutineScope and PageScope, a first-level business unit is created through dependency injection. The first-level business unit runs under the first-level coroutine scope object, and its lifecycle is limited by the first-level coroutine scope object. When the playback page is closed, the first-level coroutine scope object is destroyed, the first-level business unit stops running and is released, which can reduce memory leaks.

[0183] The play page can be configured with multiple services, including UGC, OGV, etc. For example, the play page can be configured with the first and second level services and the second level services.

[0184] The selection event can be a user's selection operation on a certain business in the playback page. When the user selects the first and second level businesses, in response to the selection event, the first and second level coroutine scope objects (BizCoroutineScope) are created under the first level coroutine scope object. For example, when the user selects the UGC business, the first and second level coroutine scope objects can be UGCBizCoroutineScope. Create the first and second level dependency injection scope objects (UGCBizScope) under the first level dependency injection scope object. Based on the first and second level coroutine scope objects and the first and second level dependency injection scope objects, the first and second level business units running under the first and second level coroutine scope objects are created through dependency injection, thereby realizing the self-operation of the first and second level business logic based on the corresponding life cycle.

[0185] In this embodiment, the first and second coroutine scope objects are established under the first coroutine scope object according to user needs, and the life cycle of the first and second business units is created and managed based on this. In this way, when the page is destroyed, the first coroutine scope object is destroyed, and its lower-level (first and second level) coroutine scope objects are also destroyed, and the first and second level business units can automatically stop running and be released. On the contrary, the destruction of the first and second level coroutine scope objects will not affect the first level coroutine scope object, that is, the operation and termination of the first and second level business units will not affect the normal operation of the playback page. It can be seen that according to the life cycle, multiple coroutine scope objects are used to manage the corresponding business units respectively, the business logic is relatively independent, and the maintenance cost is reduced.

[0186] In an optional embodiment, the first secondary service and the second secondary service are mutually exclusive.

[0187] The service processing method may further include steps S900 to S904:

[0188] Step S900: In response to a selected event for a second secondary business, destroy the first secondary coroutine scope object, create a second secondary coroutine scope object under the first secondary coroutine scope object, and create a second secondary dependency injection scope object under the first secondary dependency injection scope object.

[0189] Step S902: Create a second secondary business unit according to the second secondary coroutine scope object and the second secondary dependency injection scope object.

[0190] Step S904: Run the second secondary business unit under the second secondary coroutine scope object to manage the life cycle of the second secondary business unit.

[0191] The first and second level services can be mutually exclusive; only one level service can exist on the same playback page at the same time. A level service unit can determine which level service to start based on the subscribed driving service event stream. If a level service CoroutineScope object already exists on the current playback page, the current level service CoroutineScope object and its subordinate CoroutineScope objects must be destroyed to close the current level service and start a new one.

[0192] For example, the first and second level services are UGC services. Accordingly, the first and second level coroutine scope objects run business units unique to the UGC service, such as UGC multi-P logic, UGC screen casting and commentary, and other business units. The second and second level services can be OGV services, which are mutually exclusive. If the first and second level services already exist on the playback page, when the user selects the second and second level services, a service switch is required.

[0193] Specifically: The selected event is sent to the driving business event flow. The first and second level coroutine scope objects and their subordinate coroutine scope objects can be destroyed based on the new event. The corresponding first and second level business units are also terminated and released, reducing the risk of business errors and alleviating memory leaks. Create a second and second level coroutine scope object (OGVBizCoroutineScope) under the first level coroutine scope object. Create a second and second level dependency injection scope object (OGVBizScope) under the first level dependency injection scope object. Based on the second and second level coroutine scope objects and the second and second level dependency injection scope objects, create a second and second level business unit running under the second and second level coroutine scope object through dependency injection, so that the second and second level business logic can run automatically based on the corresponding life cycle and complete the business switching operation.

[0194] In this embodiment, the current first and second-level business coroutine scope objects are terminated based on the newly selected event, thereby stopping all first and second-level business units under the current first and second-level business coroutine scope objects. Then, a new second and second-level coroutine scope object is created to create and manage new second and second-level business units, thus achieving efficient business switching and reducing the risk of business errors.

[0195] In an optional embodiment, the first-level-two service is associated with a first-level-three service, wherein the first-level-three service is used to play one or more media objects.

[0196] Correspondingly, the service processing method may further include steps S1000 to S1004:

[0197] Step S1000, in response to a selected event for the first media object in the first third-level business, creates a first third-level coroutine scope object corresponding to the first media object under the first second-level coroutine scope object, and creates a first third-level dependency injection scope object corresponding to the first media object under the first second-level dependency injection scope.

[0198] Step S1002: Create the first third-level business unit corresponding to the first media object according to the first third-level coroutine scope object corresponding to the first media object and the first third-level dependency injection scope object corresponding to the first media object.

[0199] Step S1004 , running the first third-level business unit corresponding to the first media object under the first third-level coroutine scope object corresponding to the first media object to manage the life cycle of the first third-level business unit corresponding to the first media object.

[0200] For example, if the first and second level services are UGC services, the first and third level services can be the associated UGC video playback service. In actual applications, a UGC video may have multiple parts (P), each corresponding to an independent video material, on a single playback page. When the user selects a different part, the playback page will present a different UGC video. Therefore, the first and third level services can be used to play one or more media objects. Media objects can include video, audio, animation, and other content, without limitation here.

[0201] The user can select a certain P (first media object) in the UGC video list presented on the playback page. In response to the selection event, a first-level and third-level coroutine scope object (UGCEPCoroutineScope) corresponding to the first media object is created under the first-level and second-level coroutine scope objects (UGCBizCoroutineScope). A first-level and third-level dependency injection scope object (UGCEPScope) corresponding to the first media is created under the first-level and second-level dependency injection scopes. Based on UGCEPCoroutineScope and UGCEPCoroutineScope, a first-level and third-level business unit running under the first-level and third-level coroutine scope object is created through dependency injection, thereby realizing the self-operation of the first-level and third-level business logic based on the corresponding life cycle, that is, playing the first media object.

[0202] In an optional embodiment, the service processing method may further include steps S1100 to S1104:

[0203] Step S1100, in response to a selection event for the second media object in the first-level third business, destroy the first-level third coroutine scope object corresponding to the first media object, create a first-level third coroutine scope object corresponding to the second media object under the first-level second coroutine scope object, and create a first-level third dependency injection scope object corresponding to the second media object under the first-level second dependency injection scope.

[0204] Step S1102: Create the first third-level business unit corresponding to the second media object according to the first third-level coroutine scope object corresponding to the second media object and the first third-level dependency injection scope object corresponding to the second media object.

[0205] Step S1104 , running the first third-level business unit corresponding to the second media object under the first third-level coroutine scope object corresponding to the second media object to manage the life cycle of the first third-level business unit corresponding to the second media object.

[0206] Since each P of the UGC video corresponds to an independent video material, both manual video switching by the user and automatic video switching by the system require the creation of the first and third level coroutine scope objects and the first and third level business units corresponding to the new video (second media object).

[0207] Specifically, the selected event for the second media object is sent to the driver's service event stream. Based on this new event, the first-level third-level coroutine scope object corresponding to the first media object is destroyed. Accordingly, the first-level third-level service unit corresponding to the first media object is also terminated and released, reducing the risk of service errors and code complexity.

[0208] A first-level third-level coroutineScope object corresponding to the second media object is created under the first-level second-level coroutineScope object. A first-level third-level dependency injection scope object corresponding to the second media object is created under the first-level second-level dependency injection scope object. Through dependency injection, a first-level third-level business unit is created that runs under the first-level third-level coroutineScope object corresponding to the second media object, thereby enabling the first-level third-level business logic corresponding to the second media object to self-run based on the corresponding lifecycle and complete the video switching operation.

[0209] In actual applications, the first-level business unit can also be used to subscribe to the video playback data stream. When there is a new video object (second media object) in the video playback data stream, the first-level third-level coroutine scope object corresponding to the first media object can be ended based on the second media object, and the first-level third-level coroutine scope object corresponding to the second media object can be recreated.

[0210] In order to make the present application easier to understand, an exemplary application is provided below in conjunction with FIG12 .

[0211] S10, initialize the play page.

[0212] S11, create a page coroutine scope object (PageCoroutineScope).

[0213] S12, creating a page dependency injection scope object (PageScope) in the dependency injection framework.

[0214] In the Dagger dependency injection framework, you can create a PageScope by creating a PageComponent (component).

[0215] It should be noted that in other dependency injection frameworks, PageComponent may not be required to create PageScope.

[0216] S13, bind the page coroutine scope object to the page dependency injection scope object.

[0217] S14, constructing a PageAnchor (anchor) object through the page dependency injection scope object, thereby creating a page business unit.

[0218] Among them, the page business unit may include a page interface business unit and a driving business unit.

[0219] The page interface business unit is used to pass in the parameters of the current page and request the server to return data.

[0220] The driving business unit is used to subscribe to the return value of the page interface business unit.

[0221] S15, the page business unit subscribes to the page interface return value flow through CollectLatest, thereby creating a business coroutine scope object (BizCoroutineScope) corresponding to the business type.

[0222] S16: Create a corresponding business dependency injection scope object based on the BizCoroutineScope and the page interface return value, and create a business unit running under the current BizCoroutineScope.

[0223] S17: Subscribe to the video playback flow of the current business through CollectLatest according to the page business unit, thereby creating a corresponding video playback coroutine scope object (EPCoroutineScope).

[0224] S18, based on the EPCoroutineScope and the page interface return value, create the corresponding business dependency injection scope object, and create a business unit running under the current EPCoroutineScope.

[0225] S19, monitoring whether a video switching event occurs.

[0226] If yes, go to S20; if no, go to S21.

[0227] S20: Send a new video object to the video playback flow of the current business, thereby ending the video playback coroutine scope object of the current video and entering S17.

[0228] S21: Monitor whether a service switching event occurs.

[0229] If yes, go to S22; if no, go to S17.

[0230] S22, by calling the page interface, sending a new interface return value to the page interface flow, thereby ending the business coroutine scope object of the current business, and then entering S15.

[0231] In this exemplary application, (1) a complex and large business network is divided into multiple independent business scopes according to different life cycles and corresponding dependency injection scopes and coroutine scopes are established; (2) for each business scope, the development of a business unit is completed based on the corresponding coroutine scope and dependency injection; (3) based on the actual business, the business unit and the business scope are combined by subscribing to the driving business event stream to establish a corresponding driving relationship; (4) the business unit is created by event subscription-driven dependency injection, thereby realizing the self-operation of the business logic based on the corresponding life cycle.

[0232] Example 2

[0233] Figure 14 schematically shows a block diagram of a business processing device according to the second embodiment of the present application. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer-readable instruction segments that can perform specific functions. The following description will specifically introduce the functions of each program module in this embodiment. As shown in Figure 13, the device 1300 may include: a first creation module 1310, a second creation module 1320, a third creation module 1330, and an operation module 1340, wherein:

[0234] A first creation module 1310 is used to create a target coroutine scope object;

[0235] A second creation module 1320 is configured to create a target dependency injection scope object corresponding to the target coroutine scope object in a dependency injection framework;

[0236] A third creation module 1330 is configured to create the target business unit according to the target coroutine scope object and the target dependency injection scope object;

[0237] The running module 1340 is used to run the target business unit under the target coroutine scope object to manage the target business unit.

[0238] As an optional embodiment, the target dependency injection scope object declares a target business anchor point, and the target business anchor point includes multiple business units;

[0239] Correspondingly, the third creation module 1330 is further configured to:

[0240] Bind the target coroutineScope object to the target dependency injectionScope object;

[0241] In the target dependency injection scope object, a target business unit is created through the target coroutine scope object and the target business anchor.

[0242] As an optional embodiment, there are multiple services, and the multiple services correspond to multiple service scopes;

[0243] The multiple business scopes are divided into multiple levels of business scopes;

[0244] In the multi-level business scope, the upper-level business scope includes one or more lower-level business scopes;

[0245] Among them, each business scope corresponds to a coroutine scope object and a dependency injection scope object;

[0246] The level of business scope corresponds to the level of coroutine scope objects and the level of dependency injection scope objects.

[0247] As an optional embodiment, the target coroutine scope object corresponds to a first-level coroutine scope object, and the target dependency injection scope object corresponds to a first-level dependency injection scope object;

[0248] The service processing device 1300 is further configured to:

[0249] In response to a target event, create a secondary coroutineScope object under the primary coroutineScope object;

[0250] Creating a secondary dependency injection scope object corresponding to the secondary coroutine scope object in the dependency injection framework;

[0251] Create the secondary business unit according to the secondary coroutine scope object and the secondary dependency injection scope object;

[0252] The secondary business unit is run under the secondary coroutine scope object to manage the life cycle of the secondary business unit.

[0253] As an optional embodiment, the target business unit serves as a first-level business unit, configured to serve the second-level coroutineScope object and its subordinate coroutineScope objects.

[0254] As an optional embodiment, the target service unit is used to provide a driving service event flow.

[0255] As an optional embodiment, the target coroutine scope object is a first-level coroutine scope object corresponding to the play page, and the target dependency injection scope object is a first-level dependency injection scope object corresponding to the play page; wherein the play page is configured with first and second-level services and second and second-level services; correspondingly, the business processing device 1300 is further used to:

[0256] In response to selected events for the first and second level services, creating first and second level coroutine scope objects under the first level coroutine scope object and creating first and second level dependency injection scope objects under the first level dependency injection scope object;

[0257] Create first and second-level business units according to the first and second-level coroutine scope objects and the first and second-level dependency injection scope objects;

[0258] The first secondary business unit is run under the first secondary coroutine scope object to manage the life cycle of the first secondary business unit.

[0259] As an optional embodiment, the first secondary service and the second secondary service are mutually exclusive, and the service processing apparatus 1300 is further configured to:

[0260] In response to a selected event for a second secondary service, destroy the first secondary coroutineScope object, and create a second secondary coroutineScope object under the first secondary coroutineScope object and a second secondary dependency injection scope object under the first dependency injection scope object;

[0261] Create a second secondary business unit according to the second secondary coroutineScope object and the second secondary dependency injection scope object;

[0262] The second secondary business unit is run under the second secondary coroutine scope object to manage the life cycle of the second secondary business unit.

[0263] As an optional embodiment, the first-level-two service is associated with a first-level-three service, where the first-level-three service is used to play one or more media objects; correspondingly, the service processing apparatus 1300 is further configured to:

[0264] In response to a selected event for a first media object in the first third-level service, creating a first third-level coroutineScope object corresponding to the first media object under the first second-level coroutineScope object, and creating a first third-level dependency injectionscope object corresponding to the first media object under the first second-level dependency injection scope;

[0265] Creating a first third-level business unit corresponding to the first media object according to the first third-level coroutine scope object corresponding to the first media object and the first third-level dependency injection scope object corresponding to the first media object;

[0266] The first third-level business unit corresponding to the first media object is run under the first third-level coroutine scope object corresponding to the first media object to manage the life cycle of the first third-level business unit corresponding to the first media object.

[0267] As an optional embodiment, the service processing apparatus 1300 is further configured to:

[0268] In response to a selection event for a second media object in the first third-level service, destroy the first third-level coroutineScope object corresponding to the first media object, create a first third-level coroutineScope object corresponding to the second media object under the first second-level coroutineScope object, and create a first third-level dependency injection scope object corresponding to the second media object under the first second-level dependency injection scope;

[0269] Creating the first third-level business unit corresponding to the second media object according to the first third-level coroutine scope object corresponding to the second media object and the first third-level dependency injection scope object corresponding to the second media object;

[0270] The first third-level business unit corresponding to the second media object is run under the first third-level coroutine scope object corresponding to the second media object to manage the life cycle of the first third-level business unit corresponding to the second media object.

[0271] Example 3

[0272] Figure 14 schematically shows a hardware architecture diagram of a computer device 10000 suitable for implementing a business processing method according to the third embodiment of the present application. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. As shown in Figure 14, the computer device 10000 may include but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:

[0273] The memory 10010 includes at least one type of computer-readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store an operating system and various application software installed on the computer device 10000, such as program codes of business processing methods, etc. In addition, the memory 10010 can also be used to temporarily store various data that has been output or is to be output.

[0274] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to execute program code stored in the memory 10010 or process data.

[0275] The network interface 10030 may include a wireless network interface or a wired network interface. The network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal via a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile Communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, or Wi-Fi.

[0276] It should be noted that FIG. 14 only shows a computer device having components 10010 - 10030 , but it should be understood that it is not required to implement all of the shown components, and more or fewer components may be implemented instead.

[0277] In this embodiment, the business processing method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.

[0278] Example 4

[0279] The present application also provides a computer-readable storage medium having computer-readable instructions stored thereon. When the computer-readable instructions are executed by a processor, the steps of the service processing method in the embodiment are implemented:

[0280] Create the target coroutine scope object;

[0281] Creating a target dependency injection scope object corresponding to the target coroutine scope object in a dependency injection framework;

[0282] Create the target business unit according to the target coroutine scope object and the target dependency injection scope object;

[0283] The target business unit is run under the target coroutine scope object to manage the target business unit.

[0284] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk equipped with the computer device, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, etc. Of course, the computer-readable storage medium may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed on the computer device, such as the program code of the business processing method in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are about to be output.

[0285] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented using general-purpose computer devices. They can be concentrated on a single computer device or distributed on a network composed of multiple computer devices. Alternatively, they can be implemented using program codes executable by the computer device, so that they can be stored in a storage device and executed by the computer device. In some cases, the steps shown or described can be performed in a different order than herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0286] It should be noted that the above are only preferred embodiments of the present application and do not limit the scope of patent protection of the present application. Any equivalent structure or equivalent process transformation made using the contents of the description and drawings of this application, or directly or indirectly applied in other related technical fields, are also included in the scope of patent protection of the present application.

Claims

1. A business processing method, the method comprising: Create the target coroutine scope object; Creating a target dependency injection scope object corresponding to the target coroutine scope object in a dependency injection framework; Create the target business unit according to the target coroutine scope object and the target dependency injection scope object; The target business unit is run under the target coroutine scope object to manage the target business unit.

2. The method according to claim 1, wherein: The target dependency injection scope object declares a target business anchor point, and the target business anchor point includes multiple business units; Correspondingly, creating the target business unit according to the target coroutine scope object and the target dependency injection scope object includes: Bind the target coroutine scope object to the target dependency injection scope object; In the target dependency injection scope object, a target business unit is created through the target coroutine scope object and the target business anchor.

3. The method according to claim 1, wherein: There are multiple businesses, and the multiple businesses correspond to multiple business scopes; The multiple business scopes are divided into multiple levels of business scopes; In the multi-level business scope, the upper-level business scope includes one or more lower-level business scopes; Among them, each business scope corresponds to a coroutine scope object and a dependency injection scope object; The level of business scope corresponds to the level of coroutine scope objects and the level of dependency injection scope objects.

4. The method according to claim 3, wherein: The target coroutine scope object corresponds to a first-level coroutine scope object, and the target dependency injection scope object corresponds to a first-level dependency injection scope object; The method further comprises: In response to a target event, creating a secondary coroutineScope object under the primary coroutineScope object; Create a secondary dependency injection scope object corresponding to the secondary coroutine scope object under the primary dependency injection scope object; Create the secondary business unit according to the secondary coroutine scope object and the secondary dependency injection scope object; The secondary business unit is run under the secondary coroutine scope object to manage the life cycle of the secondary business unit.

5. The method according to claim 4, wherein: The target business unit serves as a primary business unit, and is used to serve the secondary coroutine scope object and its subordinate coroutine scope objects.

6. The method according to any one of claims 1 to 5, wherein: The target service unit is used to provide a driving service event flow.

7. The method according to claim 3, wherein: The target coroutine scope object is a first-level coroutine scope object corresponding to the playback page, and the target dependency injection scope object is a first-level dependency injection scope object corresponding to the playback page; wherein the playback page is configured with a first and second-level business and a second and second-level business; correspondingly, the method further includes: In response to selected events for the first and second level services, create first and second level coroutine scope objects under the first level coroutine scope object and create first and second level dependency injection scope objects under the first level dependency injection scope object; Create first and second level business units according to the first and second level coroutine scope objects and the first and second level dependency injection scope objects; The first secondary business unit is run under the first secondary coroutine scope object to manage the life cycle of the first secondary business unit.

8. The method according to claim 7, wherein: The first-level secondary service and the second-level secondary service are mutually exclusive, and the method further includes: In response to a selected event for a second secondary business, destroy the first secondary coroutine scope object, and create a second secondary coroutine scope object under the first secondary coroutine scope object and a second secondary dependency injection scope object under the first secondary dependency injection scope object; Create a second secondary business unit according to the second secondary coroutine scope object and the second secondary dependency injection scope object; The second secondary business unit is run under the second secondary coroutine scope object to manage the life cycle of the second secondary business unit.

9. The method according to claim 7, wherein: The first-level service is associated with a first-level service, wherein the first-level service is used to play one or more media objects; correspondingly, the method further includes: In response to a selected event for a first media object in the first third-level service, creating a first third-level coroutine scope object corresponding to the first media object under the first second-level coroutine scope object, and creating a first third-level dependency injection scope object corresponding to the first media object under the first second-level dependency injection scope; Creating the first third-level business unit corresponding to the first media object according to the first third-level coroutine scope object corresponding to the first media object and the first third-level dependency injection scope object corresponding to the first media object; The first third-level business unit corresponding to the first media object is run under the first third-level coroutine scope object corresponding to the first media object to manage the life cycle of the first third-level business unit corresponding to the first media object.

10. The method according to claim 9, wherein: The method further comprises: In response to a selected event for a second media object in the first third-level service, destroy the first third-level coroutineScope object corresponding to the first media object, create a first third-level coroutineScope object corresponding to the second media object under the first second-level coroutineScope object, and create a first third-level dependency injection scope object corresponding to the second media object under the first second-level dependency injection scope; Creating the first third-level business unit corresponding to the second media object according to the first third-level coroutine scope object corresponding to the second media object and the first third-level dependency injection scope object corresponding to the second media object; The first third-level business unit corresponding to the second media object is run under the first third-level coroutine scope object corresponding to the second media object to manage the life cycle of the first third-level business unit corresponding to the second media object.

11. A service processing device, comprising: The first creation module is used to create a target coroutine scope object; A second creation module is used to create a target dependency injection scope object corresponding to the target coroutine scope object in a dependency injection framework; A third creation module is used to create the target business unit according to the target coroutine scope object and the target dependency injection scope object; A running module is used to run the target business unit under the target coroutine scope object to manage the target business unit.

12. A computer device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, wherein when the computer instructions are executed by a processor, the following steps are implemented: Create the target coroutine scope object; Creating a target dependency injection scope object corresponding to the target coroutine scope object in a dependency injection framework; Create the target business unit according to the target coroutine scope object and the target dependency injection scope object; The target business unit is run under the target coroutine scope object to manage the target business unit.

14. The computer-readable storage medium of claim 13, wherein: The target dependency injection scope object declares a target business anchor point, and the target business anchor point includes multiple business units; When the computer instructions are executed by the processor, the following steps are implemented: Bind the target coroutine scope object to the target dependency injection scope object; In the target dependency injection scope object, a target business unit is created through the target coroutine scope object and the target business anchor.

15. The computer-readable storage medium of claim 13, wherein: There are multiple businesses, and the multiple businesses correspond to multiple business scopes; The multiple business scopes are divided into multiple levels of business scopes; In the multi-level business scope, the upper-level business scope includes one or more lower-level business scopes; Among them, each business scope corresponds to a coroutine scope object and a dependency injection scope object; The level of business scope corresponds to the level of coroutine scope objects and the level of dependency injection scope objects.

16. The computer-readable storage medium of claim 15, wherein: The target coroutine scope object corresponds to a first-level coroutine scope object, and the target dependency injection scope object corresponds to a first-level dependency injection scope object; When the computer instructions are executed by the processor, the following steps are implemented: In response to a target event, creating a secondary coroutineScope object under the primary coroutineScope object; Create a secondary dependency injection scope object corresponding to the secondary coroutine scope object under the primary dependency injection scope object; Create the secondary business unit according to the secondary coroutine scope object and the secondary dependency injection scope object; The secondary business unit is run under the secondary coroutine scope object to manage the life cycle of the secondary business unit.

17. The computer-readable storage medium of claim 16, wherein: The target business unit serves as a primary business unit, and is used to serve the secondary coroutine scope object and its subordinate coroutine scope objects.

18. The computer-readable storage medium according to any one of claims 13 to 17, wherein: The target service unit is used to provide a driving service event flow.

19. The computer-readable storage medium of claim 15, wherein: The target coroutine scope object is a first-level coroutine scope object corresponding to the play page, and the target dependency injection scope object is a first-level dependency injection scope object corresponding to the play page; wherein the play page is configured with a first and second-level business and a second and second-level business; correspondingly, when the computer instructions are executed by the processor, the following steps are implemented: In response to selected events for the first and second level services, create first and second level coroutine scope objects under the first level coroutine scope object and create first and second level dependency injection scope objects under the first level dependency injection scope object; Create first and second level business units according to the first and second level coroutine scope objects and the first and second level dependency injection scope objects; The first secondary business unit is run under the first secondary coroutine scope object to manage the life cycle of the first secondary business unit.

20. The computer-readable storage medium of claim 19, wherein: The first secondary service and the second secondary service are mutually exclusive, and when the computer instructions are executed by the processor, the following steps are implemented: In response to a selected event for a second secondary business, destroy the first secondary coroutine scope object, and create a second secondary coroutine scope object under the first secondary coroutine scope object and a second secondary dependency injection scope object under the first secondary dependency injection scope object; Create a second secondary business unit according to the second secondary coroutine scope object and the second secondary dependency injection scope object; The second secondary business unit is run under the second secondary coroutine scope object to manage the life cycle of the second secondary business unit.

Citation Information

Patent Citations

  • Bean object management method and device of Spring framework, electronic equipment and storage medium

    CN116010038A

  • Method, device and equipment for realizing dependency injection based on Hilt

    CN116257212A

  • Multi-language extensible code dependency analysis model and analysis method

    CN116302919A

  • Business processing method and device

    CN117111897A

  • Spring framework generic dependency injection method and apparatus, computer device and storage medium

    WO2020215686A1