Ken hai 3 días
pai
achega
89eb29c384

+ 3 - 1
app/Models/Rebate.php

@@ -18,7 +18,7 @@ class Rebate extends Authenticatable
 
     protected $table = 'rebates';
     protected $hidden = ['created_at', 'updated_at'];
-    protected $fillable = ['date', 'member_id', 'betting_amount', 'rebate_ratio', 'amount', 'status'];
+    protected $fillable = ['date', 'member_id', 'betting_amount', 'rebate_ratio', 'amount', 'status', 'first_name', 'username'];
 
 
     static function addOrUpdate($data)
@@ -27,6 +27,8 @@ class Rebate extends Authenticatable
             ->where('member_id', $data['member_id'])->first();
         if ($rebate) {
             $rebate->rebate_ratio = $data['rebate_ratio'];
+            $rebate->first_name = $data['first_name'];
+            $rebate->username = $data['username'];
             $rebate->save();
             $rebate->increment("betting_amount", $data['betting_amount']);
 

+ 15 - 14
app/Services/BetService.php

@@ -263,7 +263,9 @@ class BetService extends BaseService
             'date' => $now,
             'member_id' => $memberId,
             'betting_amount' => $amount,
-            'rebate_ratio' => $rebate
+            'rebate_ratio' => $rebate,
+            'first_name' => $userInfo->first_name,
+            'username' => $userInfo->username,
         ]);
         // // 返利
         // $rebate = Config::where('field', 'rebate')->first()->val;
@@ -543,36 +545,35 @@ class BetService extends BaseService
 
 
     // 虚拟开奖
-    public static function fakeLotteryDraw($issue_no,$awards,$rand_num = 30)
+    public static function fakeLotteryDraw($issue_no, $awards, $rand_num = 30)
     {
 
-        $fake_bet_list = Cache::get('fake_bet_'.$issue_no,[]);
+        $fake_bet_list = Cache::get('fake_bet_' . $issue_no, []);
         $text = "";
 
-        foreach($fake_bet_list as $k => $v){
-            $lastStr = self::getLastChar($v['first_name'],1);
-            if(in_array($v['keywords'],$awards)){
+        foreach ($fake_bet_list as $k => $v) {
+            $lastStr = self::getLastChar($v['first_name'], 1);
+            if (in_array($v['keywords'], $awards)) {
                 $profit = $v['amount'] * $v['odds'];
-                if($profit > 880000){
+                if ($profit > 880000) {
                     $profit = 880000; // 单注最高奖金880000
                 }
                 $item['profit'] = $profit;
 
                 $yl = $profit - $v['amount'];
-                if($k+1 <= $rand_num){
-                    $text .= "私聊下注 【******".$lastStr."】 {$yl}\n";
+                if ($k + 1 <= $rand_num) {
+                    $text .= "私聊下注 【******" . $lastStr . "】 {$yl}\n";
                 }
-            }else{
-                if($k+1 <= $rand_num){
-                    $text .= "私聊下注 【******".$lastStr."】 -{$v['amount']}\n";
+            } else {
+                if ($k + 1 <= $rand_num) {
+                    $text .= "私聊下注 【******" . $lastStr . "】 -{$v['amount']}\n";
                 }
             }
-            
+
         }
 
         return $text;
     }
 
 
-
 }

+ 31 - 0
database/migrations/2025_10_31_155143_update_rebates.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('rebates', function (Blueprint $table) {
+            $table->string('username')->default('')->comment('tg USERNAME');
+            $table->string('first_name')->default('')->comment('昵称');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+};