|
@@ -72,12 +72,14 @@ class Cron
|
|
$data[$type . '_id'] = $info['id'];
|
|
$data[$type . '_id'] = $info['id'];
|
|
$data['type'] = $info['stat_type'];
|
|
$data['type'] = $info['stat_type'];
|
|
$data['day'] = $start;
|
|
$data['day'] = $start;
|
|
- $info = Dever::db('cash/' . $type)->find($data);
|
|
+ $find = Dever::db('cash/' . $type)->find($data);
|
|
|
|
|
|
if ($type == 'factory') {
|
|
if ($type == 'factory') {
|
|
|
|
+ $msg_type = 4;
|
|
$cash = Dever::db('cash/order')->getPCash($where);
|
|
$cash = Dever::db('cash/order')->getPCash($where);
|
|
$data['cash'] = $cash['total'] ? $cash['total'] : 0;
|
|
$data['cash'] = $cash['total'] ? $cash['total'] : 0;
|
|
} else {
|
|
} else {
|
|
|
|
+ $msg_type = 3;
|
|
$cash = Dever::db('cash/order')->getCash($where);
|
|
$cash = Dever::db('cash/order')->getCash($where);
|
|
$data['cash'] = $cash['total'] ? $cash['total'] : 0;
|
|
$data['cash'] = $cash['total'] ? $cash['total'] : 0;
|
|
}
|
|
}
|
|
@@ -87,11 +89,19 @@ class Cron
|
|
$data['start'] = $start;
|
|
$data['start'] = $start;
|
|
$data['end'] = $end;
|
|
$data['end'] = $end;
|
|
|
|
|
|
- if (!$info) {
|
|
+ if (!$find) {
|
|
- Dever::db('cash/' . $type)->insert($data);
|
|
+ $id = Dever::db('cash/' . $type)->insert($data);
|
|
} else {
|
|
} else {
|
|
- $data['where_id'] = $info['id'];
|
|
+ $id = $data['where_id'] = $find['id'];
|
|
Dever::db('cash/' . $type)->update($data);
|
|
Dever::db('cash/' . $type)->update($data);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (($type == 'factory' || $type == 'store') && Dever::project('message') && $id) {
|
|
|
|
+ $msg_param['type'] = 2;
|
|
|
|
+ $msg_param['id'] = $id;
|
|
|
|
+ $msg_param = Dever::json_encode($msg_param);
|
|
|
|
+ $msg = '您的'.Dever::load('cash/lib/set')->statDate($data['type'], $data['day']).'对账单已经生成,请您及时确认,确认之后方可结算';
|
|
|
|
+ Dever::load('message/lib/data')->push(-1, $info['id'], '对账通知', $msg, 6, $msg_type, false, $msg_param);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|