|
@@ -776,9 +776,9 @@ class merchantControl extends SystemControl
|
|
|
|
|
|
public function OrderQueryOp()
|
|
|
{
|
|
|
- $model_refill_order = Model('vr_order');
|
|
|
+ $model_vr_order = Model('vr_order');
|
|
|
$condition['order_state'] = ORDER_STATE_SEND;
|
|
|
- $orders = $model_refill_order->getOrderList($condition);
|
|
|
+ $orders = $model_vr_order->getOrderList($condition);
|
|
|
if(!empty($orders)) {
|
|
|
foreach ($orders as $order) {
|
|
|
$order_id = $order['order_id'];
|
|
@@ -788,6 +788,26 @@ class merchantControl extends SystemControl
|
|
|
showMessage('操作成功', 'index.php?act=merchant&op=refill_order');
|
|
|
}
|
|
|
|
|
|
+ public function mch_notifyOp()
|
|
|
+ {
|
|
|
+ $model_refill_order = Model('refill_order');
|
|
|
+
|
|
|
+ $condition['mch_notify_state'] = 0;
|
|
|
+ $condition['inner_status'] = 0;
|
|
|
+ $orders = $model_refill_order->getMerchantOrderList($condition, 1000, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
|
|
|
+ if(!empty($orders)) {
|
|
|
+ foreach ($orders as $order) {
|
|
|
+ $order_id = $order['order_id'];
|
|
|
+ if($order['order_state'] == ORDER_STATE_SEND) {
|
|
|
+ QueueClient::push("QueryRefillState",['order_id' => $order_id]);
|
|
|
+ }else{
|
|
|
+ QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id,'manual' => true]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ showMessage('操作成功', 'index.php?act=merchant&op=refill_order');
|
|
|
+ }
|
|
|
+
|
|
|
public function refill_orderOp()
|
|
|
{
|
|
|
$model_refill_order = Model('refill_order');
|
|
@@ -831,8 +851,7 @@ class merchantControl extends SystemControl
|
|
|
}
|
|
|
|
|
|
$start_unixtime = strtotime($_GET['query_start_time']);
|
|
|
- $end_unixtime = strtotime($_GET['query_end_time']);
|
|
|
-
|
|
|
+ $end_unixtime = strtotime($_GET['query_end_time']);
|
|
|
if ($start_unixtime >0 && $end_unixtime >0) {
|
|
|
$condition['refill_order.order_time'] = ['between', [$start_unixtime, $end_unixtime]];
|
|
|
}
|
|
@@ -856,10 +875,7 @@ class merchantControl extends SystemControl
|
|
|
}
|
|
|
$order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
|
|
|
|
|
|
- $stat = Model('')->table('refill_order,vr_order')->join('inner')
|
|
|
- ->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)->select();
|
|
|
+ $stat = $this->all_order_state_stat($condition);
|
|
|
$count = $this->refill_stat($condition);
|
|
|
foreach ($order_list as $order_id => $order_info)
|
|
|
{
|
|
@@ -877,7 +893,7 @@ class merchantControl extends SystemControl
|
|
|
}
|
|
|
}
|
|
|
$provider_list = Model('')->table('refill_provider')->limit(100)->select();
|
|
|
- Tpl::output('stat', $stat[0]);
|
|
|
+ Tpl::output('stat', $stat);
|
|
|
Tpl::output('count', $count);
|
|
|
Tpl::output('order_list', $order_list);
|
|
|
Tpl::output('provider_list', $provider_list);
|
|
@@ -1320,20 +1336,40 @@ class merchantControl extends SystemControl
|
|
|
|
|
|
private function refill_stat($condition)
|
|
|
{
|
|
|
+ $stat_order = function ($condition) {
|
|
|
+ $stat = Model('')->table('refill_order,vr_order')->join('inner')
|
|
|
+ ->on('refill_order.order_id=vr_order.order_id')
|
|
|
+ ->field('count(*) as order_count ')
|
|
|
+ ->where($condition)->find();
|
|
|
|
|
|
- $condition['order_state'] = ORDER_STATE_SEND;
|
|
|
+ return $stat['order_count'];
|
|
|
+ };
|
|
|
|
|
|
+ $condition['order_state'] = ORDER_STATE_SEND;
|
|
|
$condition['refill_order.order_time'] = ['between', [(time() - 300) , (time() - 180)]];
|
|
|
- $three_minute_stats = Model('')->table('refill_order,vr_order')->join('inner')
|
|
|
- ->on('refill_order.order_id=vr_order.order_id')
|
|
|
- ->field('count(*) as order_count ')
|
|
|
- ->where($condition)->find();
|
|
|
+ $three_minute_stats = $stat_order($condition);
|
|
|
$condition['refill_order.order_time'] = ['lt', (time() - 300)];
|
|
|
- $five_minute_stats = Model('')->table('refill_order,vr_order')->join('inner')
|
|
|
- ->on('refill_order.order_id=vr_order.order_id')
|
|
|
- ->field('count(*) as order_count ')
|
|
|
- ->where($condition)->find();
|
|
|
- return ['exceed_three' => $three_minute_stats['order_count'] , 'exceed_five' => $five_minute_stats['order_count']];
|
|
|
+ $five_minute_stats = $stat_order($condition);
|
|
|
+ return ['exceed_three' => $three_minute_stats , 'exceed_five' => $five_minute_stats];
|
|
|
+ }
|
|
|
+
|
|
|
+ private function all_order_state_stat($condition)
|
|
|
+ {
|
|
|
+ $stat_order = function ($condition) {
|
|
|
+ return Model('')->table('refill_order,vr_order')->join('inner')
|
|
|
+ ->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();
|
|
|
+ };
|
|
|
+ $all = $stat_order($condition);
|
|
|
+ $condition['order_state'] = ORDER_STATE_SEND;
|
|
|
+ $sending = $stat_order($condition);
|
|
|
+ $condition['order_state'] = ORDER_STATE_SUCCESS;
|
|
|
+ $success = $stat_order($condition);
|
|
|
+ $condition['order_state'] = ORDER_STATE_CANCEL;
|
|
|
+ $cancel = $stat_order($condition);
|
|
|
+
|
|
|
+ return ['all' => $all , 'sending' => $sending , 'success' => $success , 'cancel' => $cancel];
|
|
|
}
|
|
|
|
|
|
|