|
|
@@ -17,22 +17,19 @@ class MoneyLog extends Base
|
|
|
//记账记录
|
|
|
public function moneylog(MonuyModel $monuyModel)
|
|
|
{
|
|
|
- $time = $this->request->post('time/s', date('Y-m'));
|
|
|
- $result['count'] = $monuyModel::getCountMonthBalance($time);
|
|
|
- $result['list'] = $monuyModel
|
|
|
- ->with('users')
|
|
|
- ->where('status', MonuyModel::STATUS_NORMAL)
|
|
|
- ->whereMonth('create_date', $time)
|
|
|
- ->order('create_date desc,id desc')
|
|
|
- ->paginate(10);
|
|
|
- $this->success('ok', $result);
|
|
|
+ $time = $this->request->post('time/s', '');
|
|
|
+ $count = $monuyModel::getCountMonthBalance($time);
|
|
|
+ $list = $monuyModel->with('users')->where('status', MonuyModel::STATUS_NORMAL);
|
|
|
+ if(!empty($time)) $list = $list->whereMonth('create_date', $time);
|
|
|
+ $list = $list->order('create_date desc,id desc')->paginate(10);
|
|
|
+ $this->success('ok', compact('list', 'count'));
|
|
|
}
|
|
|
|
|
|
|
|
|
//记账统计每天
|
|
|
public function getCountDay(MonuyModel $monuyModel)
|
|
|
{
|
|
|
- $time = $this->request->post('time/s', date('Y-m'));
|
|
|
+ $time = $this->request->post('time/s', '');
|
|
|
$result = $monuyModel::getCountDayBalance($time);
|
|
|
$this->success('ok', $result);
|
|
|
}
|