1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
 
namespace app\common\service\product\factory;
 
use app\common\enum\order\OrderSourceEnum;
 
/**
 * 商品辅助工厂类
 */
class ProductFactory
{
    public static function getFactory($type = OrderSourceEnum::MASTER)
    {
        switch ($type) {
            case OrderSourceEnum::MASTER:
                return new MasterProductService();
                break;
            case OrderSourceEnum::POINTS;
                return new PointsProductService();
                break;
            case OrderSourceEnum::SECKILL:
                return new SeckillProductService();
                break;
            case OrderSourceEnum::BARGAIN:
                return new BargainProductService();
                break;
            case OrderSourceEnum::ASSEMBLE:
                return new AssembleProductService();
                break;
            case OrderSourceEnum::ADVANCE:
                return new AdvanceProductService();
                break;
            case OrderSourceEnum::BRANCHACTIVITY:
                return new BranchActivityProductService();
                break;
        }
    }
}