Ken 4 dias atrás
pai
commit
f6e3c0889f
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      app/Services/BackflowService.php

+ 3 - 2
app/Services/BackflowService.php

@@ -27,9 +27,10 @@ class BackflowService extends BaseService
      */
     public static function grant($id): bool
     {
-        $params = ['id' => $id, 'status' => 0];
+        $params = ['id' => $id];
         $backflow = static::findOne($params);
         if (!$backflow) throw new Exception('数据不存在', HttpStatus::CUSTOM_ERROR);
+        if ($backflow->status !== 0) throw new Exception("已回水,无需再次回水", HttpStatus::CUSTOM_ERROR);
         $date = Carbon::now('Asia/Shanghai')->format('Y-m');
         if (strtotime($backflow->date) >= strtotime($date)) {
             throw new Exception('未到发放时间', HttpStatus::CUSTOM_ERROR);
@@ -124,7 +125,7 @@ class BackflowService extends BaseService
 
         $date = Carbon::now('Asia/Shanghai')->format('Y-m');
         $query = static::$MODEL::where(static::getWhere($search));
-//        $query->where('date', '<', $date);
+        $query->where('date', '<', $date);
         if (isset($search['username']) && !empty($search['username'])) {
             $username = $search['username'];
             $query = $query->whereHas('user', function ($query1) use ($username) {