Position: Home page » Computing » Decentralization of agency model

Decentralization of agency model

Publish: 2021-04-01 10:16:29
1.

1、 Agent model can be divided into three categories according to the number:

1. Exclusive agent,

2. Less head game agent (2-3),

3. More than 3 head game agents

it is the first consideration for Chinese enterprises to choose exclusive agency or non exclusive agency< Second, according to the penetration degree of sellers to agents, it can be divided into two categories:

penetration agents and independent agents (non exclusive agents)

Third, according to the level of agents, it can be divided into single level agent system and multi-level agent system

2.

The first level agent is the employee under the general agent. If you take the goods from the general agent, the price is higher

the second level agent is the employee under the first level agent who takes the goods from the first level agent and gets the highest price

micro business agent is to have proct authorization, and the source of goods can be obtained directly from the manufacturer, or you can find the source of goods yourself. As a micro business agent, you can develop a lower level agent, send the goods to the next family to earn a price difference, and sell them yourself

extended data:

micro business agent level:

generally, there are five levels. The highest proxy level is hidden, and there are four common levels for publishing. For example, co-founder, general agent, first-class agent and special agent are our common micro business agent system. Co founder, as the highest level of agency for public

generally speaking, there is a hidden micro business agent level above the co founders. The hidden agent level mainly has two functions. The first function is that in the early stage of micro business, 30-50 person project seed initiators act as agent level agents. The main task of these 30 to 50 seed agents is to develop and recruit co founders

generally speaking, these 30 people have strong social relationship with the person in charge of the wechat business project. Second, for the cooperation between the brand side and the micro business team, the team leader gives the highest level of agent treatment

of course, there are also five agency levels in the market, such as co-founder, general agent, primary agent, secondary agent and special agent. This kind of five level agent, Lianchuang must have a set of the highest hidden agent level, that is to say, six levels. This six level system is suitable for procts with large profit margin

in addition to the two agency systems, there is also an agency model, which is divided into the upper three levels and the lower four levels. What is the three-tier and four tier agency model? Generally speaking, the next four levels are just like the agent level that we often see

it is mainly used for the investment promotion of indivial micro businesses. The main body of micro businesses is indivials, and the amount of one-time goods taking is less. The upper three agent levels are used for the recruitment of formed micro business teams, indivial enterprises and branch companies

3. Advantages:
1. There is no need to invest in the proction costs of the proct
2. It is easy to form scale effect with other agents, so that manufacturers can rece operating costs, which is directly reflected in recing proct prices
3. Enjoy various resources of the manufacturer, such as brand, training, system, equipment, etc
4. The most direct way to rece market risk is to rece proct stock risk
5. It's easy to quit

disadvantages:
1
2. Information asymmetry: the business information and business planning of the manufacturer are completely unknown to the agent, but the business information of the agent is completely mastered by the manufacturer. In this way, the manufacturer can adjust the business strategy according to the business information of the agent at any time to avoid the risk or pass on the risk
3. The vested interests of agents can not be guaranteed. Although the state stipulates that proct quality problems should be borne by the manufacturers, if the manufacturers lose the ability to bear the responsibility or evade the responsibility, then the agents at the upstream of the circulation link may bear legal and economic responsibilities
4. Capital risk is related to information asymmetry. However, even if the business information of the manufacturer is known, the agent has to pay certain funds in advance for the manufacturer ring the cooperation period, and the risk of these funds is completely borne by the agent

well, my level is only about that. Boss, you can think about it.
4. Brief introction of three proxy patterns in Java

this paper focuses on how to write three proxy patterns in Java code. In order to ensure the pertinence of the article, we will not discuss the underlying implementation principle for the time being, and the specific principle will be described in the next article

what is the proxy pattern

proxy pattern is a design pattern, which is to extend the function of the target object without changing the source code

for example, there is a singer object called singer, and this object has a singing method called sing()

if you want the singer object proced by your way to say hello and thank you to the audience before and after singing, that is to extend the function of sing method of singer

but often you can't modify the source code directly, maybe you want the original object to remain the same, or maybe you only provide a pluggable plug-in, or even you may not know which target object you want to extend. At this time, we need to use Java proxy mode. Many examples of managers in daily life are used to explain "agent" on the Internet. It seems easy to understand, but I don't think it's suitable for programmers to understand. Programmers should start with the nature of the code.
5.

1、 Traditional distribution mode

1, workload

it is through door-to-door visits, or sweeping the road in the form of its own marketing promotion. However, the distribution mode is characterized by heavy workload, low work efficiency and narrow sales coverage

The traditional distribution agency model is an important undertaker of channel function, and the middleman can participate in the actual logistics, promotion flow and market information flow of the distribution channel in whole or in part. Generally speaking, the function of distribution channel to realize proct value and improve transaction efficiency and benefit is to enhance the competitive advantage of enterprises. There are many intermediary links, which leads to a long time of marketing channel. Manufacturers can not contact with Z end users directly, which increases the operating costs of customers

3. The traditional advertising terminal mode has many forms and contents, such as the soft text mode of newspaper media, the radio lecture mode of radio station, and the feature film mode of TV station. However, the investment cost is high, the payment is slow, and the operation risk is also large

4. Traditional telemarketing mode

through telemarketing procts and promoting the company's business, through effective communication with customers by telephone, we can understand customers' needs, seek sales opportunities and achieve sales performance. But it has a lot of work, low efficiency, customers can not intuitively understand the proct, resulting in low customer trust

Second, network marketing as a new way of marketing

The network media has the characteristics of wide communication range, fast speed, no time and geographical restrictions, no time and layout constraints, detailed content, multimedia transmission, vivid image, two-way communication, rapid feedback and so on. It is concive to improving the efficiency of enterprise marketing information dissemination and enhancing the effect of enterprise marketing information dissemination, Rece the cost of marketing information dissemination

There is no store rent cost in E-marketing. And there are marketing means to realize proct direct selling, which can help enterprises rece inventory pressure and operating costs

Network marketing any enterprise is not absolutely limited by its own scale, it can equally obtain information from all over the world and show itself equally, using network marketing, each enterprise can quickly establish its own global information network and trade network with little cost, and quickly transmit the information of its procts to each market

Internet marketing can make consumers have more freedom of choice than traditional marketing. Consumers can also quickly find their own procts according to their own characteristics and needs, regardless of geographical and time constraints, and can make full comparison, which is concive to saving consumers' transaction time and transaction costs. In addition, network marketing can also help enterprises to realize one-to-one communication with consumers, which is convenient for enterprises to provide one-to-one personalized service according to the indivial needs of consumers

As the extension and development of traditional marketing, network marketing is not only common with traditional marketing, but also different from traditional marketing. With the rapid development of the Internet, the characteristics of network marketing are becoming more and more prominent

6. The goal of Java programming is to achieve the reality can not be completed, optimization reality can be completed, is a virtual technology. Every aspect of life can be virtualized into code. Agency model is about such a concept in real life: intermediary
definition of Proxy Pattern: provide a proxy for an object, and the proxy object controls the reference to the original object
the proxy pattern includes the following roles:
isubject: abstract topic role, which is an interface. The interface is shared by the object and its agents
realsubject: a real topic role is a class that implements an abstract topic interface
proxy: a proxy role, which contains a reference to the real object realsubject, so that it can operate on the real object. Proxy objects provide the same interface as real objects, so that they can replace real objects at any time. At the same time, proxy objects can attach other operations to real objects, which is equivalent to encapsulating real objects
the key technology of dynamic proxy is reflection
static proxy
there are several proxy modes: virtual proxy, counting proxy, remote proxy and dynamic proxy. It is mainly divided into two types, static agent and dynamic agent. Static proxy is relatively simple. It is a proxy class written by the programmer and compiled before the program runs, rather than a proxy class generated dynamically by the program. This is called static proxy
considering such a scenario, it is very common for an administrator to perform operations on a website and record operation logs while generating operation results. In this case, you can use the proxy mode, which can be implemented by aggregation and inheritance:
& lt; pre name=" code" class=" java"& gt;/** Method 1: aggregate static proxy * @ author goser mailto:[email protected] * @ since, September 7, 2016 * / / / 1. Abstract topic interface public interface manager {void dosomething();}// 2. Real topic class public class admin implements manager {public void dosomething() {system. Out. Println & quot; Admin do something."); } } // 3. Public class adminpoly implements manager {private admin; public AdminPoly(Admin admin) { super(); this.admin = admin; } public void doSomething() { System.out.println(" Log: admin operation start & quot;); admin.doSomething(); System.out.println(" Log: end of admin operation & quot;);}}// 4. Test code admin admin = new admin(); Manager m = new AdminPoly(admin); m.doSomething(); // Mode 2: inherited static proxy / / only proxy class and test code are different from the above mode / / 1. Proxy class public class adminproxy extends admin {@ override public void dosomething() {system. Out. Println & quot; Log: admin operation start & quot;); super.doSomething(); System.out.println(" Log: admin operation start & quot;);}}// 2. Test code: adminproxy proxy = new adminproxy(); proxy.doSomething();& lt;/ pre>
in the aggregation implementation, the proxy class aggregates the proxy class, and both the proxy class and the proxy class implement the same interface, which can be flexible. The implementation of inheritance is not flexible enough
for example, the administrator needs to handle the permissions, log the operation contents, and change the data after the operation. There are six permutations and combinations of the three functions. That is to say, to use inheritance, we need to write six agent classes that inherit from admin. To use aggregation, we only need to write agent classes for the three functions of permission processing, logging and data change. In the business logic, we can change the code order according to the specific needs
dynamic proxy
generally speaking, a topic class corresponds to a proxy class one by one, which is also the characteristic of static proxy pattern
however, there are n topic classes, but the "pre-processing and post-processing" in the proxy class are the same, only the calling topic is different. In other words, multiple topic classes correspond to a proxy class, share the "pre-processing, post-processing" function, dynamically call the required topic, greatly recing the size of the program, which is the characteristic of the dynamic proxy mode
JDK dynamic proxy
implementation
& lt; pre name=" code" class=" java"& gt;// 1. Abstract topic public interface moveable {void move() throws exception;}// 2. Real theme: public class car implements moveable {public void move() throws exception {thread. Sleep (New random(). Nextint (1000)); System.out.println(" The car is in motion// 3. Transaction processor public class timehandler implements invocationhandler {private object target; public TimeHandler(Object target) { super(); this.target = target; } /** * Parameter: * proxy object * method method of proxy object * args method parameter * Return: * object method return value * / public object invoke (object proxy, method, object [] args) throws throwable {long starttime = system. Currenttimemillis(); System.out.println(" The car starts to run; method.invoke(target, args); long stopTime = System.currentTimeMillis(); System.out.println(" End of vehicle travel... Vehicle travel time: & quot; + stopTime - startTime) + " Millisecond& quot;); return null; } } // Test class public class test {public static void main (string [] args) throws exception {car car = new car(); InvocationHandler h = new TimeHandler(car); Class<?& gt; cls = car.getClass(); /** * Loader class loader * interfaces implementation interface * h invocationhandler * / moveable M = (moveable) proxy. Newproxyinstance (CLS. Getclassloader(), CLS. Getinterfaces(), H); m.move(); } }& lt;/ pre>
code explanation:
in the test code, the proxy. Newproxyinstance() method needs three parameters: class loader (the class to be proxy), interface implemented by the proxy class, and transaction processor. So first instantiate car, instantiate the subclass timehandler of invocationhandler, and pass the parameters into the static method newproxyinstance() of proxy to get the proxy class of car. The static proxy and proxy class in front are written by us, while the dynamic proxy does not need us to write the proxy class, which is generated dynamically in the program
JDK dynamic proxy steps
1. To create a class that implements the invocationhandler interface, it must implement the invoke() method
2. To create the proxy class and interface
3. To call the static method of proxy and create a proxy class
4. To call the method through proxy
Why do you want to do so, You can find the answer from the source code of proxy and invocationhandler. If you are not interested in the source code, you can abridge the following part of the source code
principle and source code of JDK dynamic proxy
source code of ewproxyinstance() method:
& lt; pre name=" code" class=" java"& gt; public static Object newProxyInstance(ClassLoader loader, Class<?& gt;[] interfaces, InvocationHandler h) throws IllegalArgumentException{ if (h == null) { throw new NullPointerException(); } final Class<?& gt;[] intfs = interfaces.clone(); final SecurityManager sm = System.getSecurityManager(); if (sm != null) { checkProxyAccess(Reflection.getCallerClass(), loader, intfs); } /* Find or generate the specified proxy class * / class & lt& gt; cl = getProxyClass0(loader, intfs); /* Use the specified call handler to call its constructor. * / try {/ / to get the final constructor & lt& gt; cons =cl.getConstructor(constructorParams); final InvocationHandler ih = h; if (sm != null && amp; Proxyaccesshelper. Needsnewinstancecheck (CL)) {/ / when a class that needs proxy implements a non-public interface, because such an interface requires special permissions, doprivilege (native modified method) is called to create a proxy instance. return AccessController.doPrivileged(newPrivilegedAction< Object>() { public Object run() { return newInstance(cons,ih); } }); } else { return newInstance(cons,ih); } } catch (NoSuchMethodException e) { throw new InternalError(e.toString()); } }& lt;/ pre>
you can see that the code to get the proxy class is
class & lt& gt; CL = getproxyclass0 (loader, intfs)
and get the constructor of the proxy class, generate the instance of the proxy class and return it to the caller of the method
continue to follow up the getproxyclass0() method:
& lt; pre name=" code" class=" java"& gt;/** Generate a proxy class. Before calling this method, you must use the checkproxyaccess method to perform permission checking*/ private static Class<?& gt; getProxyClass0(ClassLoader loader, Class<?& gt;... Interfaces) {/ / check the number of implemented interfaces. The number 65535 is very special. It seems that the number of ports is also this. This number is determined by the virtual machine, 2 ^ 16-1 if (interfaces. Length & gt; 65535) { throw new IllegalArgumentException(" interface limit exceeded"); } // If the proxy class has been created by the class loader that implements the given interface, a of the class in the cache is returned; Otherwise, the proxy class return proxyclasscache. Get (loader, interfaces);} will be created through proxyclassfactory& lt;/ pre>
I still don't see how the proxy class is generated. I only know that the proxy class is obtained from
roxyclasscache
and this variable is an object related to cache. Check the declaration and initialization of this variable:
& lt; pre name=" code" class=" java"& gt; private static final WeakCache< ClassLoader, Class<?& gt;[], Class<?& gt;& gt; proxyClassCache = new WeakCache<& gt;( new KeyFactory(), new ProxyClassFactory());& lt;/ pre>
it can be found that
roxyclasscache
is a class variable used to cache proxy classes. As we all know, the feature of class variable is one-to-one correspondence with classes. There is only one class in a virtual machine, which corresponds to only one class variable in a virtual machine. In this case, the proxy class is assigned a value when it is loaded. In the parameters of assignment operation, there is such a constructor as proxyclassfactory(), which is the key in dynamic proxy: generating the bytecode of class file of proxy class. Continue to follow and find the generation place of the proxy class:
& lt; pre name=" code" class=" java"& gt; /** According to the given class loader and interface array, the factory class * / private static final class proxyclassfactory implements bifunction & lt; ClassLoader,Class<?& gt;[], Class<?& gt;& gt; { // Private static final string proxyclassnameprefix = & quot$ Proxy"; // Private static final atomiclong nextiquenumber = new atomiclong(), the next sequence number used to generate a unique proxy class name@ Override public Class<?& gt; apply(ClassLoader loader,Class<?& gt;[] interfaces) { Map< Class<?& gt;, Boolean> interfaceSet = new IdentityHashMap<& gt;( interfaces.length); for (Class<?& gt; INTF: interfaces) {/ * the validation class loader resolves the name of this interface to the name of the actual object*/
7. Java static proxy mode, for example, let's see how to understand it:
public class TS {
public static void main (string [] args) throws exception {
/ / proce a batch of clothes through an intermediary company
clothingproct CP = New proxcompany (New liningcompany())< br /> cp.proctClothing();
}

}

/ *
* define the interface of procing a batch of clothes function
*
* /
interface clothingproct {

void proctclothing()// It has the function of procing a batch of clothes

}

/ *
*
* agent: intermediary company
*
* /
class proxcompany implements clothingproct {

private clothingproct CP// Intermediary companies can't proce clothes. They need to find a company that can proce clothes.

proxcompany (clothingproct CP) {
super()< br /> this . cp = cp;< br /> }

@Override
public void proctClothing() {

System. out .println( " Charge an intermediary fee of 1 yuan< br /> cp .proctClothing();

}

}

*
*
* Li Ning Company is the target class of clothing proction
*
* /
class liningcompany implements clothingproct {

@ override
public void proctclothing() {


system. Out. Println & quot; Proce a batch of clothes& quot; );<
}

}

the mode of the above program is static proxy mode

disadvantages of static proxy mode in real programming:
its feature is that the classes of proxy class and target object are determined ring compilation, which is not concive to program expansion, If customers want to find a factory that can proce a batch of shoes, they need to add a new agent class and a target class. If customers need many other services, they must add the agent class and target class one by one. Then you need to write a lot of proxy classes and target classes

what the proxy pattern does
in my eyes, the proxy pattern has only two concerns: protocol and agent
protocol defines a set of methods, which are implemented by a certain class
as an attribute of a class, the agent is usually an instance object of another class, and can be responsible for completing tasks that are inconvenient or impossible for the original class
first of all, let's talk about the agent and recall the implementation process of the agent mode in our mind. When defining a proxy object in page B, it seems very similar to defining a common property (except weak and ID delegate). This is my generalization of agency: agency is just an attribute, not very mysterious
of course, the agent is not just an ordinary attribute of the class, otherwise I just need to rewrite the initialization method of B to achieve the same effect:
self. BVC = [[bviewcontroller alloc] initwithd elegate:self ];

then define an aviewcontroller * AVC in bviewcontroller. M and assign a value in the initialization method
it is noted that when defining an agent, the format is often like this:
ID & lt; SomeDelegate> delegate;

so my understanding of the advantages of agent is:
the core advantage of agent is decoupling
compared with directly declaring an agent belonging to a fixed class, the agent declared as ID has the advantages of two stars
multiple different classes are allowed to act as proxies for this class. Just imagine in this example, if page B can jump back to N pages, and if it still declares a common object, then what should be done?
the class that allows the agent is not fixed yet. Just imagine that uitableview also has delegate, which doesn't know which class will be its agent
take another look at the agreement. The agreement is simpler. The protocol just defines a set of methods. In the proxy mode, there is no need to define a protocol in page B, and then a can follow the protocol. Call the method of a directly
I think the advantages of the protocol are as follows:
Xcode's checking mechanism can be used. For the method defined as @ required, if the protocol is implemented but the method is not implemented, the compiler will give a warning. This can prevent the situation of forgetting to implement a code e to negligence. Due to the runtime characteristics of OC, such errors often lead to program crash at the runtime
it is concive to code encapsulation. If a class implements a protocol, the method in the protocol can be called by the class defining the protocol without being declared in. H. This reces the exposure of a class to external methods
it is concive to the structure and hierarchy of the program. A protocol is often a way to solve a problem. For a similar problem, we only need to implement the protocol again to avoid conceiving a group of methods. The inheritance mechanism of the protocol makes this a bit more powerful
to sum up, there is only one sentence: proxy mode is not mysterious, it is just an optimized trick (let one class hold the pointer of another class). Proxy and protocol only make the program more coupling and more structured.
8. The distribution model is that each level of distributors can further develop distributors. Earn two kinds of commission, that is, sales commission and promotion commission
1. About sales commission: Whoever sells gets sales commission, regardless of the distributor level, the proportion of sales commission is the same
2. Promotion Commission: when the lower level distributors of each distributor sell goods, the higher level distributors can get promotion commission.
9. Many franchisees don't know how to expand the market after they come in, and they haven't done any market planning before they join in. To make a good proct, one plan, two lines and three summaries are needed.
10. There is no difference between the two<
it's not the same thing at all

policy mode:
multiple classes only differ in the performance behavior. You can use the strategy mode to dynamically select the specific behavior to be executed at runtime

proxy mode
provides a proxy for other objects to control access to this object.
Hot content
Inn digger Publish: 2021-05-29 20:04:36 Views: 341
Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750