소스 검색

Merge branch 'master' of 47.76.126.2:seven/bot-28

seven 3 주 전
부모
커밋
0f24f44944
4개의 변경된 파일28개의 추가작업 그리고 13개의 파일을 삭제
  1. 0 3
      app/Http/Controllers/admin/Rebate.php
  2. 25 9
      app/Models/Rebate.php
  3. 1 1
      app/Services/RebateService.php
  4. 2 0
      composer.json

+ 0 - 3
app/Http/Controllers/admin/Rebate.php

@@ -35,8 +35,6 @@ class Rebate extends Controller
         }
         return $this->success($result);
     }
-
-
     public function store()
     {
         DB::beginTransaction();
@@ -44,7 +42,6 @@ class Rebate extends Controller
             $params = request()->validate([
                 'id' => ['required', 'integer', 'min:1'],
             ]);
-            $params['id'];
             $params['status'] = 0;
             $rebate = RebateService::findOne($params);
             if (!$rebate) throw new Exception('数据不存在', HttpStatus::CUSTOM_ERROR);

+ 25 - 9
app/Models/Rebate.php

@@ -51,19 +51,35 @@ class Rebate extends Authenticatable
     }
 
 
-    protected function getHuishuiRestrictionAttribute($value){
-        $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
-        return $huishui_restriction;
+    protected function getHuishuiRestrictionAttribute($value)
+    {
+        if ($this->status == 0) {
+            $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
+            return $huishui_restriction;
+        }
+        return $value;
+
+    }
+
+    protected function getHuishuiPercentageAttribute($value)
+    {
+        if ($this->status == 0) {
+            $huishui_percentage = Config::where('field', 'huishui_percentage')->first()->val;
+            return $huishui_percentage;
+        }
+        return $value;
     }
 
     protected function getHuishuiAmountAttribute($value)
     {
-        $value = 0;
-        $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
-        $huishui_percentage = Config::where('field', 'huishui_percentage')->first()->val;
-        $lose = $this->profit * -1;
-        if ($lose >= $huishui_restriction) {
-            $value = bcmul($lose, $huishui_percentage, 2); // 返利金额
+        if ($this->status == 0) {
+            $value = 0;
+            $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
+            $huishui_percentage = Config::where('field', 'huishui_percentage')->first()->val;
+            $lose = $this->profit * -1;
+            if ($lose >= $huishui_restriction) {
+                $value = bcmul($lose, $huishui_percentage, 2); // 返利金额
+            }
         }
         return $value;
     }

+ 1 - 1
app/Services/RebateService.php

@@ -96,7 +96,7 @@ class RebateService extends BaseService
         $date = Carbon::now('America/New_York')->format('Y-m-d');
 
         $paginator = self::model()::where(self::getWhere($search))
-//            ->where('date', '<', $date)
+            ->where('date', '<', $date)
             ->orderByDesc('date')
             ->orderBy('status')
             ->orderByDesc('betting_amount')

+ 2 - 0
composer.json

@@ -14,6 +14,7 @@
     "ext-curl": "*",
     "ext-gd": "*",
     "ext-json": "*",
+    "ext-bcmath": "*",
     "endroid/qr-code": "^5.0",
     "firebase/php-jwt": "^6.10",
     "guzzlehttp/guzzle": "^7.2",
@@ -29,6 +30,7 @@
     "simplesoftwareio/simple-qrcode": "^4.2",
     "simplito/elliptic-php": "^1.0",
     "stephenhill/base58": "^1.1"
+
   },
   "require-dev": {
     "fakerphp/faker": "^1.9.1",