|
@@ -221,23 +221,22 @@ class handler
|
|
|
|
|
|
$mod = Model();
|
|
|
|
|
|
- $len = 1000;
|
|
|
- $i = 0;
|
|
|
+ $order_id = 0;
|
|
|
while (true)
|
|
|
{
|
|
|
- $start = $i * $len;
|
|
|
+ $cond['refill_order.order_id'] = ['gt', $order_id];
|
|
|
$items = $mod->table('refill_order,vr_order')
|
|
|
->field('refill_order.*,vr_order.order_state,vr_order.store_name')
|
|
|
->join('inner')
|
|
|
->on('refill_order.order_id=vr_order.order_id')
|
|
|
->where($cond)
|
|
|
->order('refill_order.order_id asc')
|
|
|
- ->limit("{$start},{$len}")
|
|
|
+ ->limit("0,1000")
|
|
|
->select();
|
|
|
- $i++;
|
|
|
|
|
|
if(empty($items)) break;
|
|
|
|
|
|
+ $order_id = intval(end($items)['order_id']);
|
|
|
yield [$items,$total_stage,$cur_stage];
|
|
|
}
|
|
|
$cur_stage++;
|
|
@@ -260,7 +259,7 @@ class handler
|
|
|
$merchants[$value['mchid']] = $value;
|
|
|
}
|
|
|
$column_key = 'A';
|
|
|
- for($index=0;$index<count($column_values);$index++){
|
|
|
+ for($execl_index=0;$execl_index<count($column_values);$execl_index++){
|
|
|
$column_keys[] = $column_key;
|
|
|
$column_key++;
|
|
|
}
|
|
@@ -322,20 +321,28 @@ class handler
|
|
|
};
|
|
|
|
|
|
$reader = $order_reader($normal_cond,$time_scope);
|
|
|
- $index = 0;
|
|
|
|
|
|
+ $stage = 0;
|
|
|
+ $execl_index = 0;
|
|
|
+ $cur_start = time();
|
|
|
foreach ($reader as $result)
|
|
|
{
|
|
|
- $cur_start = time();
|
|
|
[$items,$total_stage,$cur_stage] = $result;
|
|
|
foreach ($items as $order)
|
|
|
{
|
|
|
- $execl_writer($order,$index);
|
|
|
- $index += 1;
|
|
|
+ $execl_writer($order,$execl_index);
|
|
|
+ $execl_index += 1;
|
|
|
}
|
|
|
|
|
|
- $cur_end = time();
|
|
|
- $percentor($total_stage,$cur_stage,$cur_end - $cur_start);
|
|
|
+ if($stage == 0) {
|
|
|
+ $stage = $cur_stage;
|
|
|
+ }
|
|
|
+ elseif($stage != $cur_stage) {
|
|
|
+ $cur_end = time();
|
|
|
+ $percentor($total_stage,$stage,$cur_end - $cur_start);
|
|
|
+ $stage = $cur_stage;
|
|
|
+ $cur_start = $cur_end;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
try {
|