Jelajahi Sumber

Merge branch 'zzd' of ssh://was.baoshi56.com:10022/var/git/bswas

LD 5 tahun lalu
induk
melakukan
7267fb2133

+ 3 - 2
app/Http/Controllers/CustomerController.php

@@ -246,8 +246,9 @@ class CustomerController extends Controller
             "area_on_flat" => request("areaOnFlat"),
             "accounting_area" => intval($total*1000)/1000,
         ];
-        app('OwnerAreaReportService')->update(["id"=>request("id")],$obj);
-        $this->success($obj);
+        $re = app('OwnerAreaReportService')->update(["id"=>request("id")],$obj);
+        if ($re===true)$this->success($obj);
+        else $this->error($re);
     }
 
     //面积报表审核

+ 5 - 6
app/Services/OwnerAreaReportService.php

@@ -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();
         }
     }