Browse Source

结报统计接口优化

master
wanghongjun 11 months ago
parent
commit
d6d542bd58
  1. 2
      app/controller/admin/Index.php
  2. 8
      app/model/FinalReportDate.php

2
app/controller/admin/Index.php

@ -104,7 +104,7 @@ class Index extends Base {
$dateArr[] = $nowDate;
foreach ($dateArr as $key => $monthDate) {
$amountArr[$key] = (new FinalReportDate())->getSumAmount($monthDate);
$amountArr[$key] = (new FinalReportDate())->getSumAmount($monthDate, 2);
}
return $this->buildSuccess([

8
app/model/FinalReportDate.php

@ -7,11 +7,15 @@ use think\Model;
class FinalReportDate extends Model
{
public function getSumAmount($date)
public function getSumAmount($date, $type = 1)
{
$result = $this->where(['report_date' => $date])->field('id')->find();
if (!$result) return 0;
$ydzse_sum = FinalReportData::getFrdSumAmount($result['id']);
return $ydzse_sum ? number_format($ydzse_sum, 2, '.', ',') : 0;
if ($type == 1) {
return $ydzse_sum ? number_format($ydzse_sum, 2, '.', ',') : 0;
} else {
return $ydzse_sum ?: 0;
}
}
}

Loading…
Cancel
Save