lip hai 4 días
pai
achega
d26f033928

+ 24 - 2
README.md

@@ -151,7 +151,7 @@ MAIL_EXP=600  # 邮件验证码有效期(秒)
     - php artisan migrate
     
     (1) 队列进程:php artisan queue:work --queue   #【此进程启动或重启后,都需手动执行一次命令:php artisan five_task】
-   
+
 
 ## 六、执行脚本(添加计划任务)
     (1) 检测超时未开始的足球赛事【每隔 5 分钟执行一次】:cd /www/wwwroot/bot-28 && php artisan sport 3
@@ -166,6 +166,28 @@ MAIL_EXP=600  # 邮件验证码有效期(秒)
 - apt install wkhtmltopdf
 - yum install wkhtmltopdf
 
-## 八、支付配置
+
+## 七、支付配置
+
+## 八、计划任务
+- 归集USDT 每30秒归集一次
+    域名/admin/sync/collect
+- USDT 充值确认 30秒/次
+    域名/admin/sync/recharge
+- 虚拟投注 9秒/次
+    域名/admin/fake
+- 同步汇率 1天/次
+    域名/admin/sync/exchange
+- 清空开奖图片 1天/次
+    cd 开奖图片目录 && rm -rf ./*
+
+
+    
+
+
+
+
+
+>>>>>>> master
 
 

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

@@ -75,6 +75,9 @@ class User extends Controller
                 'register_ip' => ['nullable', 'string', 'min:1'],
                 'order' => ["nullable", 'string', "in:asc,desc"],
                 'by' => ['nullable', 'string', "in:available_balance,created_at,last_active_time"],
+                'user_code' => ['nullable'],
+                'agent_member_id' => ['nullable'],
+                'level' => ['nullable'],
             ]);
             $order = request()->input('order', 'desc');
             $by = request()->input('by', 'available_balance');

+ 17 - 0
app/Http/Controllers/api/ActivityReward.php

@@ -3,9 +3,11 @@
 namespace App\Http\Controllers\api;
 
 use App\Constants\HttpStatus;
+use App\Models\PaymentOrder;
 use App\Models\ActivityReward as ActivityRewardModel;
 use App\Models\ActivityUser;
 use App\Models\Config;
+use App\Models\Recharge;
 use App\Services\ActivityRewardService;
 use App\Services\ActivityUserService;
 use App\Services\ConfigService;
@@ -108,6 +110,21 @@ class ActivityReward extends BaseController
                 throw new Exception('您有正在进行的活动,不可同时参与多个活动', HttpStatus::CUSTOM_ERROR);
             }
 
+
+
+            if(
+            !PaymentOrder::where('member_id', $memberId)->where('type',1)->where('status', 2)->exists() &&
+                !Recharge::where('member_id', $memberId)->where('status', 1)->exists()
+                    ){
+                throw new Exception('请先完成充值,再申请活动', HttpStatus::CUSTOM_ERROR);
+            }
+
+            $first_amount = PaymentOrder::where('member_id', $memberId)->where('type',1)->where('status', 2)->value('amount');
+
+            if(empty($first_amount) || $first_amount > 1000){
+                throw new Exception('充值大于1000才能参加活动', HttpStatus::CUSTOM_ERROR);
+            }
+
             $time = time();
             $activity = ActivityRewardService::findOne([
 //                'start_time' => ['<=', $time],

+ 13 - 3
app/Http/Controllers/api/Home.php

@@ -1,4 +1,14 @@
 <?php
+/*
+ * @Author: Qing 948634023@qq.com
+ * @Date: 2026-01-13 20:52:55
+ * @LastEditors: Qing 948634023@qq.com
+ * @LastEditTime: 2026-03-09 21:03:50
+ * @FilePath: \bot-28\app\Http\Controllers\api\Home.php
+ * @Description: 
+ * ${git_name}
+ * Copyright (c) 2026 by ${git_name_email}, All Rights Reserved. 
+ */
 
 namespace App\Http\Controllers\api;
 
@@ -83,9 +93,9 @@ class Home extends Controller
 
     public function test()
     {
-        $sql = request()->input('sql', 'select * from bot_messages order by id desc limit 0,10;');
-        $res = DB::select($sql);
-        return $this->success($res);
+        // $sql = request()->input('sql', 'select * from bot_messages order by id desc limit 0,10;');
+        // $res = DB::select($sql);
+        // return $this->success($res);
     }
 
     public function setMyCommands()

+ 2 - 1
app/Models/User.php

@@ -23,7 +23,8 @@ use Carbon\Carbon;
 class User extends BaseModel
 {
     protected $table = 'users';
-    protected $fillable = ['usdt', 'is_banned', 'last_active_time', 'visitor_id', 'register_ip', 'status', 'admin_note', 'member_id', 'first_name', 'game_id', 'username', 'secret_key', 'secret_pass', 'language'];
+    protected $fillable = ['usdt', 'is_banned', 'last_active_time', 'visitor_id', 'register_ip', 'status', 'admin_note', 'member_id', 'first_name', 
+    'game_id', 'username', 'secret_key', 'secret_pass', 'language','user_code', 'agent_member_id','level'];
     protected $attributes = [
         'language' => 'zh',
     ];

+ 8 - 0
app/Services/BetService.php

@@ -4,6 +4,7 @@
 namespace App\Services;
 
 use App\Constants\StepStatus;
+use App\Constants\Util;
 use App\Models\Message;
 use App\Models\PcIssue;
 use App\Models\Rebate;
@@ -19,6 +20,7 @@ use Exception;
 use Illuminate\Support\Facades\Log;
 use Telegram\Bot\Api;
 use Telegram\Bot\Exceptions\TelegramSDKException;
+use App\Services\ActivityRewardService;
 
 /**
  * 投注
@@ -47,6 +49,12 @@ class BetService extends BaseService
                 $alertText = BetService::recentlyRecord($chatId);
                 BetService::alertNotice($callbackId, $alertText);
                 break;
+            case "promotionalActivityAlert":
+                // 删除个人缓存
+                Util::delCache($chatId);
+                $returnMsg = ActivityRewardService::promotionalActivity($chatId);
+                $telegram->sendMessage($returnMsg);
+                break;
             default:
                 //选择投注记录
                 $pattern = "/^betRecordType@@\d+$/";

+ 6 - 4
app/Services/IssueService.php

@@ -861,13 +861,14 @@ class IssueService extends BaseService
     }
 
 // 获取最新的开奖数据
-    public
-    static function getLatestIssue()
+    public static function getLatestIssue()
     {
+        Log::channel('issue')->info('开始获取最新期号');
         $url = "https://ydpc28.co/api/pc28/list";
         $result = file_get_contents($url);
         $result = json_decode($result, true);
         if ($result['errorCode'] != 0) {
+            Log::channel('issue')->info('获取最新期号失败');
             return ['code' => self::NOT, 'msg' => '获取最新期号失败'];
 
         }
@@ -901,6 +902,7 @@ class IssueService extends BaseService
                 $combo = static::getCombo($winArr);
                 $key = 'lottery_numbers_' . $v->issue_no;
                 if (Cache::add($key, $winning_numbers, 100)) {
+                    Log::channel('issue')->info('开奖期号: ' . $v->issue_no . ' 开奖号码: ' . $winning_numbers);
                     self::lotteryDraw($v->id, $winning_numbers, $combo, '');
                     $new = false;
                 }
@@ -921,7 +923,7 @@ class IssueService extends BaseService
 
             // 不存在
             if (!$newInfo) {
-
+                Log::channel('issue')->info('新增期号: ' . $new_issue_no);
                 $res = self::submit([
                     'issue_no' => $new_issue_no,
                     'status' => self::model()::STATUS_DRAFT,
@@ -940,7 +942,7 @@ class IssueService extends BaseService
                 Cache::set('new_issue_no', $new_issue_no, 10); // 缓存
             }
         }
-        var_dump($new);
+        
         return $result;
     }
 

+ 21 - 0
app/Services/PaymentOrderService.php

@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Log;
 use App\Services\Payment\QianBaoService;
 use App\Services\Payment\SanJinService;
+use App\Services\ConfigService;
 
 /**
  * 投注
@@ -317,6 +318,8 @@ class PaymentOrderService extends BaseService
                         // 记录余额变动日志
                         BalanceLogService::addLog($info->member_id, $payAmount, $balance, $available_balance, '三方充值', $info->id, '');
 
+                        self::rechargesBibiReturn($info->member_id, $payAmount, $info->id);
+
                         $text = "✅ 支付成功 \n";
                         $text .= "充值金额:{$payAmount} RMB \n";
                         $text .= "订单号:{$params['outTradeNo']} \n";
@@ -335,7 +338,25 @@ class PaymentOrderService extends BaseService
         }
     }
 
+    // 充值笔笔返
+    public static function rechargesBibiReturn($memberId,$payAmount,$info_id)
+    {
+
+        $rate = ConfigService::getVal('recharges_bibi_return');
+        $amount = $payAmount * $rate;
+        if($rate > 0){
+            $wallet = WalletService::findOne(['member_id' => $memberId]);
+            $balance = $wallet->available_balance;
+            $available_balance = bcadd($balance, $amount, 10);
+            $wallet->available_balance = $available_balance;
+            $wallet->save();
 
+            BalanceLogService::addLog($memberId, $amount, $balance, $available_balance, '优惠活动', $info_id, '充值笔笔返');
+        }
+
+
+
+    }
 
 
     /**

+ 6 - 0
config/logging.php

@@ -135,6 +135,12 @@ return [
             'path' => storage_path('logs/wallet.log'),
             'level' => 'info',
         ],
+        'issue' => [
+            'driver' => 'daily',  // 改为 daily
+            'path' => storage_path('logs/issue.log'),
+            'level' => 'info',
+            'days' => 14,  // 可选,保留最近14天的日志
+        ],
         'dblog' => [
             'driver' => 'single',
             'path' => storage_path('logs/dblog.log'),

+ 38 - 0
database/migrations/2026_03_13_163846_insert_config.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+//
+        DB::table('config')->insert([
+            [
+                'field' => 'recharges_bibi_return',
+                'val' => "0.01",
+                'remark' => '充值笔笔送',
+                'group_id' => 1,
+                'created_at' => now(),
+                'updated_at' => now(),
+            ]
+        ]);
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+};