Exemplo n.º 1
0
 /**
  * 催单
  */
 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();
 }
Exemplo n.º 2
0
 public function record_part()
 {
     $limit = 10;
     $page = \Core\URI::kv('page', 1);
     $offset = ($page - 1) * $limit;
     $user_id = \Core\URI::kv('user_id');
     $user = \DB\Account\User::row(array('user_id' => $user_id));
     $rows = \Db\Trade\Order::fetch(array('user_id' => $user->user_id), $limit, $offset, array('create_time' => 'desc'));
     $rs = '';
     $v = new \Model\Validation();
     if (!empty($rows)) {
         $view = view('user/record_part.php');
         $view->rows = $rows;
         $rs .= $view->__toString();
         $v->set_data($rs);
     } else {
         $v->required(false)->message('没有更多了...');
     }
     echo json_encode($v->get_error());
     exit;
 }
Exemplo n.º 3
0
 /**
  * 订单作废,15天后自动回收
  */
 public static function gc()
 {
     $where = array('order_status' => 0, 'pay_status' => 0);
     $rows = \DB\Trade\Order::fetch($where, 10, 0, array('create_time' => 'desc'));
     foreach ($rows as $row) {
         if ($row->create_time < W_START_TIME - 15 * 3600 * 24) {
             $row->order_status = 2;
             $row->save();
         }
     }
 }
Exemplo n.º 4
0
 /**
  * 支付完成回调通知
  */
 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();
             }
         }
     }
 }
Exemplo n.º 5
0
 /**
  * 搜索用户考勤
  */
 public function search()
 {
     \Core\View::css('/manage/daterange/font-awesome.min.css');
     \Core\View::css('/manage/daterange/daterangepicker-bs3.css');
     \Core\View::script('/manage/daterange/moment.js');
     \Core\View::script('/manage/daterange/daterangepicker.js');
     \Core\View::css('/manage/tablescroll/css/style.css');
     \Core\View::script('/manage/tablescroll/js/jquery.tablescroll.js');
     $order_id = \Core\URI::kv('order_id');
     $page = \Core\URI::kv('page', 1);
     $this->view->content = view('order/index.php');
     $limit = 12;
     $offset = ($page - 1) * $limit;
     $where = array("order_id like '{$order_id}%' or user_mobile like '{$order_id}%'");
     $this->view->content->rows = \Db\Trade\Order::fetch($where, $limit, $offset, array('hurry_time' => 'desc', 'create_time' => 'desc'));
     $this->view->content->page = new \Model\Page($page, \DB\Trade\Order::count($where), $limit);
     $this->view->content->order_id = $order_id;
 }
Exemplo n.º 6
0
 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();
 }