Procházet zdrojové kódy

清理历代升迁文件

兔姬桑 před 4 roky
rodič
revize
b89d37ef98

+ 0 - 97
app/Console/Commands/fixDailyTrafficLogError.php

@@ -1,97 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Models\NodeDailyDataFlow;
-use App\Models\UserDailyDataFlow;
-use App\Models\UserDataFlowLog;
-use Illuminate\Console\Command;
-use Log;
-
-class fixDailyTrafficLogError extends Command
-{
-    protected $signature = 'fixDailyTrafficLogError';
-    protected $description = '修复原版本的每日流量计算错误';
-
-    private $end;
-
-    public function handle(): void
-    {
-        // set value
-        $this->end = date('Y-m-d 23:59:59', strtotime('-1 days'));
-        $nodeArray = UserDataFlowLog::distinct()->pluck('node_id')->toArray();
-
-        Log::info('----------------------------【修复原版本的每日流量计算错误】开始----------------------------');
-        Log::info('----------------------------【节点流量日志修正】开始----------------------------');
-        foreach (NodeDailyDataFlow::all() as $log) {
-            NodeDailyDataFlow::whereId($log->id)->update([
-                'created_at' => date('Y-m-d H:i:s', strtotime("$log->created_at -1 days")),
-            ]);
-        }
-
-        Log::info('----------------------------【添加节点流量日志】开始----------------------------');
-        foreach ($nodeArray as $nodeId) {
-            $query = UserDataFlowLog::whereNodeId($nodeId)
-                ->whereBetween('log_time', [strtotime(date('Y-m-d', strtotime('-1 days'))), strtotime($this->end)]);
-
-            $u = $query->sum('u');
-            $d = $query->sum('d');
-            $total = $u + $d;
-
-            if ($total) { // 有数据才记录
-                $obj = new NodeDailyDataFlow();
-                $obj->node_id = $nodeId;
-                $obj->u = $u;
-                $obj->d = $d;
-                $obj->total = $total;
-                $obj->traffic = flowAutoShow($total);
-                $obj->created_at = $this->end;
-                $obj->save();
-            }
-        }
-        Log::info('----------------------------【添加节点流量日志】结束----------------------------');
-        Log::info('----------------------------【节点流量日志修正】结束----------------------------');
-        Log::info('----------------------------【用户流量日志修正】开始----------------------------');
-        foreach (UserDailyDataFlow::all() as $log) {
-            UserDailyDataFlow::whereId($log->id)->update(['created_at' => date('Y-m-d H:i:s', strtotime("$log->created_at -1 days"))]);
-        }
-        Log::info('----------------------------【用户个人流量日志修正】开始----------------------------');
-        foreach (UserDataFlowLog::distinct()->pluck('user_id')->toArray() as $userId) {
-            // 统计一次所有节点的总和
-            $this->statisticsByUser($userId);
-            // 统计每个节点产生的流量
-            foreach ($nodeArray as $nodeId) {
-                $this->statisticsByUser($userId, $nodeId);
-            }
-        }
-        Log::info('----------------------------【用户个人流量日志修正】结束----------------------------');
-        Log::info('----------------------------【用户流量日志修正】结束----------------------------');
-        Log::info('----------------------------【修复原版本的每日流量计算错误】结束----------------------------');
-    }
-
-    private function statisticsByUser($user_id, $node_id = 0): void
-    {
-        $query = UserDataFlowLog::whereUserId($user_id)
-            ->whereBetween('log_time', [strtotime(date('Y-m-d', strtotime('-1 days'))), strtotime($this->end)]);
-
-        if ($node_id) {
-            $query->whereNodeId($node_id);
-        }
-
-        $u = $query->sum('u');
-        $d = $query->sum('d');
-        $total = $u + $d;
-
-        if ($total) { // 有数据才记录
-            $obj = new UserDailyDataFlow();
-            $obj->user_id = $user_id;
-            $obj->node_id = $node_id;
-            $obj->u = $u;
-            $obj->d = $d;
-            $obj->total = $total;
-            $obj->traffic = flowAutoShow($total);
-            $obj->created_at = $this->end;
-            $obj->save();
-        }
-    }
-}

+ 0 - 34
app/Console/Commands/updateCoupon.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Models\Coupon;
-use Illuminate\Console\Command;
-use Log;
-
-class updateCoupon extends Command
-{
-    protected $signature = 'updateCoupon';
-    protected $description = '修改原版Coupon至新版';
-
-    public function handle(): void
-    {
-        Log::info('----------------------------【优惠券转换】开始----------------------------');
-        $coupons = Coupon::withTrashed()->get();
-        foreach ($coupons as $coupon) {
-            if ($coupon->amount) {
-                $coupon->value = $coupon->amount / 100;
-            } elseif ($coupon->discount) {
-                $coupon->value = $coupon->discount * 100;
-            }
-
-            if ($coupon->rule === 0) {
-                $coupon->rule = null;
-            } else {
-                $coupon->rule /= 100;
-            }
-            $coupon->save();
-        }
-        Log::info('----------------------------【优惠券转换】结束----------------------------');
-    }
-}

+ 0 - 42
app/Console/Commands/updateTextToJson.php

@@ -1,42 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Models\ReferralApply;
-use App\Models\RuleGroup;
-use App\Models\UserGroup;
-use Illuminate\Console\Command;
-use Log;
-
-class updateTextToJson extends Command
-{
-    protected $signature = 'updateTextToJson';
-    protected $description = '转换原有数列至新数列';
-
-    public function handle(): void
-    {
-        Log::info('----------------------------【数据转换】开始----------------------------');
-        foreach (ReferralApply::all() as $referralApply) {
-            $referralApply->link_logs = $this->convertToJson($referralApply->getRawOriginal('link_logs'));
-            $referralApply->save();
-        }
-        Log::info('转换返利表完成');
-        foreach (UserGroup::all() as $userGroup) {
-            $userGroup->nodes = $this->convertToJson($userGroup->getRawOriginal('nodes'));
-            $userGroup->save();
-        }
-        Log::info('转换用户分组表完成');
-        foreach (RuleGroup::all() as $ruleGroup) {
-            $ruleGroup->rules = $this->convertToJson($ruleGroup->getRawOriginal('rules'));
-            $ruleGroup->nodes = $this->convertToJson($ruleGroup->getRawOriginal('nodes'));
-            $ruleGroup->save();
-        }
-        Log::info('转换审核规则表完成');
-        Log::info('----------------------------【数据转换】结束----------------------------');
-    }
-
-    private function convertToJson($string): array
-    {
-        return explode(',', $string);
-    }
-}

+ 0 - 34
app/Console/Commands/updateTicket.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Models\TicketReply;
-use App\Models\User;
-use Illuminate\Console\Command;
-use Log;
-
-class updateTicket extends Command
-{
-    protected $signature = 'updateTicket';
-    protected $description = '更新工单';
-
-    public function handle(): void
-    {
-        Log::info('----------------------------【更新工单】开始----------------------------');
-        // 获取管理员
-        foreach (User::whereIsAdmin(1)->get() as $admin) {
-            Log::info('----------------------------【更新管理员'.$admin->id.'回复工单】开始----------------------------');
-            // 获取该管理回复过的工单, 更新工单
-            foreach (TicketReply::whereUserId($admin->id)->get() as $reply) {
-                $ret = TicketReply::whereId($reply->id)->update(['user_id' => 0, 'admin_id' => $admin->id]);
-                if ($ret) {
-                    Log::info('--- 管理员:'.$admin->email.'回复子单ID:'.$reply->id.' ---');
-                } else {
-                    Log::error('更新回复子单ID:【'.$reply->id.'】 失败!');
-                }
-            }
-            Log::info('----------------------------【更新管理员'.$admin->id.'回复工单】完成----------------------------');
-        }
-        Log::info('----------------------------【更新工单】结束----------------------------');
-    }
-}

+ 0 - 37
app/Console/Commands/updateUserLevel.php

@@ -1,37 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Models\Goods;
-use App\Models\Order;
-use App\Models\User;
-use Illuminate\Console\Command;
-use Log;
-
-class updateUserLevel extends Command
-{
-    protected $signature = 'updateUserLevel';
-    protected $description = '更新用户等级';
-
-    public function handle(): void
-    {
-        Log::info('----------------------------【用户等级升级】开始----------------------------');
-        // 预设level 0
-        User::where('level', '<>', 0)->update(['level' => 0]);
-
-        // 获取商品列表,取新等级
-        $goodsLevel = Goods::type(2)->where('level', '<>', 0)->pluck('id')->toArray();
-        // 取生效的套餐
-        $orderList = Order::active()->with('goods')->whereIn('goods_id', $goodsLevel)->get();
-        foreach ($orderList as $order) {
-            $ret = $order->user->update(['level' => $order->goods->level]);
-
-            if ($ret) {
-                Log::info('用户: '.$order->user_id.', 按照订单'.$order->id.' 等级为'.$order->goods->level);
-            } else {
-                Log::error('用户: '.$order->user_id.' 等级更新失败!');
-            }
-        }
-        Log::info('----------------------------【用户等级升级】结束----------------------------');
-    }
-}

+ 0 - 69
app/Console/Commands/updateUserName.php

@@ -1,69 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Components\QQInfo;
-use App\Models\User;
-use Illuminate\Console\Command;
-use Log;
-
-class updateUserName extends Command
-{
-    protected $signature = 'updateUserName';
-    protected $description = '升级用户昵称';
-
-    public function handle(): void
-    {
-        Log::info('----------------------------【升级用户昵称】开始----------------------------');
-
-        $userList = User::all();
-        foreach ($userList as $user) {
-            $name = process($user->id);
-            $user->update(['username' => $name]);
-
-            Log::info('---用户[ID:'.$user->id.' - '.$user->email.'] :'.$user->username.'---');
-        }
-
-        foreach ($userList as $user) {
-            if ($user->email === $user->username) {
-                $name = process($user->id);
-
-                $user->update(['username' => $name]);
-
-                Log::info('---用户[ID:'.$user->id.' - '.$user->email.'] :'.$user->username.'---');
-            }
-        }
-
-        Log::info('----------------------------【升级用户昵称】结束----------------------------');
-    }
-}
-
-function process($id)
-{
-    $user = User::find($id);
-    // 先设个默认值
-    $name = $user->email;
-    // 用户是否设置了QQ号
-    if ($user->qq) {
-        $name = QQInfo::getName3($user->qq);
-    // 检测用户注册是否为QQ邮箱
-    } elseif (stripos($user->email, '@qq') !== false) {
-        // 分离QQ邮箱后缀
-        $email = explode('@', $user->email, 2);
-        if (is_numeric($email[0])) {
-            $name = QQInfo::getName3($email[0]);
-        } elseif (str_contains($email[0], '.')) {
-            $temp = explode('.', $email[0]);
-            if (is_numeric($temp[1])) {
-                $name = QQInfo::getName3($temp[1]);
-            } else {
-                echo $user->email.PHP_EOL;
-            }
-        }
-    }
-    if ($name === false) {
-        $name = $user->email;
-    }
-
-    return $name;
-}

+ 0 - 58
app/Console/Commands/upgradeUserResetTime.php

@@ -1,58 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Models\User;
-use Illuminate\Console\Command;
-use Log;
-
-class upgradeUserResetTime extends Command
-{
-    protected $signature = 'upgradeUserResetTime';
-    protected $description = '升级用户重置日期';
-
-    public function handle(): void
-    {
-        Log::info('----------------------------【升级用户重置日期】开始----------------------------');
-
-        foreach (User::all() as $user) {
-            $reset_time = null;
-            if ($user->traffic_reset_day) {
-                $today = date('d'); // 今天 日期
-                $last_day = date('t'); //本月最后一天
-                $next_last_day = date('t', strtotime('+1 month')); //下个月最后一天
-                $resetDay = $user->traffic_reset_day; // 用户原本的重置日期
-                // 案例:31 29,重置日 大于 本月最后一天
-                if ($resetDay > $last_day) {
-                    //往后推一个月
-                    $resetDay -= $last_day;
-                    $reset_time = date('Y-m-'.$resetDay, strtotime('+1 month'));
-                //案例:20<30<31
-                } elseif ($resetDay < $last_day && $resetDay > $today) {
-                    $reset_time = date('Y-m-'.$resetDay);
-                // 本日为重置日
-                } elseif ($resetDay === $today) {
-                    $reset_time = date('Y-m-d', strtotime('+1 month'));
-                //本月已经重置过了
-                } elseif ($resetDay < $today) {
-                    //类似第一种情况,向后推一月
-                    if ($resetDay > $next_last_day) {
-                        $resetDay -= $next_last_day;
-                        $reset_time = date('Y-m-'.$resetDay, strtotime('+1 month'));
-                    } else {
-                        $reset_time = date('Y-m-'.$resetDay, strtotime('+1 month'));
-                    }
-                }
-                // 用户账号有效期大于重置日期
-                if ($reset_time > $user->expired_at) {
-                    $reset_time = null;
-                }
-                $user->update(['reset_time' => $reset_time]);
-            }
-
-            Log::info('---用户[ID:'.$user->id.' - '.$user->username.' ('.$user->email.')]的新重置日期为'.($reset_time !== null ? '【'.$reset_time.'】' : '【无】').'---');
-        }
-
-        Log::info('----------------------------【升级用户重置日期】结束----------------------------');
-    }
-}

+ 0 - 12
app/Console/Kernel.php

@@ -11,14 +11,8 @@ use App\Console\Commands\AutoStatisticsNodeHourlyTraffic;
 use App\Console\Commands\AutoStatisticsUserDailyTraffic;
 use App\Console\Commands\AutoStatisticsUserHourlyTraffic;
 use App\Console\Commands\DailyJob;
-use App\Console\Commands\fixDailyTrafficLogError;
 use App\Console\Commands\NodeBlockedDetection;
 use App\Console\Commands\ServiceTimer;
-use App\Console\Commands\updateTextToJson;
-use App\Console\Commands\updateTicket;
-use App\Console\Commands\updateUserLevel;
-use App\Console\Commands\updateUserName;
-use App\Console\Commands\upgradeUserResetTime;
 use App\Console\Commands\UserExpireAutoWarning;
 use App\Console\Commands\UserTrafficAbnormalAutoWarning;
 use App\Console\Commands\UserTrafficAutoWarning;
@@ -42,14 +36,8 @@ class Kernel extends ConsoleKernel
         AutoStatisticsUserDailyTraffic::class,
         AutoStatisticsUserHourlyTraffic::class,
         DailyJob::class,
-        fixDailyTrafficLogError::class,
         NodeBlockedDetection::class,
         ServiceTimer::class,
-        updateTextToJson::class,
-        updateTicket::class,
-        updateUserLevel::class,
-        updateUserName::class,
-        upgradeUserResetTime::class,
         UserExpireAutoWarning::class,
         UserTrafficAbnormalAutoWarning::class,
         UserTrafficAutoWarning::class,

+ 1 - 0
public/assets/custom/qart.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"qart.js","sources":["webpack://qart/webpack/universalModuleDefinition"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"qart\"] = factory();\n\telse\n\t\troot[\"qart\"] = factory();\n})(window, function() {\nreturn "],"mappings":"AAAA","sourceRoot":""}