|
@@ -502,7 +502,7 @@ class Cron
|
|
|
$end_time = date('Y-m-d', strtotime($start_time. ' +1 month -1 day')).' 23:59:59';
|
|
|
$start = Dever::maketime($start_time);
|
|
|
$end = Dever::maketime($end_time);
|
|
|
- $shops = Dever::db('shop/info')->getAll();
|
|
|
+ $shops = Dever::db('shop/info')->getguiAll(array('type'=>2));
|
|
|
foreach ($shops as $k => $v) {
|
|
|
$w = array('end' => $end,'new_shop_id'=> $v['id']);
|
|
|
$member = Dever::db('agent/member_shop_log')->getAllByShop($w);
|
|
@@ -606,6 +606,27 @@ class Cron
|
|
|
}
|
|
|
|
|
|
|
|
|
+ $res = Dever::db('bill/shop_stat')->find(array('month'=>$insert['month'],'shop_id'=>$v['id']));
|
|
|
+ if ($res) {
|
|
|
+ $insert['where_id'] = $res['id'];
|
|
|
+ Dever::db('bill/shop_stat')->update($insert);
|
|
|
+ } else {
|
|
|
+ Dever::db('bill/shop_stat')->insert($insert);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $insert = array();
|
|
|
+ $insert['shop_id'] = $v['id'];
|
|
|
+ $insert['month'] = $start;
|
|
|
+ $insert['c_money'] = 0;
|
|
|
+ $insert['mids'] = '';
|
|
|
+ $insert['month_mids'] = array();
|
|
|
+ $insert['num'] = 0;
|
|
|
+ $insert['dl_num'] = 0;
|
|
|
+ $insert['v_num'] = 0;
|
|
|
+ $insert['ck_num'] = 0;
|
|
|
+ $insert['out_num'] = 0;
|
|
|
+ $insert['out_money'] = 0;
|
|
|
+ $insert['nei_money'] = 0;
|
|
|
$res = Dever::db('bill/shop_stat')->find(array('month'=>$insert['month'],'shop_id'=>$v['id']));
|
|
|
if ($res) {
|
|
|
$insert['where_id'] = $res['id'];
|
|
@@ -614,6 +635,7 @@ class Cron
|
|
|
Dever::db('bill/shop_stat')->insert($insert);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/*
|