lip 1 неделя назад
Родитель
Сommit
e0344e5444
4 измененных файлов с 27 добавлено и 59 удалено
  1. 0 17
      app/Models/Banner.php
  2. 13 12
      app/Models/FundsRecord.php
  3. 13 13
      app/Models/Operation.php
  4. 1 17
      app/Models/Order.php

+ 0 - 17
app/Models/Banner.php

@@ -1,24 +1,7 @@
 <?php
 namespace App\Models;
 
-
-// 关键:导入正确的 Builder 类(Eloquent 构建器)
-use Illuminate\Database\Eloquent\Builder;
-
 class Banner extends BaseModel
 {
     protected $fillable = ['title', 'image', 'link' ,'type' ,'sort' ,'cny_rate' ];
-    public function newQuery($excludeDeleted = true): Builder
-    {
-        // 1. 获取原生 Eloquent 查询构建器
-        $query = parent::newQuery($excludeDeleted);
-        
-        // 2. 强制清空当前连接的表前缀(从根源阻止拼接)
-        $this->getConnection()->setTablePrefix('');
-        
-        // 3. 强制指定查询的表名为 la_banner
-        $query->from('la_banner');
-        
-        return $query;
-    }
 }

+ 13 - 12
app/Models/FundsRecord.php

@@ -1,23 +1,24 @@
 <?php
 namespace App\Models;
 
-// 关键:导入正确的 Builder 类(Eloquent 构建器)
-use Illuminate\Database\Eloquent\Builder;
+// // 关键:导入正确的 Builder 类(Eloquent 构建器)
+// use Illuminate\Database\Eloquent\Builder;
 class FundsRecord extends BaseModel
 {
+    protected $table = 'balance_logs';
     protected $fillable = ['id', 'room_id', 'member_id' ,'amount' ,'before_balance' ,'after_balance' ,'change_type','created_at','remark'];
 
-    public function newQuery($excludeDeleted = true): Builder
-    {
-        // 1. 获取原生 Eloquent 查询构建器
-        $query = parent::newQuery($excludeDeleted);
+    // public function newQuery($excludeDeleted = true): Builder
+    // {
+    //     // 1. 获取原生 Eloquent 查询构建器
+    //     $query = parent::newQuery($excludeDeleted);
         
-        // 2. 强制清空当前连接的表前缀(从根源阻止拼接)
-        $this->getConnection()->setTablePrefix('');
+    //     // 2. 强制清空当前连接的表前缀(从根源阻止拼接)
+    //     $this->getConnection()->setTablePrefix('');
         
-        // 3. 强制指定查询的表名为 la_operation(覆盖所有拼接逻辑)
-        $query->from('bot_balance_logs');
+    //     // 3. 强制指定查询的表名为 la_operation(覆盖所有拼接逻辑)
+    //     $query->from('bot_balance_logs');
         
-        return $query;
-    }
+    //     return $query;
+    // }
 }

+ 13 - 13
app/Models/Operation.php

@@ -4,27 +4,27 @@
 namespace App\Models;
 
 
-// 关键:导入正确的 Builder 类(Eloquent 构建器)
-use Illuminate\Database\Eloquent\Builder;
+// // 关键:导入正确的 Builder 类(Eloquent 构建器)
+// use Illuminate\Database\Eloquent\Builder;
 
 class Operation extends BaseModel
 {
-    
+    protected $table = 'operation';
     protected $fillable = ['date', 'recharge', 'withdraw', 'balance_difference', 'total_price', 'user_total_money'];
     
     
-    public function newQuery($excludeDeleted = true): Builder
-    {
-        // 1. 获取原生 Eloquent 查询构建器
-        $query = parent::newQuery($excludeDeleted);
+    // public function newQuery($excludeDeleted = true): Builder
+    // {
+    //     // 1. 获取原生 Eloquent 查询构建器
+    //     $query = parent::newQuery($excludeDeleted);
         
-        // 2. 强制清空当前连接的表前缀(从根源阻止拼接)
-        $this->getConnection()->setTablePrefix('');
+    //     // 2. 强制清空当前连接的表前缀(从根源阻止拼接)
+    //     $this->getConnection()->setTablePrefix('');
         
-        // 3. 强制指定查询的表名为 la_operation(覆盖所有拼接逻辑)
-        $query->from('bot_operation');
+    //     // 3. 强制指定查询的表名为 la_operation(覆盖所有拼接逻辑)
+    //     $query->from('bot_operation');
         
-        return $query;
-    }
+    //     return $query;
+    // }
 }
 

+ 1 - 17
app/Models/Order.php

@@ -1,26 +1,10 @@
 <?php
 namespace App\Models;
 
-
-// 关键:导入正确的 Builder 类(Eloquent 构建器)
-use Illuminate\Database\Eloquent\Builder;
-
 class Order extends BaseModel
 {
+    protected $table = 'sport_order';
     protected $fillable = ['user_id', 'order_id', 'issue' ,'is_roll' ,'amount' ,'cny_rate' ,'win_amount','profit_and_loss','is_faker','is_win', 'stattus','settlement_status',
             'pay_status','pay_time','pay_type','return_status','return_apply_time','return_operation_time','failure_msg', 'create_time' ];
 
-    public function newQuery($excludeDeleted = true): Builder
-    {
-        // 1. 获取原生 Eloquent 查询构建器
-        $query = parent::newQuery($excludeDeleted);
-        
-        // 2. 强制清空当前连接的表前缀(从根源阻止拼接)
-        $this->getConnection()->setTablePrefix('');
-        
-        // 3. 强制指定查询的表名为 la_operation(覆盖所有拼接逻辑)
-        $query->from('la_sport_order');
-        
-        return $query;
-    }
 }