protected function asSeller($seller = null)
 {
     if ($this->isShopTestCase()) {
         return $this->asShopOwner($seller ?: ($this->order ? $this->order->getSeller() : null));
     }
     return $this->asUser($seller ?: ($this->order ? $this->order->getSeller() : null));
 }
示例#2
0
 public function review(User $user, Shop $shop, Order $order)
 {
     return $user->is($order->getUser()) and $shop->is($order->getSeller()) and $shop->canBeReviewed($order);
 }
示例#3
0
 public function isOrderSeller(Order $order)
 {
     // either user is seller or, if user has shop, shop is seller
     return $this->is($order->getSeller()) or $this->hasShop() and $this->getShop()->is($order->getSeller());
 }
示例#4
0
 public function getOrderRole(Order $order = null, $self = true)
 {
     if (!$order) {
         return $self ? '卖家' : '买家';
     }
     if ($this->is($order->getUser())) {
         return $self ? '买家' : '卖家';
     }
     if ($this->is($order->getSeller())) {
         return $self ? '卖家' : '买家';
     }
     return null;
 }