Exemplo n.º 1
0
 public function payOrderWithBalance(Order $order)
 {
     /** @var \modules\invest\models\InvestList $order */
     $this->ensurePayPass();
     $price = $order->getPrice();
     $orderStatus = $order->getStatus();
     if ($orderStatus != Order::STATUS_UNPAYED) {
         throw new ErrorException('账单已支付', ErrorCode::Pay_had_pay);
     }
     $member = wanhunet::app()->member;
     if ($order->getType() == Invest::TYPE_MONEY) {
         $orderName = mb_substr($order->getName(), 0, 5, "utf-8");
         if (mb_strlen($order->getName(), "utf-8") > 5) {
             $orderName .= "...";
         }
         $orderName .= "投资";
         $member->setDecMoney($price, $orderName);
         $save = $member->saveMoney();
         if ($save) {
             return $order->finishPay(new Event());
         }
     } else {
         $member->setDecExperienceMoney($price);
         $save = $member->saveExperienceMoney();
         $order->finishPay(new Event());
     }
     return $save;
 }
Exemplo n.º 2
0
 public function markOrderReg(Order $order)
 {
     $price = $order->getPrice();
     $order->setUserId(wanhunet::app()->member->getId());
     $order->setProductId($this->id);
     $saveOrder = $order->saveOrder();
     if ($saveOrder) {
         $this->afterMarkOrder();
     }
     return $order;
 }