60 * $time, 'title' => '订单自动删除未支付', 'page_name' => '订单自动删除未支付', ]; //自动采集 $data['count'] = Order::autoDeleteNopay($number, ['day_before' => -1]); $this->setViewPath('common', 'index', 0); return $this->display($data); } public function cancleOrder() { $time = 17; $data = [ 'time' => 60 * $time, 'title' => '订单自动取消未支付', 'page_name' => '订单自动取消未支付', 'html' => '' ]; //自动删除30分钟前订单 $data['count'] = Order::autoCancleNopay( ['minute' => $time]); $this->setViewPath('common', 'index', 0); return $this->display($data); } //定时回调给外站 public function notify(Request $request) { $notify_number = $request->input('number', 2); $time = config_cache_default('corn_config.merchant_notify_time', 10); $number = config_cache_default('corn_config.merchant_notify_time_number', 20); $data = [ 'time' => $time, 'title' => '定时回调给商户', 'page_name' => '定时回调给商户', ]; $order = Order::with(['merchants', 'users', 'infos'])->where(['out_notify_status' => 0, 'pay_status' => 1])->where('notify_number', '<=', $notify_number)->limit($number)->get(); $data['count'] = Order::with(['merchants', 'users', 'infos'])->where(['out_notify_status' => 0, 'pay_status' => 1])->where('notify_number', '<=', $notify_number)->count(); $log = []; $html = ''; foreach ($order as $k => $v) { $r = Order::notifyMerchant($v, 'obj'); $result = $r; $html .= 'Order id:' . $v->id . '---,回调状态' . ($result['error'] == 0 ? '成功' : '失败'); $html .= $result['msg']; $html .= '
'; } //插入日志 $data['html'] = $html; $this->setViewPath('common', 'index', 0); return $this->display($data); } }