Exemplo n.º 1
0
 /**
  * 更新一个订单
  *
  * @param object $dm 订单数据模型
  * return mixed
  */
 public function updateOrder(PwOrderDm $dm)
 {
     if (($result = $dm->beforeUpdate()) !== true) {
         return $result;
     }
     return $this->_getDao()->updateOrder($dm->id, $dm->getData());
 }
Exemplo n.º 2
0
 public function run()
 {
     $order = Wekit::load('pay.PwOrder')->getOrderByOrderNo($this->_var['out_trade_no']);
     if (empty($order)) {
         $this->paymsg('onlinepay.order.exists.not');
     }
     $fee = $order['number'] * $order['price'];
     if ($fee != $this->_var['total_fee'] || $this->_var['seller_email'] != $this->_conf['alipay']) {
         $this->paymsg('onlinepay.fail');
     }
     if (!in_array($this->_var['trade_status'], array('TRADE_FINISHED', 'TRADE_SUCCESS', 'WAIT_SELLER_SEND_GOODS'))) {
         $this->paymsg('onlinepay.success');
     }
     if ($order['state'] == 2) {
         $this->paymsg('onlinepay.order.paid');
     }
     $className = Wind::import('SRV:pay.srv.action.PwPayAction' . $order['paytype']);
     if (class_exists($className)) {
         $class = new $className($order);
         $class->run();
     }
     Wind::import('SRV:pay.dm.PwOrderDm');
     $dm = new PwOrderDm($order['id']);
     $dm->setPayemail($this->_var['buyer_email'])->setState(2)->setPaymethod(1);
     Wekit::load('pay.PwOrder')->updateOrder($dm);
     $this->paymsg('onlinepay.success');
 }
Exemplo n.º 3
0
 public function run()
 {
     $order = Wekit::load('pay.PwOrder')->getOrderByOrderNo($this->_var['invoice']);
     if (empty($order)) {
         $this->paymsg('onlinepay.order.exists.not');
     }
     $fee = $order['number'] * $order['price'];
     if ($fee != $this->_var['mc_gross']) {
         $this->paymsg('onlinepay.fail');
     }
     if ($this->_var['payment_status'] != 'Completed') {
         $this->paymsg('onlinepay.success');
     }
     if ($order['state'] == 2) {
         $this->paymsg('onlinepay.order.paid');
     }
     $className = Wind::import('SRV:pay.srv.action.PwPayAction' . $order['paytype']);
     if (class_exists($className)) {
         $class = new $className($order);
         $class->run();
     }
     Wind::import('SRV:pay.dm.PwOrderDm');
     $dm = new PwOrderDm($order['id']);
     $dm->setState(2)->setPaymethod(3);
     Wekit::load('pay.PwOrder')->updateOrder($dm);
     $this->paymsg('onlinepay.success');
 }
Exemplo n.º 4
0
 public function run()
 {
     $order = Wekit::load('pay.PwOrder')->getOrderByOrderNo($this->_var['transaction_id']);
     if (empty($order)) {
         $this->paymsg('onlinepay.order.exists.not');
     }
     if ($order['state'] == 2) {
         $this->paymsg('onlinepay.order.paid');
     }
     $className = Wind::import('SRV:pay.srv.action.PwPayAction' . $order['paytype']);
     if (class_exists($className)) {
         $class = new $className($order);
         $class->run();
     }
     Wind::import('SRV:pay.dm.PwOrderDm');
     $dm = new PwOrderDm($order['id']);
     $dm->setState(2)->setPaymethod(2);
     Wekit::load('pay.PwOrder')->updateOrder($dm);
     $this->paymsg('onlinepay.success');
 }
Exemplo n.º 5
0
 /**
  * 现金充值
  */
 public function payAction()
 {
     $config = Wekit::C('pay');
     if (!$config['ifopen']) {
         $this->showError($config['reason']);
     }
     list($credit, $pay, $paymethod) = $this->getInput(array('credit', 'pay', 'paymethod'));
     if (!in_array($paymethod, array('1', '2', '3', '4'))) {
         $this->showError('onlinepay.paymethod.select');
     }
     $onlinepay = Wekit::load('pay.srv.PwPayService')->getPayMethod($paymethod);
     if (($result = $onlinepay->check()) instanceof PwError) {
         $this->showError($result->getError());
     }
     $recharge = Wekit::C('credit', 'recharge');
     $creditBo = PwCreditBo::getInstance();
     if (!isset($recharge[$credit]) || !isset($creditBo->cType[$credit])) {
         $this->showError('CREDIT:pay.type.error');
     }
     $pay = round($pay, 2);
     $min = max(0, $recharge[$credit]['min']);
     if ($pay < $min) {
         $this->showError(array('CREDIT:pay.num.min', array('{min}' => $min)));
     }
     $creditName = $creditBo->cType[$credit];
     $order_no = $onlinepay->createOrderNo();
     Wind::import('SRV:pay.dm.PwOrderDm');
     $dm = new PwOrderDm();
     $dm->setOrderNo($order_no)->setPrice($pay)->setNumber(1)->setState(0)->setPaytype(1)->setBuy($credit)->setCreatedUserid($this->loginUser->uid)->setCreatedTime(Pw::getTime());
     Wekit::load('pay.PwOrder')->addOrder($dm);
     Wind::import('SRV:pay.vo.PwPayVo');
     $vo = new PwPayVo();
     $vo->setOrderNo($order_no)->setFee($pay)->setTitle('积分充值(订单号:' . $order_no . ')')->setBody('购买论坛' . $creditName . '(论坛UID:' . $this->loginUser->uid . ')');
     $this->setOutput(array('url' => $onlinepay->getUrl($vo)), 'data');
     //todo WindUrlHelper 改进
     $this->showMessage('success');
     //$this->showMessage('success', $onlinepay->getUrl($vo));
     //$this->forwardRedirect($onlinepay->getUrl($vo));
 }