예제 #1
0
파일: account.php 프로젝트: elmoy/wenheyou
 /**
  * 催单
  */
 public function order_hurry()
 {
     $v = new \Model\Validation();
     $order_id = \Core\URI::kv('id');
     $order = \Db\Trade\Order::row(array('order_id' => $order_id, 'user_id' => $this->user->user_id));
     $time_start = \Core\Cookie::get('time_start');
     $v->required($order)->message('订单不存在', 1000);
     if (!$v->has_error()) {
         if (empty($time_start)) {
             \Core\Cookie::set('time_start', W_START_TIME);
             //@todo 更新催单时间
             $order->hurry_status = 1;
             $order->hurry_time = W_START_TIME;
             $order->update();
             $v->set_data(\Core\URI::a2p(array('trade' => 'order', 'id' => $order->id)));
         } else {
             if (W_START_TIME - $time_start > 600) {
                 //@todo 更新催单时间
                 $order->hurry_status = 1;
                 $order->hurry_time = W_START_TIME;
                 $order->update();
                 $v->set_data(\Core\URI::a2p(array('trade' => 'order', 'id' => $order->id)));
             }
             $v->required(false)->message('已经收到,正在加急处理', 1000);
         }
     }
     $v->send();
 }
예제 #2
0
파일: trade.php 프로젝트: elmoy/wenheyou
 /**
  * 支付完成回调通知
  */
 public function notice()
 {
     require_once W_LIBRARY_PATH . '/wx/pay/WxPayPubHelper/WxPayPubHelper.php';
     //使用通用通知接口
     $notify = new \Notify_pub();
     //存储微信的回调
     $xml = $GLOBALS['HTTP_RAW_POST_DATA'];
     // 记录日志
     log_message($xml);
     $notify->saveData($xml);
     //验证签名,并回应微信。
     //对后台通知交互时,如果微信收到商户的应答不是成功或超时,微信认为通知失败,
     //微信会通过一定的策略(如30分钟共8次)定期重新发起通知,
     //尽可能提高通知的成功率,但微信不保证通知最终能成功。
     if ($notify->checkSign() == FALSE) {
         $notify->setReturnParameter("return_code", "FAIL");
         //返回状态码
         $notify->setReturnParameter("return_msg", "签名失败");
         //返回信息
     } else {
         $notify->setReturnParameter("return_code", "SUCCESS");
         //设置返回码
     }
     $returnXml = $notify->returnXml();
     echo $returnXml;
     //以log文件形式记录回调信息
     if ($notify->checkSign() == TRUE) {
         if ($notify->data["return_code"] == "FAIL") {
             //此处应该更新一下订单状态,商户自行增删操作
             log_message("【通信出错】:\n" . $xml . "\n");
         } elseif ($notify->data["result_code"] == "FAIL") {
             //此处应该更新一下订单状态,商户自行增删操作
             log_message("【业务出错】:\n" . $xml . "\n");
         } else {
             //此处应该更新一下订单状态,商户自行增删操作
             log_message("【支付成功】:\n" . $xml . "\n");
             $row = \Db\Trade\Order::row(array('order_id' => $notify->data['out_trade_no'], 'pay_status' => 0));
             if (!empty($row)) {
                 $row->mch_id = $notify->data['mch_id'];
                 $row->trade_type = $notify->data['trade_type'];
                 $row->transaction_id = $notify->data['transaction_id'];
                 $row->bank_type = $notify->data['bank_type'];
                 $row->mch_id = $notify->data['mch_id'];
                 $row->pay_status = 1;
                 $row->order_status = 1;
                 $row->fee_type = $notify->data['fee_type'];
                 $row->pay_time = W_START_TIME;
                 $row->update();
             }
         }
     }
 }
예제 #3
0
파일: order.php 프로젝트: elmoy/wenheyou
 public function get()
 {
     $v = new \Model\Validation();
     $order_id = \Core\URI::kv('id');
     $order = \Db\Trade\Order::row(array('order_id' => $order_id));
     $v->required($order)->message('订单不存在', 1000);
     if (!$v->has_error()) {
         $view = view('order/get.php');
         $view->rows = unserialize($order->cart_text);
         //var_dump($view->rows);exit();
         $v->set_data($view->__toString());
     }
     $v->send();
 }