Ken преди 2 седмици
родител
ревизия
a04c2c17f7
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      app/Http/Controllers/admin/Bet.php

+ 6 - 0
app/Http/Controllers/admin/Bet.php

@@ -29,6 +29,12 @@ class Bet extends Controller
                 'is_winner' => ['nullable', 'integer', 'in:0,1'],
             ]);
             $result = BetService::paginate($params);
+            foreach ($result['data'] as &$item) {
+                $item['is_winner'] = null;
+                if ($item['status'] == 2) {
+                    $item['is_winner'] = $item['profit'] > 0;
+                }
+            }
         } catch (ValidationException $e) {
             return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
         } catch (Exception $e) {