|
@@ -51,18 +51,19 @@ class Cron
|
|
|
{
|
|
|
$num = Dever::input('num', 1);
|
|
|
|
|
|
- $where['status'] = 2;
|
|
|
+ $where['status'] = $w['status'] = 2;
|
|
|
|
|
|
$store = Dever::db('store/info')->select();
|
|
|
|
|
|
foreach ($store as $k => $v) {
|
|
|
+ $where['status'] = 2;
|
|
|
$where['type'] = 2;
|
|
|
$where['type_id'] = $v['id'];
|
|
|
- $this->up($where, $v, 'store', $num);
|
|
|
+ $this->up($where, $v, 'store', $num, 1);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ $w['source_type'] = 2;
|
|
|
+ $w['source_id'] = $v['id'];
|
|
|
+ $this->up($w, $v, 'store', $num, 2);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -82,7 +83,7 @@ class Cron
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function up($where, $info, $type, $num)
|
|
|
+ private function up($where, $info, $type, $num, $k = 1)
|
|
|
{
|
|
|
$state = $this->check($info);
|
|
|
if (!$state) {
|
|
@@ -105,8 +106,8 @@ class Cron
|
|
|
$data[$type . '_id'] = $info['id'];
|
|
|
$data['type'] = $info['stat_type'];
|
|
|
$data['day'] = $start;
|
|
|
+ $data['t'] = $k;
|
|
|
$find = Dever::db('cash/' . $type)->find($data);
|
|
|
-
|
|
|
if ($type == 'factory') {
|
|
|
$msg_type = 4;
|
|
|
$cash = Dever::db('cash/order')->getPCash($where);
|
|
@@ -124,6 +125,8 @@ class Cron
|
|
|
if (!$find) {
|
|
|
$id = Dever::db('cash/' . $type)->insert($data);
|
|
|
} else {
|
|
|
+ $data['cash'] += $find['cash'];
|
|
|
+ $data['num'] += $find['num'];
|
|
|
$id = $data['where_id'] = $find['id'];
|
|
|
Dever::db('cash/' . $type)->update($data);
|
|
|
}
|