|
@@ -424,31 +424,32 @@ class Cron
|
|
|
$where['start'] = $start + 86400*$i;
|
|
|
$where['end'] = $start + 86400*$i + 86399;
|
|
|
$num = Dever::db('shop/sell_order_goods')->getNum($where);
|
|
|
- $data['cash'] = $data['num'] = 0;
|
|
|
if ($num) {
|
|
|
- $data = array();
|
|
|
- $data['shop_id'] = $num['shop_id'];
|
|
|
- $data['goods_id'] = $num['goods_id'];
|
|
|
- $data['day'] = $where['start'];
|
|
|
- $info = Dever::db('shop/goods_stat')->find($data);
|
|
|
-
|
|
|
- $shop = Dever::db('shop/info')->find($data['shop_id']);
|
|
|
- if ($shop) {
|
|
|
- $data['area'] = $shop['area'];
|
|
|
- }
|
|
|
- $goods_info = Dever::db('goods/info')->find($data['goods_id']);
|
|
|
- if ($goods_info) {
|
|
|
- $data['category'] = $goods_info['category'];
|
|
|
- }
|
|
|
-
|
|
|
- $data['cash'] = round($num['cash'], 2);
|
|
|
- $data['num'] = round($num['num'], 2);
|
|
|
+ foreach ($num as $k => $v) {
|
|
|
+ $data = array();
|
|
|
+ $data['shop_id'] = $v['shop_id'];
|
|
|
+ $data['goods_id'] = $v['goods_id'];
|
|
|
+ $data['day'] = $where['start'];
|
|
|
+ $info = Dever::db('shop/goods_stat')->find($data);
|
|
|
+
|
|
|
+ $shop = Dever::db('shop/info')->find($data['shop_id']);
|
|
|
+ if ($shop) {
|
|
|
+ $data['area'] = $shop['area'];
|
|
|
+ }
|
|
|
+ $goods_info = Dever::db('goods/info')->find($data['goods_id']);
|
|
|
+ if ($goods_info) {
|
|
|
+ $data['category'] = $goods_info['category'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $data['cash'] = round($v['cash'], 2);
|
|
|
+ $data['num'] = round($v['num'], 2);
|
|
|
|
|
|
- if (!$info) {
|
|
|
- Dever::db('shop/goods_stat')->insert($data);
|
|
|
- } else {
|
|
|
- $data['where_id'] = $info['id'];
|
|
|
- Dever::db('shop/goods_stat')->update($data);
|
|
|
+ if (!$info) {
|
|
|
+ Dever::db('shop/goods_stat')->insert($data);
|
|
|
+ } else {
|
|
|
+ $data['where_id'] = $info['id'];
|
|
|
+ Dever::db('shop/goods_stat')->update($data);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|