예제 #1
0
 public function uc_updatecredit()
 {
     $time = $_GET['time'];
     if (time() - $time > 10) {
         exit;
     }
     $auth = $_GET['auth'];
     $uid = intval($_GET['uid']);
     $credit = intval($_GET['credit']);
     $amount = intval($_GET['amount']);
     if (!$uid || !$credit || empty($auth) || !$amount || md5($uid . $credit . $amount . $time . C('AUTH')) != $auth) {
         return;
     }
     $increase = Consume::increase($uid, $amount, Consume::TYPE_CREDIT);
 }
예제 #2
0
 /**
  * 确认完成
  *
  */
 public function finish()
 {
     if ($this->isAjax()) {
         $id = intval($_REQUEST['id']);
         $record = M('payment')->where("id='{$id}'")->find();
         if ($record['status'] == 104) {
             $this->ajaxReturn('', '该交易已完成', 0);
         }
         //记录日志
         Consume::increase($record['user_id'], $record['amount'], Consume::TYPE_MONEY);
         M('payment')->where("id='{$id}'")->save(array('status' => 104));
         $this->ajaxReturn('', '操作成功', 1);
     }
 }
예제 #3
0
 private function _pay_notify_alipay_warrant()
 {
     import('@.Com.payment.PaymentFactory');
     $payment = PaymentFactory::getPayment('AlipayWarrant');
     $result = $payment->verifyNotify();
     if ($result !== false) {
         $result['trade_status'] = trim($result['trade_status']);
         if ($result['trade_status'] == 'WAIT_BUYER_PAY' || $result['trade_status'] == 'WAIT_SELLER_SEND_GOODS' || $result['trade_status'] == 'WAIT_BUYER_CONFIRM_GOODS' || $result['trade_status'] == 'TRADE_FINISHED') {
             $record = M('payment')->where("out_trade_no='{$result['out_trade_no']}'")->find();
             if ($record['status'] == 104) {
                 exit('success');
             }
             if ($record && $record['amount'] == $result['total_fee']) {
                 $status = 102;
                 //等待买家付款
                 if ($result['trade_status'] == 'WAIT_BUYER_PAY') {
                     $status = 103;
                 } else {
                     if ($result['trade_status'] == 'WAIT_SELLER_SEND_GOODS') {
                         //自动发货
                         $response = $payment->send_goods(array('trade_no' => $result['trade_no']));
                         if ($response) {
                             $status = 105;
                         } else {
                             $status = 102;
                         }
                     } else {
                         if ($result['trade_status'] == 'WAIT_BUYER_CONFIRM_GOODS') {
                             $status = 105;
                         } else {
                             if ($result['trade_status'] == 'TRADE_FINISHED') {
                                 if ($record && $record['amount'] == $result['total_fee']) {
                                     //记录日志
                                     Consume::increase($record['user_id'], $result['total_fee'], Consume::TYPE_MONEY);
                                     $status = 104;
                                 } else {
                                     $status = $record['status'];
                                 }
                             }
                         }
                     }
                 }
                 M('payment')->where("out_trade_no='{$result['out_trade_no']}'")->save(array('status' => $status, 'trade_no' => $result['trade_no']));
                 exit('success');
             } else {
                 exit('fail');
             }
         } else {
             exit('fail');
         }
     } else {
         exit('fail');
     }
 }