log = new SimpleLog('order/order'); $this->bindModels(); $this->singleton(OrderOperationsCollector::class, function ($orderManager) { return new OrderOperationsCollector(); }); $this->setting = \app\common\modules\shop\ShopConfig::current()->get('shop-foundation.order'); } public function setting($key = null) { return array_get($this->setting, $key); } private function bindModels() { $this->bind('PreOrderGoods', function ($orderManager, $attributes) { return new PreOrderGoods($attributes); }); $this->bind('PreOrder', function ($orderManager, $attributes) { return new PreOrder($attributes); }); $this->bind('PreOrderAddress', function ($orderManager, $attributes) { return new PreOrderAddress($attributes); }); // 订单model $this->bind('Order', function ($orderManager, $attributes) { if (\YunShop::isApi()) { return new \app\frontend\models\Order($attributes); } else { return new Order(); } }); $this->bind('Member', function ($orderManager, $attributes) { return new \app\frontend\models\Member($attributes); }); $this->bind('OrderDeduction', function ($orderManager, $attributes) { return new OrderDeduction($attributes); }); $this->bind('OrderDiscount', function ($orderManager, $attributes) { return new OrderDiscount($attributes); }); $this->bind('OrderCoupon', function ($orderManager, $attributes) { return new OrderCoupon($attributes); }); $this->bind('MemberCart', function ($orderManager, $attributes) { return new MemberCart($attributes); }); $this->bind('OrderAddress', function ($orderManager, $attributes) { return new OrderAddress($attributes); }); $this->bind(Trade::class, function ($orderManager, $attributes) { return new Trade($attributes); }); $this->bind(OrderCollection::class, function ($orderManager, $attributes) { return new OrderCollection($attributes); }); } }