|
@@ -1,6 +1,9 @@
|
|
|
<?php
|
|
|
-
|
|
|
require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
|
|
|
+require_once(BASE_HELPER_PATH . '/refill/util.php');
|
|
|
+
|
|
|
+use refill\util;
|
|
|
+
|
|
|
class ordersendlistControl extends SystemControl
|
|
|
{
|
|
|
public function __construct()
|
|
@@ -30,13 +33,13 @@ class ordersendlistControl extends SystemControl
|
|
|
if ($_GET['time'] == 2) {
|
|
|
$condition['refill_order.order_time'] = ['lt', (time() - 3600)];
|
|
|
}
|
|
|
- $time_out_order = function($time_out, $condition){
|
|
|
+ $time_out_order = function ($time_out, $condition) {
|
|
|
$mchids = Model('')->table('merchant')->where(['time_out' => ['elt', $time_out]])->field('mchid')->select();
|
|
|
$mchids = array_column($mchids, 'mchid');
|
|
|
$mchids = implode(',', $mchids);
|
|
|
|
|
|
$condition['refill_order.order_time'] = ['lt', (time() - $time_out)];
|
|
|
- $condition['refill_order.mchid'] = ['in',$mchids];
|
|
|
+ $condition['refill_order.mchid'] = ['in', $mchids];
|
|
|
return $condition;
|
|
|
};
|
|
|
if ($_GET['time'] == 3) {
|
|
@@ -86,11 +89,11 @@ class ordersendlistControl extends SystemControl
|
|
|
->on('refill_order.order_id=vr_order.order_id')
|
|
|
->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
|
|
|
->where($condition)->find();
|
|
|
- $count = $this->refill_stats($condition,$time_cond);
|
|
|
+ $count = $this->refill_stats($condition, $time_cond);
|
|
|
|
|
|
$merchant_list = Model('')->table('merchant')->limit(1000)->order('name asc')->select();
|
|
|
|
|
|
- $order_list = $this->orderFormat($order_list,$merchant_list);
|
|
|
+ $order_list = $this->orderFormat($order_list, $merchant_list);
|
|
|
$provider_list = Model('')->table('refill_provider,store')
|
|
|
->field('refill_provider.*,store.store_name')
|
|
|
->join('inner')
|
|
@@ -129,7 +132,7 @@ class ordersendlistControl extends SystemControl
|
|
|
public function neterr_orderOp()
|
|
|
{
|
|
|
$model_refill_order = Model('refill_order');
|
|
|
- if(!empty($_GET['store_id'])) {
|
|
|
+ if (!empty($_GET['store_id'])) {
|
|
|
$condition['vr_order.store_id'] = $_GET['store_id'];
|
|
|
}
|
|
|
$condition['refill_order.inner_status'] = 0;
|
|
@@ -138,7 +141,7 @@ class ordersendlistControl extends SystemControl
|
|
|
|
|
|
$order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time asc');
|
|
|
$merchant_list = Model('')->table('merchant')->limit(1000)->order('name asc')->select();
|
|
|
- $order_list = $this->orderFormat($order_list,$merchant_list);
|
|
|
+ $order_list = $this->orderFormat($order_list, $merchant_list);
|
|
|
|
|
|
$provider_list = Model('')->table('refill_provider,store')
|
|
|
->field('refill_provider.*,store.store_name')
|
|
@@ -153,6 +156,48 @@ class ordersendlistControl extends SystemControl
|
|
|
Tpl::showpage('refill.order.neterr.index');
|
|
|
}
|
|
|
|
|
|
+ public function neterr_order_manualOp()
|
|
|
+ {
|
|
|
+ $type = $_GET['type'];
|
|
|
+ $official_sn = $_GET['official_sn'] ?? '';
|
|
|
+ if ($type != 'success' && $type != 'cancel') {
|
|
|
+ showMessage('手动操作类型错误');
|
|
|
+ }
|
|
|
+ $order_ids = $_GET['order_ids'];
|
|
|
+ $model_refill_order = Model('refill_order');
|
|
|
+ $condition['refill_order.order_id'] = ['in', $order_ids];
|
|
|
+ $condition['refill_order.inner_status'] = 0;
|
|
|
+ $condition['refill_order.neterr'] = 1;
|
|
|
+ $condition['vr_order.order_state'] = ORDER_STATE_PAY;
|
|
|
+
|
|
|
+ $order_list = $model_refill_order->getMerchantOrderList($condition);
|
|
|
+ if (empty($order_list)) {
|
|
|
+ showMessage('暂无数据');
|
|
|
+ }
|
|
|
+ $logic_vr_order = Logic("vr_order");
|
|
|
+ $mod_vr_order = Model('vr_order');
|
|
|
+ foreach ($order_list as $order) {
|
|
|
+ $order_id = $order['order_id'];
|
|
|
+ if ($type == 'success') {
|
|
|
+ $logic_vr_order->changeOrderStateSuccess($order_id, true);
|
|
|
+ if (!empty($official_sn)) {
|
|
|
+ $model_refill_order->edit($order_id, ['official_sn' => $official_sn]);
|
|
|
+ }
|
|
|
+ } elseif ($type == 'cancel') {
|
|
|
+ $order_info = $mod_vr_order->getOrderInfo(['order_id' => $order_id]);
|
|
|
+ $logic_vr_order->changeOrderStateCancel($order_info, '', "充值失败", true, true);
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if ($order['notify_time'] == 0) {
|
|
|
+ $model_refill_order->edit($order_id, ['notify_state' => 1, 'notify_time' => time()]);
|
|
|
+ }
|
|
|
+ util::pop_queue_order($order['mchid'], $order['mch_order']);
|
|
|
+ QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => true]);
|
|
|
+ }
|
|
|
+ showMessage('操作成功');
|
|
|
+ }
|
|
|
+
|
|
|
public function orderFormat($order_list, $merchant_list): array
|
|
|
{
|
|
|
$merchants = [];
|
|
@@ -170,13 +215,13 @@ class ordersendlistControl extends SystemControl
|
|
|
|
|
|
$order_list[$order_id]['diff_time'] = $diff_time;
|
|
|
$order_list[$order_id]['diff_time_text'] = $this->elapse_time($diff_time);
|
|
|
- $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality'],$order_info['card_type']);
|
|
|
- if($diff_time > $merchants[$order_info['mchid']]['time_out'] && $order_info['order_state'] == ORDER_STATE_SEND) {
|
|
|
+ $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality'], $order_info['card_type']);
|
|
|
+ if ($diff_time > $merchants[$order_info['mchid']]['time_out'] && $order_info['order_state'] == ORDER_STATE_SEND) {
|
|
|
$order_list[$order_id]['time_out_state'] = 0;
|
|
|
- if(in_array($order_info['card_type'],[mtopcard\PetroChinaCard,mtopcard\SinopecCard]) && $diff_time >= 1800) {
|
|
|
+ if (in_array($order_info['card_type'], [mtopcard\PetroChinaCard, mtopcard\SinopecCard]) && $diff_time >= 1800) {
|
|
|
$order_list[$order_id]['time_out_state'] = 1;
|
|
|
}
|
|
|
- if(in_array($order_info['card_type'],[mtopcard\ChinaMobileCard,mtopcard\ChinaUnicomCard,mtopcard\ChinaTelecomCard])) {
|
|
|
+ if (in_array($order_info['card_type'], [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard])) {
|
|
|
if (in_array($order_info['quality'], [
|
|
|
\refill\Quality::SlowTwentyFour,
|
|
|
\refill\Quality::SlowSix,
|
|
@@ -184,14 +229,14 @@ class ordersendlistControl extends SystemControl
|
|
|
\refill\Quality::SlowFortyEight,
|
|
|
\refill\Quality::SlowSeventyTwo])) {
|
|
|
$order_list[$order_id]['time_out_state'] = 2;
|
|
|
- } elseif(in_array($order_info['mchid'],[10132])) {
|
|
|
+ } elseif (in_array($order_info['mchid'], [10132])) {
|
|
|
//重点机构
|
|
|
$order_list[$order_id]['time_out_state'] = 3;
|
|
|
} else {
|
|
|
$order_list[$order_id]['time_out_state'] = 4;
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$order_list[$order_id]['time_out_state'] = 0;
|
|
|
}
|
|
|
}
|
|
@@ -206,12 +251,12 @@ class ordersendlistControl extends SystemControl
|
|
|
$order_state_cancel = ORDER_STATE_CANCEL;
|
|
|
$order_state_success = ORDER_STATE_SUCCESS;
|
|
|
$condition['refill_order.inner_status'] = 0;
|
|
|
- $condition['vr_order.order_state'] = ['in',"{$order_state_cancel},{$order_state_success}"];
|
|
|
+ $condition['vr_order.order_state'] = ['in', "{$order_state_cancel},{$order_state_success}"];
|
|
|
$condition['refill_order.mch_notify_state'] = 0;
|
|
|
- if(empty($_GET['time'])) {
|
|
|
+ if (empty($_GET['time'])) {
|
|
|
$_GET['time'] = 1;
|
|
|
}
|
|
|
- if(empty($_GET['notify_time'])) {
|
|
|
+ if (empty($_GET['notify_time'])) {
|
|
|
$_GET['notify_time'] = 180;
|
|
|
}
|
|
|
$time = $_GET['time'] * 3600;
|
|
@@ -223,7 +268,7 @@ class ordersendlistControl extends SystemControl
|
|
|
|
|
|
$order_list = $model_refill_order->getMerchantOrderList($condition, '', 'refill_order.*,vr_order.order_state', 'refill_order.notify_time asc', 1000);
|
|
|
$merchant_list = Model('')->table('merchant')->limit(1000)->order('name asc')->select();
|
|
|
- $order_list = $this->orderFormat($order_list,$merchant_list);
|
|
|
+ $order_list = $this->orderFormat($order_list, $merchant_list);
|
|
|
|
|
|
$provider_list = Model('')->table('refill_provider,store')
|
|
|
->field('refill_provider.*,store.store_name')
|
|
@@ -240,7 +285,7 @@ class ordersendlistControl extends SystemControl
|
|
|
|
|
|
public function notifyerr_all_notifyOp()
|
|
|
{
|
|
|
- if(empty($_GET['time']) || empty($_GET['notify_time'])) {
|
|
|
+ if (empty($_GET['time']) || empty($_GET['notify_time'])) {
|
|
|
showMessage('日期条件错误');
|
|
|
}
|
|
|
$model_refill_order = Model('refill_order');
|
|
@@ -248,7 +293,7 @@ class ordersendlistControl extends SystemControl
|
|
|
$order_state_cancel = ORDER_STATE_CANCEL;
|
|
|
$order_state_success = ORDER_STATE_SUCCESS;
|
|
|
$condition['refill_order.inner_status'] = 0;
|
|
|
- $condition['vr_order.order_state'] = ['in',"{$order_state_cancel},{$order_state_success}"];
|
|
|
+ $condition['vr_order.order_state'] = ['in', "{$order_state_cancel},{$order_state_success}"];
|
|
|
$condition['refill_order.mch_notify_state'] = 0;
|
|
|
|
|
|
$time = $_GET['time'] * 3600;
|