|
@@ -30,9 +30,14 @@ class merchant_infoControl extends mbMerchantControl
|
|
} else {
|
|
} else {
|
|
$merchant_info['warning_phone'] = unserialize($merchant_info['warning_phone']);
|
|
$merchant_info['warning_phone'] = unserialize($merchant_info['warning_phone']);
|
|
}
|
|
}
|
|
- $cond['add_time'] = ['between', [strtotime(date("Y-m-d",time())), time()]];
|
|
|
|
|
|
+
|
|
$cond['status'] = $cond['is_operation'] = 2;
|
|
$cond['status'] = $cond['is_operation'] = 2;
|
|
$cond['mchid'] = $mchid;
|
|
$cond['mchid'] = $mchid;
|
|
|
|
+ $stats = Model('')->table('refill_evidence')
|
|
|
|
+ ->field('sum(amount) as amounts')
|
|
|
|
+ ->where($cond)->select();
|
|
|
|
+ $merchant_info['evidence_amounts'] = empty($stats) ? 0 : $stats[0]['amounts'];
|
|
|
|
+ $cond['add_time'] = ['between', [strtotime(date("Y-m-d",time())), time()]];
|
|
$day_evidence = $model_merchant->getRefillEvidence($cond);
|
|
$day_evidence = $model_merchant->getRefillEvidence($cond);
|
|
$merchant_info['evidence_count'] = count($day_evidence);
|
|
$merchant_info['evidence_count'] = count($day_evidence);
|
|
return self::outsuccess($merchant_info);
|
|
return self::outsuccess($merchant_info);
|
|
@@ -67,6 +72,9 @@ class merchant_infoControl extends mbMerchantControl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$result['max'] = ceil($max * 1.1);
|
|
$result['max'] = ceil($max * 1.1);
|
|
|
|
+ $week_month_stats = $this->refillStats();
|
|
|
|
+ $result['month'] = $week_month_stats['month'];
|
|
|
|
+ $result['week'] = $week_month_stats['week'];
|
|
return self::outsuccess($result);
|
|
return self::outsuccess($result);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -141,23 +149,54 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
|
|
|
private function refillCountDispose($stats)
|
|
private function refillCountDispose($stats)
|
|
{
|
|
{
|
|
- $result['count'] = $result['sendCount'] = $result['errorCount'] = $result['successCount'] = $result['amountCount'] = 0;
|
|
|
|
|
|
+ $result['count'] = $result['sendCount'] = $result['errorCount'] = $result['successCount'] = $result['amountCount'] = $result['errorAmounts'] = $result['successAmounts'] = 0;
|
|
foreach ($stats as $count) {
|
|
foreach ($stats as $count) {
|
|
$result['count'] += $count['order_count'];
|
|
$result['count'] += $count['order_count'];
|
|
|
|
+ $result['amountCount'] += $count['mch_amounts'];
|
|
if($count['order_state'] == ORDER_STATE_SEND) {
|
|
if($count['order_state'] == ORDER_STATE_SEND) {
|
|
$result['sendCount'] = $count['order_count'];
|
|
$result['sendCount'] = $count['order_count'];
|
|
}
|
|
}
|
|
if($count['order_state'] == ORDER_STATE_CANCEL) {
|
|
if($count['order_state'] == ORDER_STATE_CANCEL) {
|
|
$result['errorCount'] = $count['order_count'];
|
|
$result['errorCount'] = $count['order_count'];
|
|
|
|
+ $result['errorAmounts'] = $count['mch_amounts'];
|
|
}
|
|
}
|
|
if($count['order_state'] == ORDER_STATE_SUCCESS) {
|
|
if($count['order_state'] == ORDER_STATE_SUCCESS) {
|
|
$result['successCount'] = $count['order_count'];
|
|
$result['successCount'] = $count['order_count'];
|
|
- $result['amountCount'] = $count['mch_amounts'];
|
|
|
|
|
|
+ $result['successAmounts'] = $count['mch_amounts'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function refillStats()
|
|
|
|
+ {
|
|
|
|
+ $reader = function ($mchid,$time,$end_time) {
|
|
|
|
+ $cond['mchid'] = $mchid;
|
|
|
|
+ $cond['inner_status'] = 0;
|
|
|
|
+ $cond['refill_order.order_time'] = ['between', [$time, $end_time]];
|
|
|
|
+
|
|
|
|
+ $items = Model('')->table('refill_order,vr_order')->join('inner')
|
|
|
|
+ ->on('refill_order.order_id=vr_order.order_id')
|
|
|
|
+ ->field('count(*) as order_count, vr_order.order_state, sum(mch_amount) as mch_amounts')
|
|
|
|
+ ->group('order_state')
|
|
|
|
+ ->where($cond)->select();
|
|
|
|
+
|
|
|
|
+ return $this->refillCountDispose($items);
|
|
|
|
+ };
|
|
|
|
+ $date = date("Y-m-d");
|
|
|
|
+ $first = 1;
|
|
|
|
+ $w = date('w',strtotime($date)); ;
|
|
|
|
+ $week_start = strtotime(date('Y-m-d',strtotime("$date -".($w ? $w - $first : 6).' days')));
|
|
|
|
+ $week_end = strtotime(date('Y-m-d',strtotime("$week_start +7 days"))) - 1;
|
|
|
|
+ $week = $reader($this->mchid(), $week_start,$week_end);
|
|
|
|
+
|
|
|
|
+ $month_start = strtotime(date("Y-m-1"));
|
|
|
|
+ $month_end = strtotime(date("Y-m-1",strtotime("+1month")))-1;
|
|
|
|
+ $month = $reader($this->mchid(), $month_start, $month_end);
|
|
|
|
+
|
|
|
|
+ return ['week' => $week , 'month' => $month];
|
|
|
|
+ }
|
|
|
|
+
|
|
public function addipOp()
|
|
public function addipOp()
|
|
{
|
|
{
|
|
$mchid = $this->mchid();
|
|
$mchid = $this->mchid();
|