|
|
@@ -49,9 +49,9 @@ class OwnerAreaReportService
|
|
|
*
|
|
|
* @param array $params
|
|
|
* @param array $values
|
|
|
- * @return bool
|
|
|
+ * @return bool|string
|
|
|
*/
|
|
|
- public function update(array $params, array $values):bool
|
|
|
+ public function update(array $params, array $values)
|
|
|
{
|
|
|
DB::beginTransaction();
|
|
|
$area = $this->query(OwnerAreaReport::query(),$params)->with("ownerStoragePriceModel")->lockForUpdate()->first();
|
|
|
@@ -65,8 +65,8 @@ class OwnerAreaReportService
|
|
|
$diffAmount = app("OwnerStoragePriceModelService")->calculationAmount($area->ownerStoragePriceModel, $diff, $area->owner_id, $area->counting_month);
|
|
|
if ($diffAmount != 0){
|
|
|
$up = ["storage_fee"=>$report->storage_fee - $diffAmount];
|
|
|
- $report->initial_fee -= $report->storage_fee - $diffAmount;
|
|
|
- if ($report->confirm_fee !== null)$up["difference"] = $report->initial_fee - $report->confirm_fee;
|
|
|
+ $initial = $report->initial_fee - ($report->storage_fee - $diffAmount);
|
|
|
+ if ($report->confirm_fee !== null)$up["difference"] = $initial - $report->confirm_fee;
|
|
|
$report->update($up);
|
|
|
}
|
|
|
}
|
|
|
@@ -75,9 +75,8 @@ class OwnerAreaReportService
|
|
|
DB::commit();
|
|
|
return true;
|
|
|
}catch (\Exception $e){
|
|
|
- dd($e->getMessage());
|
|
|
DB::rollBack();
|
|
|
- return false;
|
|
|
+ return $e->getMessage();
|
|
|
}
|
|
|
}
|
|
|
|