wesmiler 1 vuosi sitten
vanhempi
commit
6a4b301039
100 muutettua tiedostoa jossa 13718 lisäystä ja 2 poistoa
  1. 68 0
      .env
  2. 2 2
      README.md
  3. 560 0
      app/Console/Commands/SwooleTask.php
  4. 327 0
      app/Console/Commands/WalletTask.php
  5. 41 0
      app/Console/Kernel.php
  6. 37 0
      app/Exceptions/Handler.php
  7. 238 0
      app/Exports/Export.php
  8. 204 0
      app/Helpers/Jwt.php
  9. 2380 0
      app/Helpers/common.php
  10. 22 0
      app/Helpers/constants.php
  11. 11 0
      app/Helpers/function.php
  12. 83 0
      app/Http/Controllers/Admin/AccountLogController.php
  13. 36 0
      app/Http/Controllers/Admin/ActionLogController.php
  14. 39 0
      app/Http/Controllers/Admin/AdController.php
  15. 50 0
      app/Http/Controllers/Admin/AdSortController.php
  16. 57 0
      app/Http/Controllers/Admin/ArticleController.php
  17. 168 0
      app/Http/Controllers/Admin/Backend.php
  18. 63 0
      app/Http/Controllers/Admin/BalanceLogController.php
  19. 36 0
      app/Http/Controllers/Admin/CityController.php
  20. 36 0
      app/Http/Controllers/Admin/ConfigController.php
  21. 36 0
      app/Http/Controllers/Admin/ConfigGroupController.php
  22. 22 0
      app/Http/Controllers/Admin/Controller.php
  23. 68 0
      app/Http/Controllers/Admin/FinanceController.php
  24. 114 0
      app/Http/Controllers/Admin/IndexController.php
  25. 53 0
      app/Http/Controllers/Admin/InstitutionalController.php
  26. 37 0
      app/Http/Controllers/Admin/LayoutController.php
  27. 84 0
      app/Http/Controllers/Admin/LoginController.php
  28. 36 0
      app/Http/Controllers/Admin/LoginLogController.php
  29. 94 0
      app/Http/Controllers/Admin/MemberController.php
  30. 49 0
      app/Http/Controllers/Admin/MemberLevelController.php
  31. 36 0
      app/Http/Controllers/Admin/MenuController.php
  32. 49 0
      app/Http/Controllers/Admin/NoticeController.php
  33. 67 0
      app/Http/Controllers/Admin/PledgeOrderController.php
  34. 49 0
      app/Http/Controllers/Admin/PositionController.php
  35. 53 0
      app/Http/Controllers/Admin/PriceLogController.php
  36. 82 0
      app/Http/Controllers/Admin/RechargeController.php
  37. 72 0
      app/Http/Controllers/Admin/RoleController.php
  38. 109 0
      app/Http/Controllers/Admin/UploadController.php
  39. 48 0
      app/Http/Controllers/Admin/UserController.php
  40. 65 0
      app/Http/Controllers/Admin/WalletController.php
  41. 53 0
      app/Http/Controllers/Admin/WalletLogController.php
  42. 95 0
      app/Http/Controllers/Admin/WithdrawController.php
  43. 26 0
      app/Http/Controllers/Api/LangController.php
  44. 39 0
      app/Http/Controllers/Api/LoginController.php
  45. 22 0
      app/Http/Controllers/Api/TestController.php
  46. 81 0
      app/Http/Controllers/Api/UploadController.php
  47. 58 0
      app/Http/Controllers/Api/v1/AccountController.php
  48. 49 0
      app/Http/Controllers/Api/v1/ArticleController.php
  49. 63 0
      app/Http/Controllers/Api/v1/IndexController.php
  50. 114 0
      app/Http/Controllers/Api/v1/MemberController.php
  51. 32 0
      app/Http/Controllers/Api/v1/NotifyController.php
  52. 18 0
      app/Http/Controllers/Api/v1/PledgeOrderController.php
  53. 51 0
      app/Http/Controllers/Api/v1/TeamController.php
  54. 71 0
      app/Http/Controllers/Api/v1/TestController.php
  55. 177 0
      app/Http/Controllers/Api/webApp.php
  56. 97 0
      app/Http/Controllers/BaseController.php
  57. 69 0
      app/Http/Kernel.php
  58. 24 0
      app/Http/Middleware/ActionLog.php
  59. 36 0
      app/Http/Middleware/ApiSign.php
  60. 21 0
      app/Http/Middleware/Authenticate.php
  61. 54 0
      app/Http/Middleware/EnableCrossRequestMiddleware.php
  62. 17 0
      app/Http/Middleware/EncryptCookies.php
  63. 17 0
      app/Http/Middleware/PreventRequestsDuringMaintenance.php
  64. 32 0
      app/Http/Middleware/RedirectIfAuthenticated.php
  65. 18 0
      app/Http/Middleware/TrimStrings.php
  66. 20 0
      app/Http/Middleware/TrustHosts.php
  67. 23 0
      app/Http/Middleware/TrustProxies.php
  68. 49 0
      app/Http/Middleware/UserLogin.php
  69. 17 0
      app/Http/Middleware/VerifyCsrfToken.php
  70. 75 0
      app/Http/Middleware/WebLogin.php
  71. 50 0
      app/Http/Validator/AccountValidator.php
  72. 56 0
      app/Http/Validator/BaseValidator.php
  73. 47 0
      app/Http/Validator/MemberValidator.php
  74. 2 0
      app/Lib/phpqrcode/.gitignore
  75. 38 0
      app/Lib/phpqrcode/CHANGELOG
  76. 165 0
      app/Lib/phpqrcode/LICENSE
  77. 3719 0
      app/Lib/phpqrcode/QRcode.php
  78. 61 0
      app/Lib/phpqrcode/README
  79. 2 0
      app/Lib/phpqrcode/VERSION
  80. 58 0
      app/Models/AccountLogModel.php
  81. 145 0
      app/Models/ActionLogModel.php
  82. 45 0
      app/Models/AdModel.php
  83. 40 0
      app/Models/AdSortModel.php
  84. 25 0
      app/Models/ArticleCateModel.php
  85. 32 0
      app/Models/ArticleModel.php
  86. 60 0
      app/Models/BalanceLogModel.php
  87. 1254 0
      app/Models/BaseModel.php
  88. 286 0
      app/Models/CacheModel.php
  89. 25 0
      app/Models/CityModel.php
  90. 25 0
      app/Models/ConfigGroupModel.php
  91. 41 0
      app/Models/ConfigModel.php
  92. 24 0
      app/Models/DeveloperModel.php
  93. 49 0
      app/Models/FinanceModel.php
  94. 25 0
      app/Models/InstitutionalModel.php
  95. 72 0
      app/Models/ItemCateModel.php
  96. 45 0
      app/Models/ItemModel.php
  97. 49 0
      app/Models/LayoutDescModel.php
  98. 54 0
      app/Models/LayoutModel.php
  99. 25 0
      app/Models/LevelModel.php
  100. 0 0
      app/Models/MemberLevelModel.php

+ 68 - 0
.env

@@ -0,0 +1,68 @@
+APP_NAME=Laravel
+APP_ENV=local
+LOCAL_LANG=zh-cn
+APP_KEY=base64:5c43a8wcR8LOQtT3fxxtJ/Y4Hf4y4KdLsGF5Gi6v7SY=
+API_KEY=SBTDAPPE4CE092C8
+APP_DEBUG=true
+API_RATE_LIMIT=120
+APP_URL=https://sbt-api.mp.dongerkj.com/
+WEB_URL=https://sbt-dapp.mp.dongerkj.com/
+LOG_CHANNEL=stack
+
+DB_CONNECTION=mysql
+#DB_HOST=127.0.0.1
+DB_HOST=47.112.222.163
+DB_PORT=63306
+DB_PREFIX=lev_
+DB_DATABASE=nn2024071001
+DB_USERNAME=NN2024071001
+DB_PASSWORD=FDs2nyikpWM3M67N
+
+
+FILESYSTEM_DRIVER=public # 文件系统
+
+BROADCAST_DRIVER=log
+QUEUE_DRIVER=redis
+QUEUE_CONNECTION=redis
+SESSION_DRIVER=file
+SESSION_LIFETIME=120
+
+#REDIS_PREFIX=null
+#REDIS_HOST=127.0.0.1
+#REDIS_PASSWORD=null
+#REDIS_PORT=6379
+#REDIS_DB=1
+
+CACHE_DRIVER=redis
+REDIS_PREFIX=null
+#REDIS_HOST=127.0.0.1
+REDIS_HOST=47.112.222.163
+REDIS_PASSWORD=derkj&6688
+REDIS_PORT=16379
+REDIS_DB=1
+
+#socket
+SOCKET_PORT=6520
+
+
+MAIL_DRIVER=smtp
+MAIL_HOST=smtp.163.com
+MAIL_PORT=25
+MAIL_USERNAME=
+MAIL_FROM_ADDRESS=
+MAIL_PASSWORD=
+MAIL_ENCRYPTION=tls
+
+PUSHER_APP_ID=
+PUSHER_APP_KEY=
+PUSHER_APP_SECRET=
+PUSHER_APP_CLUSTER=mt1
+
+MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
+MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
+
+SITE_NAME = UTC
+NICK_NAME = UTC
+VERSION = v1.2.0
+
+IMG_URL = https://sbt-api.mp.dongerkj.com/uploads

+ 2 - 2
README.md

@@ -1,3 +1,3 @@
-# ZY2025010601
+# NN2024071001
 
-自营机器人
+SBT

+ 560 - 0
app/Console/Commands/SwooleTask.php

@@ -0,0 +1,560 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Services\Api\FinanceService;
+use App\Services\Api\MemberService;
+use App\Services\Api\PledgeOrderService;
+use App\Services\Api\PriceLogService;
+use App\Services\RedisService;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\DB;
+
+class SwooleTask extends Command
+{
+
+    protected $serv;
+    protected $host = '127.0.0.1';
+    protected $port = 6630;
+    // 进程名称
+    protected $taskName = 'swooleTask';
+    // PID路径
+    protected $pidPath = '/storage/swoole.pid';
+    // task
+    protected $onlyReloadTaskWorker = false;
+    // 设置运行时参数
+    protected $options = [
+        'worker_num' => 8, //worker进程数,一般设置为CPU数的1-4倍
+        'daemonize' => true, //启用守护进程
+        'log_file' => '/storage/logs/swoole-task.log', //指定swoole错误日志文件
+        'log_level' => 0, //日志级别 范围是0-5,0-DEBUG,1-TRACE,2-INFO,3-NOTICE,4-WARNING,5-ERROR
+        'dispatch_mode' => 1, //数据包分发策略,1-轮询模式
+        'task_worker_num' => 6, //task进程的数量
+        'task_ipc_mode' => 3, //使用消息队列通信,并设置为争抢模式
+    ];
+
+
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'swoole:task {op}';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Swoole task server description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * 入口
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        ini_set("default_socket_timeout", -1);
+        // 项目根目录
+        defined('ROOT_PATH') or define('ROOT_PATH', base_path());
+
+        // 文件上传目录
+        defined('ATTACHMENT_PATH') or define('ATTACHMENT_PATH', base_path('public/uploads'));
+
+        // 图片上传目录
+        defined('IMG_PATH') or define('IMG_PATH', base_path('public/uploads/images'));
+
+        // 临时存放目录
+        defined('UPLOAD_TEMP_PATH') or define('UPLOAD_TEMP_PATH', ATTACHMENT_PATH . "/temp");
+
+        // 定义普通图片域名
+        defined('IMG_URL') or define('IMG_URL', env('IMG_URL'));
+
+        // 数据表前缀
+        defined('DB_PREFIX') or define('DB_PREFIX', DB::connection()->getTablePrefix());
+
+        $this->options['log_file'] = base_path() . $this->options['log_file'];
+        $this->pidPath = base_path() . $this->pidPath;
+        $op = $this->argument('op');
+        switch ($op) {
+            case 'status': // 状态
+                $res = $this->status();
+                echo $res ? $res : 0;
+                break;
+            case 'start': // 运行
+                return $this->start();
+                break;
+            case 'reload': // 平滑重启
+                return $this->reload();
+                break;
+            case 'stop': // 停止运行
+                return $this->stop();
+                break;
+            default:
+                exit("{$op} command does not exist");
+                break;
+        }
+    }
+
+    /**
+     * 启动
+     */
+    public function start()
+    {
+        date_default_timezone_set('PRC');
+        // 构建Server对象,监听对应地址
+        $this->serv = new \Swoole\Server($this->host, $this->port);
+        $this->serv->set($this->options);
+
+        // 注册事件
+        $this->serv->on('start', [$this, 'onStart']);
+        $this->serv->on('receive', [$this, 'onReceive']);
+        $this->serv->on('task', [$this, 'onTask']);
+        $this->serv->on('finish', [$this, 'onFinish']);
+
+        // Run worker
+        echo "swoole start...\n";
+        $this->serv->start();
+
+    }
+
+    // 安全重启
+    public function reload()
+    {
+
+        $pids = file_exists($this->pidPath) ? file_get_contents($this->pidPath) : '';
+        $pids = $pids ? explode("\n", $pids) : [];
+        $masterPid = isset($pids[0]) ? $pids[0] : '';
+        $managePid = isset($pids[1]) ? $pids[1] : '';
+        if (empty($masterPid)) {
+            return false;
+        }
+
+        if (!$this->status($masterPid)) {
+            return false;
+        }
+
+        \Swoole\Process::kill($managePid, SIGUSR1);
+
+        echo "swoole reload...\n";
+    }
+
+    /**
+     * 停止
+     * @param bool $smooth
+     * @return bool
+     */
+    public function stop($smooth = false)
+    {
+        $pids = file_exists($this->pidPath) ? file_get_contents($this->pidPath) : '';
+        $pids = $pids ? explode("\n", $pids) : [];
+        $masterPid = isset($pids[0]) ? $pids[0] : '';
+        $managePid = isset($pids[1]) ? $pids[1] : '';
+        if (empty($masterPid)) {
+            return false;
+        }
+
+        if (!$this->status($masterPid)) {
+            return false;
+        }
+
+        // 直接杀
+        $stoSh = base_path() . '/crontab/swooleTaskStop.sh';
+        if (file_exists($stoSh) && function_exists('exec')) {
+            exec("{$stoSh}");
+        }
+
+        @unlink($this->pidPath);
+        echo "swoole stop...\n";
+    }
+
+    /**
+     * 状态
+     * @return mixed
+     */
+    public function status($masterPid = 0)
+    {
+        $res = false;
+        if (empty($masterPid) && file_exists($this->pidPath)) {
+            $pids = file_get_contents($this->pidPath);
+            $pids = $pids ? explode("\n", $pids) : [];
+            $masterPid = isset($pids[0]) ? $pids[0] : '';
+        }
+
+        if ($masterPid) {
+            $res = \Swoole\Process::kill($masterPid, 0);
+        }
+        return $res;
+    }
+
+    public function onStart($serv)
+    {
+        if (!is_dir(dirname($this->pidPath))) {
+            @mkdir(dirname($this->pidPath), true, 755);
+        }
+
+        //记录进程id,脚本实现自动重启
+        $pid = "{$serv->master_pid}\n{$serv->manager_pid}";
+        file_put_contents($this->pidPath, $pid);
+
+        // 定时任务
+        $time = 0;
+        $date = date('Y-m-d H:i:s');
+        if (file_exists($this->options['log_file'])) {
+            $time = 0;
+            file_put_contents($this->options['log_file'], "Task {$date}:清空日志\n");
+        }
+
+        // TODO 更新SBT每日价格
+        \swoole_timer_tick(180000, function ($timer) use ($serv, &$time) { // 启用定时器,每3分钟执行一次
+            $date = date('Y-m-d H:i:s');
+            if ($time > 3600 && file_exists($this->options['log_file'])) {
+                $time = 0;
+                file_put_contents($this->options['log_file'], "Task {$date}:清空日志\n");
+            }
+            $time++;
+            if (!RedisService::get('caches:task:lock:sbt_loaded')) {
+                $taskData = [
+                    'taskName' => 'UpdateSbtPrice',
+                    'name' => "更新SBT每日价格",
+                    'date' => date('Y-m-d'),
+                ];
+                $res = $serv->task($taskData);
+                RedisService::set('caches:task:lock:sbt_loaded', true, rand(3, 5));
+                echo "[Task UpdateSbtPrice {$date}] 更新SBT每日价格:{$res}\n";
+            } else {
+                echo "[Task UpdateSbtPrice {$date}] 间隔时间调用\n";
+            }
+
+        });
+
+        // TODO 自动质押监控
+        \swoole_timer_tick(60000, function ($timer) use ($serv, &$time) { // 启用定时器,每1分钟执行一次
+            $date = date('Y-m-d H:i:s');
+            if ($time > 7200 && file_exists($this->options['log_file'])) {
+                $time = 0;
+                file_put_contents($this->options['log_file'], "Task {$date}:清空日志\n");
+            }
+            $time++;
+            $userList = MemberService::make()->pledgeUserList();
+            if ($userList) {
+                if (!RedisService::get('caches:task:lock:pledge_loaded')) {
+                    foreach ($userList as $item) {
+                        $userId = $item['id'];
+                        if ($userId) {
+                            $taskData = [
+                                'taskName' => 'PledgeAutoTrade',
+                                'name' => "自动质押交易",
+                                'params' => $item,
+                                'date' => date('Y-m-d'),
+                            ];
+                            $res = $serv->task($taskData);
+                            echo "[Task PledgeAutoTrade {$date}] 用户[{$userId}]自动质押交易结果:{$res}\n";
+                        }
+                    }
+                    RedisService::set('caches:task:lock:pledge_loaded', true, rand(5, 10));
+                } else {
+                    echo "[Task PledgeAutoTrade {$date}] 间隔时间调用\n";
+                }
+            } else {
+                echo "[Task PledgeAutoTrade {$date}] 暂无可自动质押交易用户\n";
+            }
+
+        });
+
+        // TODO 检测质押订单退本,到期退本后(USDT余额足够)自动质押
+        \swoole_timer_tick(180000, function ($timer) use ($serv, &$time) { // 启用定时器,每3分钟执行一次
+            $date = date('Y-m-d H:i:s');
+            if ($time > 3600 && file_exists($this->options['log_file'])) {
+                $time = 0;
+                file_put_contents($this->options['log_file'], "Task {$date}:清空日志\n");
+            }
+            $time++;
+            $userList = PledgeOrderService::make()->getRefundOrderList();
+            if ($userList) {
+                if (!RedisService::get('caches:task:lock:plende_refund_loaded')) {
+                    foreach ($userList as $item) {
+                        $orderId = $item['id'];
+                        $userId = $item['user_id'];
+                        $orderNo = $item['order_no'];
+                        if ($orderId) {
+                            $taskData = [
+                                'taskName' => 'PledgeRefund',
+                                'name' => "质押订单自动退本",
+                                'params'=> $item,
+                                'date' => date('Y-m-d'),
+                            ];
+                            $res = $serv->task($taskData);
+                            echo "[Task PledgeRefund {$date}] 用户[{$userId}]质押订单[{$orderNo}]到期退本:{$res}\n";
+                        }
+                    }
+
+                    RedisService::set('caches:task:lock:pledge_settle_loaded', true, rand(3, 5));
+                }else{
+                    echo "[Task PledgeRefund {$date}] 质押订单到期退本调用间隔\n";
+                }
+            } else {
+                echo "[Task PledgeRefund {$date}] 间隔时间调用\n";
+            }
+        });
+
+        // TODO 质押订单到期结算收益,同时发放奖励(质押收益、推荐奖、管理奖、平级奖-基于管理奖)
+        \swoole_timer_tick(120000, function ($timer) use ($serv, &$time) { // 启用定时器,每120秒执行一次
+            $date = date('Y-m-d H:i:s');
+            if ($time > 3600 && file_exists($this->options['log_file'])) {
+                $time = 0;
+                file_put_contents($this->options['log_file'], "Task {$date}:清空日志\n");
+            }
+            $time++;
+            $userList = PledgeOrderService::make()->getSettleOrderList();
+            if ($userList) {
+                if (!RedisService::get('caches:task:lock:pledge_settle_loaded')) {
+                    foreach ($userList as $item) {
+                        $orderId = $item['id'];
+                        $userId = $item['user_id'];
+                        $orderNo = $item['order_no'];
+                        if ($orderId) {
+                            $taskData = [
+                                'taskName' => 'PledgeSettle',
+                                'name' => "质押订单到期结算",
+                                'params'=> $item,
+                                'date' => date('Y-m-d'),
+                            ];
+                            $res = $serv->task($taskData);
+                            echo "[Task PledgeSettle {$date}] 用户[{$userId}]质押订单[{$orderNo}]到期结算:{$res}\n";
+                        }
+                    }
+
+                    RedisService::set('caches:task:lock:pledge_settle_loaded', true, rand(3, 5));
+                }else{
+                    echo "[Task PledgeSettle {$date}] 质押订单到期结算调用间隔\n";
+                }
+            } else {
+                echo "[Task PledgeSettle {$date}] 间隔时间调用\n";
+            }
+
+        });
+
+        // TODO 更新用户等级
+        \swoole_timer_tick(60000, function ($timer) use ($serv, &$time) { // 启用定时器,每5分钟执行一次
+            $date = date('Y-m-d H:i:s');
+            if ($time > 7200 && file_exists($this->options['log_file'])) {
+                $time = 0;
+                file_put_contents($this->options['log_file'], "Task {$date}:清空日志\n");
+            }
+            $time++;
+            $userList = MemberService::make()->getUpgradeUserList();
+            if ($userList) {
+                if (!RedisService::get('caches:task:lock:upgrade_loaded')) {
+                    foreach ($userList as $item) {
+                        $userId = $item['id'];
+                        if ($userId) {
+                            $taskData = [
+                                'taskName' => 'UpgradeUpdate',
+                                'name' => "用户等级更新",
+                                'params' => $item,
+                                'date' => date('Y-m-d'),
+                            ];
+                            $taskId = $serv->task($taskData);
+                            echo "[Task UpgradeUpdate-{$taskId} {$date}] 用户[{$userId}]用户等级更新处理\n";
+                        }
+                    }
+                    RedisService::set('caches:task:lock:upgrade_loaded', true, rand(5, 10));
+                } else {
+                    echo "[Task UpgradeUpdate {$date}] 间隔时间调用\n";
+                }
+            } else {
+                echo "[Task UpgradeUpdate {$date}] 暂无需要更新等级用户\n";
+            }
+
+        });
+
+        // 开发者维护收益结算
+        \swoole_timer_tick(180000, function ($timer) use ($serv, &$time) { // 启用定时器,每3分钟执行一次
+            $date = date('Y-m-d H:i:s');
+            if ($time > 3600 && file_exists($this->options['log_file'])) {
+                $time = 0;
+                file_put_contents($this->options['log_file'], "Task {$date}:清空日志\n");
+            }
+            $time++;
+            $userList = MemberService::make()->getDeveloperList();
+            if ($userList) {
+                if (!RedisService::get('caches:task:lock:developer_loaded')) {
+                    foreach ($userList as $item) {
+                        $id = $item['id'];
+                        $walletUrl = $item['wallet_url'];
+                        if ($walletUrl) {
+                            $taskData = [
+                                'taskName' => 'DeveloperSettle',
+                                'name' => "开发者维护收益结算",
+                                'params' => $item,
+                                'date' => date('Y-m-d'),
+                            ];
+                            $taskId = $serv->task($taskData);
+                            echo "[Task DeveloperSettle-{$taskId} {$date}] 开发者[{$id}]用户维护收益结算处理\n";
+                        }
+                    }
+                    RedisService::set('caches:task:lock:developer_loaded', true, rand(5, 10));
+                } else {
+                    echo "[Task DeveloperSettle {$date}] 间隔时间调用\n";
+                }
+            } else {
+                echo "[Task DeveloperSettle {$date}] 暂无需要结算收益开发者\n";
+            }
+
+        });
+    }
+
+    //监听连接进入事件
+    public function onConnect($serv, $fd, $from_id)
+    {
+        $serv->send($fd, "Success {$fd}!");
+    }
+
+    // 监听数据接收事件
+    public function onReceive(\Swoole\Server $serv, $fd, $from_id, $data)
+    {
+        echo "Get Message From Client {$fd}:{$data}\n";
+        $res['result'] = 'success';
+        $serv->send($fd, json_encode($res)); // 同步返回消息给客户端
+        $serv->task($data);  // 执行异步任务
+    }
+
+    /**
+     * @param \Swoole\Server $serv
+     * @param $task_id
+     * @param $from_id
+     * @param $data
+     * @return false|string
+     */
+    public function onTask(\Swoole\Server $serv, $task_id, $from_id, $data)
+    {
+
+        $date = date('Y-m-d H:i:s');
+        $taskName = isset($data['taskName']) ? $data['taskName'] : '';
+        $params = isset($data['params']) ? $data['params'] : [];
+        try {
+            switch ($taskName) {
+                case 'UpdateSbtPrice': // 更新SBT每日价格
+                    // 时间限制
+                    if (date('H:i') >= '06:00') {
+                        echo "[Task {$taskName}-{$task_id} {$date}] 不在运行时间段内\n";
+                        return false;
+                    }
+
+                    // 调用处理
+                    if ($res = PriceLogService::make()->updateSbtPrice()) {
+                        $res = is_array($res) && $res ? json_encode($res, 256) : '处理成功';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 更新SBT每日价格:{$res}\n";
+                    } else {
+                        $error = PriceLogService::make()->getError();
+                        $error = $error ? lang($error) : '处理失败';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 更新SBT每日价格:{$error}\n";
+                    }
+                    break;
+                case 'PledgeAutoTrade': // 自动质押处理
+                    // 调用处理
+                    $userId = isset($params['id'])? $params['id'] : 0;
+                    if ($res = PledgeOrderService::make()->autoMakeOrder($params)) {
+                        $res = is_array($res) && $res ? json_encode($res, 256) : '处理成功';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 用户[{$userId}]自动质押交易处理结果:{$res}\n";
+                    } else {
+                        $error = PledgeOrderService::make()->getError();
+                        $error = $error ? lang($error) : '处理失败';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 用户[{$userId}]自动质押交易处理结果:{$error}\n";
+                    }
+
+                    break;
+                case 'PledgeRefund': // 质押订单退本,退本后自动再质押处理
+                    // 调用处理
+                    $userId = isset($params['user_id'])? $params['user_id'] : 0;
+                    $orderId = isset($params['id'])? $params['id'] : 0;
+                    $orderNo = isset($params['order_no'])? $params['order_no'] : '';
+                    if ($res = PledgeOrderService::make()->refund($orderId,$orderNo, $userId)) {
+                        $res = is_array($res) && $res ? json_encode($res, 256) : '处理成功';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 用户[{$userId}]质押订单[{$orderNo}]退本处理成功:{$res}\n";
+                    } else {
+                        $error = PledgeOrderService::make()->getError();
+                        $error = $error ? lang($error) : '处理失败';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 用户[{$userId}]质押订单[{$orderNo}]退本处理失败:{$error}\n";
+                    }
+                    break;
+                case 'PledgeSettle': // 质押订单到期结算,和收益、奖励结算
+                    // 调用处理
+                    $userId = isset($params['user_id'])? $params['user_id'] : 0;
+                    $orderId = isset($params['id'])? $params['id'] : 0;
+                    $orderNo = isset($params['order_no'])? $params['order_no'] : '';
+                    if ($res = PledgeOrderService::make()->orderSettle($orderId,$orderNo,$userId)) {
+                        $res = is_array($res) && $res ? json_encode($res, 256) : '处理成功';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 用户[{$userId}]质押订单[{$orderNo}]收益结算成功:{$res}\n";
+                    } else {
+                        $error = PledgeOrderService::make()->getError();
+                        $error = $error ? lang($error) : '处理失败';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 用户[{$userId}]质押订单[{$orderNo}]收益结算失败:{$error}\n";
+                    }
+                    break;
+                case 'UpgradeUpdate': // 用户等级更新
+                    // 调用处理
+                    $userId = isset($params['id'])? $params['id'] : 0;
+                    if ($res = MemberService::make()->upgradeUpdate($userId)) {
+                        $res = is_array($res) && $res ? json_encode($res, 256) : '处理成功';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 用户[{$userId}]等级更新处理结果:{$res}\n";
+                    } else {
+                        $error = MemberService::make()->getError();
+                        $error = $error ? lang($error) : '处理失败';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 用户[{$userId}]等级更新处理结果:{$error}\n";
+                    }
+                    break;
+                case 'DeveloperSettle': // 维护收益结算
+                    // 调用处理
+                    $id = isset($params['id'])? $params['id'] : 0;
+                    $walletUrl = isset($params['wallet_url'])? $params['wallet_url'] : '';
+                    if ($res = FinanceService::make()->developerSettle($id, $walletUrl)) {
+                        $res = is_array($res) && $res ? json_encode($res, 256) : '处理成功';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 开发者[{$id}]维护收益结算处理结果:{$res}\n";
+                    } else {
+                        $error = MemberService::make()->getError();
+                        $error = $error ? lang($error) : '处理失败';
+                        echo "[Task {$taskName}-{$task_id} {$date}] 开发者[{$id}]维护收益结算处理结果:{$error}\n";
+                    }
+                    break;
+            }
+        } catch (\Exception $exception) {
+            return $exception->getMessage();
+        }
+
+        return '暂无任务处理';
+    }
+
+
+    /**
+     * @param $serv swoole_server swoole_server对象
+     * @param $task_id int 任务id
+     * @param $data string 任务返回的数据
+     */
+    public function onFinish(\Swoole\Server $serv, $task_id, $data)
+    {
+        //
+        echo "任务[{$task_id}]处理完成...\n";
+    }
+
+
+    // 监听连接关闭事件
+    public function onClose($serv, $fd, $from_id)
+    {
+        echo "Client {$fd} close connection\n";
+        $serv->close();
+    }
+}

+ 327 - 0
app/Console/Commands/WalletTask.php

@@ -0,0 +1,327 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Services\RedisService;
+use App\Services\WalletService;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\DB;
+
+class WalletTask extends Command
+{
+
+    protected $serv;
+    protected $host = '127.0.0.1';
+    protected $port = 6632;
+    // 进程名称
+    protected $taskName = 'walletTask';
+    // PID路径
+    protected $pidPath = '/storage/wallet.pid';
+    // task
+    protected $onlyReloadTaskWorker = false;
+    // 设置运行时参数
+    protected $options = [
+        'worker_num' => 8, //worker进程数,一般设置为CPU数的1-4倍
+        'daemonize' => true, //启用守护进程
+        'log_file' => '/storage/logs/wallet-task.log', //指定swoole错误日志文件
+        'log_level' => 0, //日志级别 范围是0-5,0-DEBUG,1-TRACE,2-INFO,3-NOTICE,4-WARNING,5-ERROR
+        'dispatch_mode' => 1, //数据包分发策略,1-轮询模式
+        'task_worker_num' => 6, //task进程的数量
+        'task_ipc_mode' => 3, //使用消息队列通信,并设置为争抢模式
+    ];
+
+
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'wallet:task {op}';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Solana 钱包监控服务';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * 入口
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        ini_set("default_socket_timeout", -1);
+        // 项目根目录
+        defined('ROOT_PATH') or define('ROOT_PATH', base_path());
+
+        // 文件上传目录
+        defined('ATTACHMENT_PATH') or define('ATTACHMENT_PATH', base_path('public/uploads'));
+
+        // 图片上传目录
+        defined('IMG_PATH') or define('IMG_PATH', base_path('public/uploads/images'));
+
+        // 临时存放目录
+        defined('UPLOAD_TEMP_PATH') or define('UPLOAD_TEMP_PATH', ATTACHMENT_PATH . "/temp");
+
+        // 定义普通图片域名
+        defined('IMG_URL') or define('IMG_URL', env('IMG_URL'));
+
+        // 数据表前缀
+        defined('DB_PREFIX') or define('DB_PREFIX', DB::connection()->getTablePrefix());
+
+        $this->options['log_file'] = base_path() . $this->options['log_file'];
+        $this->pidPath = base_path() . $this->pidPath;
+        $op = $this->argument('op');
+        switch ($op) {
+            case 'status': // 状态
+                $res = $this->status();
+                echo $res ? $res : 0;
+                break;
+            case 'start': // 运行
+                return $this->start();
+                break;
+            case 'reload': // 平滑重启
+                return $this->reload();
+                break;
+            case 'stop': // 停止运行
+                return $this->stop();
+                break;
+            default:
+                exit("{$op} command does not exist");
+                break;
+        }
+    }
+
+    /**
+     * 启动
+     */
+    public function start()
+    {
+        date_default_timezone_set('PRC');
+        // 构建Server对象,监听对应地址
+        $this->serv = new \Swoole\Server($this->host, $this->port);
+        $this->serv->set($this->options);
+
+        // 注册事件
+        $this->serv->on('start', [$this, 'onStart']);
+        $this->serv->on('receive', [$this, 'onReceive']);
+        $this->serv->on('task', [$this, 'onTask']);
+        $this->serv->on('finish', [$this, 'onFinish']);
+
+        // Run worker
+        echo "wallet start...\n";
+        $this->serv->start();
+
+    }
+
+    // 安全重启
+    public function reload()
+    {
+
+        $pids = file_exists($this->pidPath) ? file_get_contents($this->pidPath) : '';
+        $pids = $pids ? explode("\n", $pids) : [];
+        $masterPid = isset($pids[0]) ? $pids[0] : '';
+        $managePid = isset($pids[1]) ? $pids[1] : '';
+        if (empty($masterPid)) {
+            return false;
+        }
+
+        if (!$this->status($masterPid)) {
+            return false;
+        }
+
+        \Swoole\Process::kill($managePid, SIGUSR1);
+
+        echo "wallet reload...\n";
+    }
+
+    /**
+     * 停止
+     * @param bool $smooth
+     * @return bool
+     */
+    public function stop($smooth = false)
+    {
+        $pids = file_exists($this->pidPath) ? file_get_contents($this->pidPath) : '';
+        $pids = $pids ? explode("\n", $pids) : [];
+        $masterPid = isset($pids[0]) ? $pids[0] : '';
+        $managePid = isset($pids[1]) ? $pids[1] : '';
+        if (empty($masterPid)) {
+            return false;
+        }
+
+        if (!$this->status($masterPid)) {
+            return false;
+        }
+
+        // 直接杀
+        $stoSh = base_path().'/crontab/walletTaskStop.sh';
+        if(file_exists($stoSh) && function_exists('exec')){
+            exec("{$stoSh}");
+        }
+
+        // 清除分页
+        $wallets = WalletService::make()->getWalletList();
+        if($wallets){
+            foreach ($wallets as $item){
+                RedisService::clear('caches:wallet:listen_recharge_page_'.$item['address']);
+            }
+        }
+
+        @unlink($this->pidPath);
+        echo "wallet stop...\n";
+    }
+
+    /**
+     * 状态
+     * @return mixed
+     */
+    public function status($masterPid = 0)
+    {
+        $res = false;
+        if (empty($masterPid) && file_exists($this->pidPath)) {
+            $pids = file_get_contents($this->pidPath);
+            $pids = $pids ? explode("\n", $pids) : [];
+            $masterPid = isset($pids[0]) ? $pids[0] : '';
+        }
+
+        if ($masterPid) {
+            $res = \Swoole\Process::kill($masterPid, 0);
+        }
+        return $res;
+    }
+
+    public function onStart($serv)
+    {
+        if (!is_dir(dirname($this->pidPath))) {
+            @mkdir(dirname($this->pidPath), true, 755);
+        }
+
+        //记录进程id,脚本实现自动重启
+        $pid = "{$serv->master_pid}\n{$serv->manager_pid}";
+        file_put_contents($this->pidPath, $pid);
+
+        // 定时任务
+        $time = 0;
+        $date = date('Y-m-d H:i:s');
+        if(file_exists($this->options['log_file'])){
+            $time = 0;
+            file_put_contents($this->options['log_file'],"Task {$date}:清空日志\n");
+        }
+
+       \swoole_timer_tick(10000, function ($timer) use ($serv, &$time) { // 启用定时器,每10秒执行一次
+            $date = date('Y-m-d H:i:s');
+            if($time>6*3600 && file_exists($this->options['log_file'])){
+                $time = 0;
+                file_put_contents($this->options['log_file'],"Task {$date}:清空日志\n");
+            }
+            $time++;
+            $wallets = WalletService::make()->getWalletList();
+            if($wallets){
+                if(!RedisService::get('caches:task:lock:wallet_loaded')){
+                    foreach ($wallets as $item){
+                        $taskData = [
+                            'taskName' => 'listenWallet',
+                            'name' => "平台钱包地址监控",
+                            'params' => $item,
+                            'date' => date('Y-m-d'),
+                        ];
+                        $res = $serv->task($taskData);
+                    }
+                    RedisService::set('caches:task:lock:wallet_loaded', true, rand(3,5));
+                    echo "[Task listenWallet {$date}] 平台钱包地址监控调用完成:{$res}\n";
+                }else{
+                    echo "[Task listenWallet {$date}] 间隔时间调用\n";
+                }
+            }else{
+                echo "[Task listenWallet {$date}] 钱包地址未配置\n";
+            }
+        });
+    }
+
+    //监听连接进入事件
+    public function onConnect($serv, $fd, $from_id)
+    {
+        $serv->send($fd, "Success {$fd}!");
+    }
+
+    // 监听数据接收事件
+    public function onReceive(\Swoole\Server $serv, $fd, $from_id, $data)
+    {
+        echo "Get Message From Client {$fd}:{$data}\n";
+        $res['result'] = 'success';
+        $serv->send($fd, json_encode($res)); // 同步返回消息给客户端
+        $serv->task($data);  // 执行异步任务
+    }
+
+    /**
+     * @param \Swoole\Server $serv
+     * @param $task_id
+     * @param $from_id
+     * @param $data
+     * @return false|string
+     */
+    public function onTask(\Swoole\Server $serv, $task_id, $from_id, $data)
+    {
+
+        $date = date('Y-m-d H:i:s');
+        $taskName = isset($data['taskName']) ? $data['taskName'] : '';
+        $params = isset($data['params']) ? $data['params'] : [];
+        switch ($taskName) {
+            case 'listenWallet': // 钱包监控
+                $address = isset($params['address'])? $params['address'] : '';
+                $type = isset($params['type'])? $params['type'] : 1;
+                if(empty($address)){
+                    echo "[Task {$taskName}-{$task_id} {$date}] address 地址参数错误\n";
+                    return false;
+                }
+
+                // 调用处理
+                if($res = WalletService::make()->listenWallet($address, $type, 0)){
+                    $success = isset($res['success'])? $res['success'] : 0;
+                    $total = isset($res['total'])? $res['total'] : 0;
+                    echo "[Task {$taskName}-{$task_id} {$date}] 钱包地址[{$address}]监控处理结果:".($total? "监控{$total}条记录,成功处理{$success}条":'success')."\n";
+                }else{
+                    $error = WalletService::make()->getError();
+                    $error = $error? lang($error) : 'failed';
+                    echo "[Task {$taskName}-{$task_id} {$date}] 钱包地址[{$address}]监控处理结果:{$error}\n";
+                }
+                break;
+        }
+
+        return "[Task {$taskName}-{$task_id} {$date}] 暂无任务处理\n";
+    }
+
+
+    /**
+     * @param $serv swoole_server swoole_server对象
+     * @param $task_id int 任务id
+     * @param $data string 任务返回的数据
+     */
+    public function onFinish(\Swoole\Server $serv, $task_id, $data)
+    {
+        //
+        echo "任务[{$task_id}]处理完成...\n";
+    }
+
+
+    // 监听连接关闭事件
+    public function onClose($serv, $fd, $from_id)
+    {
+        echo "Client {$fd} close connection\n";
+        $serv->close();
+    }
+}

+ 41 - 0
app/Console/Kernel.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Console;
+
+use Illuminate\Console\Scheduling\Schedule;
+use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
+
+class Kernel extends ConsoleKernel
+{
+    /**
+     * The Artisan commands provided by your application.
+     *
+     * @var array
+     */
+    protected $commands = [
+        //
+    ];
+
+    /**
+     * Define the application's command schedule.
+     *
+     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
+     * @return void
+     */
+    protected function schedule(Schedule $schedule)
+    {
+        // $schedule->command('inspire')->hourly();
+    }
+
+    /**
+     * Register the commands for the application.
+     *
+     * @return void
+     */
+    protected function commands()
+    {
+        $this->load(__DIR__.'/Commands');
+
+        require base_path('routes/console.php');
+    }
+}

+ 37 - 0
app/Exceptions/Handler.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace App\Exceptions;
+
+use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
+
+class Handler extends ExceptionHandler
+{
+    /**
+     * A list of the exception types that are not reported.
+     *
+     * @var array
+     */
+    protected $dontReport = [
+        //
+    ];
+
+    /**
+     * A list of the inputs that are never flashed for validation exceptions.
+     *
+     * @var array
+     */
+    protected $dontFlash = [
+        'password',
+        'password_confirmation',
+    ];
+
+    /**
+     * Register the exception handling callbacks for the application.
+     *
+     * @return void
+     */
+    public function register()
+    {
+        //
+    }
+}

+ 238 - 0
app/Exports/Export.php

@@ -0,0 +1,238 @@
+<?php
+
+namespace App\Exports;
+
+use Illuminate\Support\Collection;
+use Maatwebsite\Excel\Concerns\FromCollection;
+use Maatwebsite\Excel\Concerns\WithEvents;
+use Maatwebsite\Excel\Concerns\WithHeadings;
+use Maatwebsite\Excel\Events\AfterSheet;
+use PhpOffice\PhpSpreadsheet\Style\Border;
+
+/**
+ * 导出Excel类
+ * @author 牧羊人
+ * @since 2021/4/10
+ * Class Export
+ * @package App\Exports
+ */
+class Export implements FromCollection, WithHeadings, WithEvents
+{
+    protected $data;
+    protected $headings;
+    protected $columnWidth = [];//设置列宽       key:列  value:宽
+    protected $rowHeight = [];  //设置行高       key:行  value:高
+    protected $mergeCells = []; //合并单元格    value:A1:K8
+    protected $font = [];       //设置字体       key:A1:K8  value:Arial
+    protected $fontSize = [];       //设置字体大小       key:A1:K8  value:11
+    protected $bold = [];       //设置粗体       key:A1:K8  value:true
+    protected $background = []; //设置背景颜色    key:A1:K8  value:#F0F0F0F
+    protected $vertical = [];   //设置定位       key:A1:K8  value:center
+    protected $sheetName; //sheet title
+    protected $borders = []; //设置边框颜色  key:A1:K8  value:#000000
+    //设置页面属性时如果无效   更改excel格式尝试即可
+    //构造函数传值
+    public function __construct($data, $headings, $sheetName)
+    {
+        $this->data = $data;
+        $this->headings = $headings;
+        $this->sheetName = $sheetName;
+        $this->createData();
+    }
+
+    public function headings(): array
+    {
+        return $this->headings;
+    }
+
+    //数组转集合
+    public function collection()
+    {
+        return new Collection($this->data);
+    }
+
+    //业务代码
+    public function createData()
+    {
+        $this->data = collect($this->data)->toArray();
+    }
+
+    public function registerEvents(): array
+    {
+        return [
+            AfterSheet::class => function (AfterSheet $event) {
+                //设置区域单元格垂直居中
+                $event->sheet->getDelegate()->getStyle('A1:Z1265')->getAlignment()->setVertical('center');
+                //设置区域单元格水平居中
+                $event->sheet->getDelegate()->getStyle('A1:Z1265')->getAlignment()->setHorizontal('center');
+                //设置列宽
+                foreach ($this->columnWidth as $column => $width) {
+                    $event->sheet->getDelegate()
+                        ->getColumnDimension($column)
+                        ->setWidth($width);
+                }
+                //设置行高,$i为数据行数
+                foreach ($this->rowHeight as $row => $height) {
+                    $event->sheet->getDelegate()
+                        ->getRowDimension($row)
+                        ->setRowHeight($height);
+                }
+
+                //设置区域单元格垂直居中
+                foreach ($this->vertical as $region => $position) {
+                    $event->sheet->getDelegate()
+                        ->getStyle($region)
+                        ->getAlignment()
+                        ->setVertical($position);
+                }
+
+                //设置区域单元格字体
+                foreach ($this->font as $region => $value) {
+                    $event->sheet->getDelegate()
+                        ->getStyle($region)
+                        ->getFont()->setName($value);
+                }
+                //设置区域单元格字体大小
+                foreach ($this->fontSize as $region => $value) {
+                    $event->sheet->getDelegate()
+                        ->getStyle($region)
+                        ->getFont()
+                        ->setSize($value);
+                }
+
+                //设置区域单元格字体粗体
+                foreach ($this->bold as $region => $bool) {
+                    $event->sheet->getDelegate()
+                        ->getStyle($region)
+                        ->getFont()
+                        ->setBold($bool);
+                }
+
+
+                //设置区域单元格背景颜色
+                foreach ($this->background as $region => $item) {
+                    $event->sheet->getDelegate()->getStyle($region)->applyFromArray([
+                        'fill' => [
+                            'fillType' => 'linear', //线性填充,类似渐变
+                            'startColor' => [
+                                'rgb' => $item //初始颜色
+                            ],
+                            //结束颜色,如果需要单一背景色,请和初始颜色保持一致
+                            'endColor' => [
+                                'argb' => $item
+                            ]
+                        ]
+                    ]);
+                }
+                //设置边框颜色
+                foreach ($this->borders as $region => $item) {
+                    $event->sheet->getDelegate()->getStyle($region)->applyFromArray([
+                        'borders' => [
+                            'allBorders' => [
+                                'borderStyle' => Border::BORDER_THIN,
+                                'color' => ['argb' => $item],
+                            ],
+                        ],
+                    ]);
+                }
+                //合并单元格
+                $event->sheet->getDelegate()->setMergeCells($this->mergeCells);
+                if (!empty($this->sheetName)) {
+                    $event->sheet->getDelegate()->setTitle($this->sheetName);
+                }
+            }
+        ];
+    }
+
+    /**
+     * @return array
+     * [
+     *    'B' => 40,
+     *    'C' => 60
+     * ]
+     */
+    public function setColumnWidth(array $columnwidth)
+    {
+        $this->columnWidth = array_change_key_case($columnwidth, CASE_UPPER);
+    }
+
+    /**
+     * @return array
+     * [
+     *    1 => 40,
+     *    2 => 60
+     * ]
+     */
+    public function setRowHeight(array $rowHeight)
+    {
+        $this->rowHeight = $rowHeight;
+    }
+
+    /**
+     * @return array
+     * [
+     *    A1:K7 => '宋体'
+     * ]
+     */
+    public function setFont(array $font)
+    {
+        $this->font = array_change_key_case($font, CASE_UPPER);
+    }
+
+    /**
+     * @return array
+     * @2020/3/22 10:33
+     * [
+     *    A1:K7 => true
+     * ]
+     */
+    public function setBold(array $bold)
+    {
+        $this->bold = array_change_key_case($bold, CASE_UPPER);
+    }
+
+    /**
+     * @return array
+     * @2020/3/22 10:33
+     * [
+     *    A1:K7 => F0FF0F
+     * ]
+     */
+    public function setBackground(array $background)
+    {
+        $this->background = array_change_key_case($background, CASE_UPPER);
+    }
+
+    /**
+     * @return array
+     * [
+     *    A1:K7
+     * ]
+     */
+    public function setMergeCells(array $mergeCells)
+    {
+        $this->mergeCells = array_change_key_case($mergeCells, CASE_UPPER);
+    }
+
+    /**
+     * @return array
+     * [
+     *    A1:K7 => 14
+     * ]
+     */
+    public function setFontSize(array $fontSize)
+    {
+        $this->fontSize = array_change_key_case($fontSize, CASE_UPPER);
+    }
+
+    /**
+     * @return array
+     * [
+     *    A1:K7 => #000000
+     * ]
+     */
+    public function setBorders(array $borders)
+    {
+        $this->borders = array_change_key_case($borders, CASE_UPPER);
+    }
+}

+ 204 - 0
app/Helpers/Jwt.php

@@ -0,0 +1,204 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Helpers;
+
+/**
+ * JWT鉴权
+ * @author laravel开发员
+ * @since 2020/11/14
+ * Class Jwt
+ * @package App\Helpers
+ */
+class Jwt
+{
+    // 头部
+    private static $header = [
+        'alg' => 'HS256', //生成signature的算法
+        'typ' => 'JWT'    //JWT 令牌统一写为JWT
+    ];
+
+    // 使用HMAC生成信息摘要时所使用的密钥
+    private static $key = '34c68cdccb5b6feb4f7f0a5ede9f5932';
+    private static $scene = 'jwt_yh';
+
+    public function __construct($scene='')
+    {
+        if($scene){
+            self::$scene = $scene;
+        }
+    }
+
+    /**
+     * alg属性表示签名的算法(algorithm),默认是 HMAC SHA256(写成 HS256);typ属性表示这个令牌(token)的类型(type),JWT 令牌统一写为JWT
+     * @return string
+     * @author laravel开发员
+     * @since 2020/11/14
+     */
+    public function getHeader()
+    {
+        return self::base64UrlEncode(json_encode(self::$header, JSON_UNESCAPED_UNICODE));
+    }
+
+    /**
+     * Payload 部分也是一个 JSON 对象,用来存放实际需要传递的数据
+     * JWT 规定了7个官方字段,供选用,这里可以存放私有信息,比如uid
+     * @param $uid
+     * @return string
+     * @author laravel开发员
+     * @since 2020/11/14
+     */
+    public function getPayload($uid)
+    {
+        $payload = [
+            'iss' => self::$scene?self::$scene:'jwt_yh', //签发人
+            'exp' => time() + 60 * 60 * 24 * 7, //过期时间
+            'sub' => 'YH', //主题
+            'aud' => 'every', //受众
+            'nbf' => time(), //生效时间,该时间之前不接收处理该Token
+            'iat' => time(), //签发时间
+            'jti' => 10001, //编号(JWT ID用于标识该JWT)
+            'uid' => $uid, //私有信息,uid
+        ];
+
+        return self::base64UrlEncode(json_encode($payload, JSON_UNESCAPED_UNICODE));
+    }
+
+    /**
+     * 获取Token
+     * @param array $payload jwt载荷
+     * 格式如下非必须:
+     * [
+     *  'iss'=>'jwt_admin',  //该JWT的签发者
+     *  'iat'=>time(),  //签发时间
+     *  'exp'=>time()+7200,  //过期时间
+     *  'nbf'=>time()+60,  //该时间之前不接收处理该Token
+     *  'sub'=>'www.admin.com',  //面向的用户
+     *  'jti'=>md5(uniqid('JWT').time())  //该Token唯一标识
+     * ]
+     * @return bool|string 返回结果
+     * @author laravel开发员
+     * @since 2020/11/14
+     */
+    public function getToken($uid)
+    {
+        // 获取JWT头
+        $header = self::getHeader();
+        // 获取JWT有效载荷
+        $payload = self::getPayload($uid);
+
+        // JWT头拼接JWT有效载荷
+        $raw = $header . '.' . $payload;
+
+        $sign = self::signature($raw, self::$key, self::$header['alg']);
+        // Token字符串
+        $token = $raw . '.' . $sign;
+        // 返回Token
+        return $token;
+    }
+
+    /**
+     * 验证token是否有效,默认验证exp,nbf,iat时间
+     * @param string $token token字符串
+     * @return bool|mixed 返回结果
+     * @author laravel开发员
+     * @since 2020/11/14
+     */
+    public function verifyToken(string $token)
+    {
+        if (!$token) {
+            return false;
+        }
+        $tokens = explode('.', $token);
+
+        if (count($tokens) != 3) {
+            return false;
+        }
+
+        list($base64header, $base64payload, $sign) = $tokens;
+
+        // 获取jwt算法
+        $base64decodeheader = json_decode(self::base64UrlDecode($base64header), JSON_OBJECT_AS_ARRAY);
+        if (empty($base64decodeheader['alg'])) {
+            return false;
+        }
+
+        //签名验证
+        if (self::signature($base64header . '.' . $base64payload, self::$key, $base64decodeheader['alg']) !== $sign) {
+            return false;
+        }
+
+        $payload = json_decode(self::base64UrlDecode($base64payload), JSON_OBJECT_AS_ARRAY);
+
+        //签发时间大于当前服务器时间验证失败
+        if (isset($payload['iat']) && $payload['iat'] > time()) {
+            return false;
+        }
+
+        //过期时间小宇当前服务器时间验证失败
+        if (isset($payload['exp']) && $payload['exp'] < time()) {
+            return false;
+        }
+
+        //该nbf时间之前不接收处理该Token
+        if (isset($payload['nbf']) && $payload['nbf'] > time()) {
+            return false;
+        }
+
+        return $payload['uid'];
+    }
+
+    /**
+     * base64UrlEncode编码实现
+     * @param string $str 需要编码的字符串
+     * @return mixed 返回结果
+     * @author laravel开发员
+     * @since 2020/11/14
+     */
+    private static function base64UrlEncode(string $str)
+    {
+        return str_replace('=', '', strtr(base64_encode($str), '+/', '-_'));
+    }
+
+    /**
+     * base64UrlDecode解码实现
+     * @param string $str 需要解码的字符串
+     * @return bool|string 返回结果
+     * @author laravel开发员
+     * @since 2020/11/14
+     */
+    private static function base64UrlDecode(string $str)
+    {
+        $remainder = strlen($str) % 4;
+        if ($remainder) {
+            $addlen = 4 - $remainder;
+            $str .= str_repeat('=', $addlen);
+        }
+        return base64_decode(strtr($str, '-_', '+/'));
+    }
+
+    /**
+     * HMACSHA256签名实现
+     * @param string $str 待签名字符串
+     * @param string $key 加密密钥
+     * @param string $alg 算法方式
+     * @return mixed 返回结果
+     * @author laravel开发员
+     * @since 2020/11/14
+     */
+    private static function signature(string $str, string $key, string $alg)
+    {
+        $alg_config = array(
+            'HS256' => 'sha256'
+        );
+        return self::base64UrlEncode(hash_hmac($alg_config[$alg], $str, $key, true));
+    }
+}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2380 - 0
app/Helpers/common.php


+ 22 - 0
app/Helpers/constants.php

@@ -0,0 +1,22 @@
+<?php
+/// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+// 自定义系统常量公共类
+
+define('MESSAGE_OK', '操作成功');
+define('MESSAGE_FAILED', '操作失败');
+define('MESSAGE_SYSTEM_ERROR', '系统繁忙,请稍后再试');
+define('MESSAGE_PARAMETER_MISSING', '参数丢失');
+define('MESSAGE_PARAMETER_ERROR', '参数错误');
+define('MESSAGE_PERMISSON_DENIED', '没有权限');
+define('MESSAGE_INTERNAL_ERROR', '服务器繁忙,请稍后再试');
+
+define('MESSAGE_NEEDLOGIN', '请登录');

+ 11 - 0
app/Helpers/function.php

@@ -0,0 +1,11 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+

+ 83 - 0
app/Http/Controllers/Admin/AccountLogController.php

@@ -0,0 +1,83 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Http\Validator\AccountValidator;
+use App\Services\Common\AccountLogService;
+
+/**
+ * 账户管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class AccountLogController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new AccountLogService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+
+    /**
+     * 选项列表
+     * @return mixed
+     */
+    public function count(){
+        $params = request()->all();
+        $result = $this->service->count($params);
+        return message(1002,true, $result);
+    }
+
+    /**
+     * 调整账户
+     * @param AccountValidator $validator
+     * @return array
+     */
+    public function changeAccount(AccountValidator $validator)
+    {
+        // 获取参数
+        $params = $validator->check(request()->all(), 'change');
+        if(!is_array($params)){
+            return message($params, false);
+        }
+
+        if(AccountLogService::make()->changeAccount($this->userId,$params)){
+            return message(AccountLogService::make()->getError(), true);
+        }else{
+            return message(AccountLogService::make()->getError(), false);
+        }
+    }
+}

+ 36 - 0
app/Http/Controllers/Admin/ActionLogController.php

@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\ActionLogService;
+
+/**
+ * 行为日志-控制器
+ * @author laravel开发员
+ * @since 2020/11/12
+ * Class ActionLogController
+ * @package App\Http\Controllers
+ */
+class ActionLogController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/12
+     * ActionLogController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new ActionLogService();
+    }
+}

+ 39 - 0
app/Http/Controllers/Admin/AdController.php

@@ -0,0 +1,39 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\AdService;
+
+/**
+ * 广告管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class AdController
+ * @package App\Http\Controllers
+ */
+class AdController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * AdController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new AdService();
+    }
+
+
+}

+ 50 - 0
app/Http/Controllers/Admin/AdSortController.php

@@ -0,0 +1,50 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\AdSortService;
+
+/**
+ * 广告位管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class AdSortController
+ * @package App\Http\Controllers
+ */
+class AdSortController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * AdSortController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new AdSortService();
+    }
+
+    /**
+     * 获取广告位列表
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function getAdSortList()
+    {
+        $result = $this->service->getAdSortList();
+        return $result;
+    }
+
+}

+ 57 - 0
app/Http/Controllers/Admin/ArticleController.php

@@ -0,0 +1,57 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\ArticleService;
+use App\Services\Common\DrawLogsService;
+use App\Services\Common\FinanceService;
+use App\Services\Common\MachineService;
+use App\Services\Common\WalletService;
+
+/**
+ * 承兑商管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class ArticleController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new ArticleService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+}

+ 168 - 0
app/Http/Controllers/Admin/Backend.php

@@ -0,0 +1,168 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Helpers\Jwt;
+use App\Http\Controllers\BaseController;
+use App\Models\UserModel;
+use App\Services\RedisService;
+
+/**
+ * 后台控制器基类
+ * @author laravel开发员
+ * @since 2020/11/10
+ * Class Backend
+ * @package App\Http\Controllers
+ */
+class Backend extends BaseController
+{
+    // 模型
+    protected $model;
+    // 服务
+    protected $service;
+    // 校验
+    protected $validate;
+    // 登录ID
+    protected $userId;
+    // 登录信息
+    protected $userInfo;
+
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/10
+     * Backend constructor.
+     */
+    public function __construct()
+    {
+
+        parent::__construct();
+        // 初始化配置
+        $this->initConfig();
+
+        // 登录检测中间件
+        $this->middleware('user.login');
+
+        // 初始化登录信息
+        $this->middleware(function ($request, $next) {
+            // 请求头信息
+            $token = $request->headers->get('Authorization');
+            $token = str_replace("Bearer ", null, $token);
+            // JWT解密token
+            $jwt = new Jwt();
+            $userId = $jwt->verifyToken($token);
+
+            // 登录验证
+            $this->initLogin($userId);
+
+            $request->headers->set('admin_id' , $userId);
+            return $next($request);
+        });
+    }
+
+    /**
+     * 初始化配置
+     * @author laravel开发员
+     * @since 2020/11/10
+     */
+    public function initConfig()
+    {
+        // 请求参数
+        $this->param = \request()->input();
+
+        // 分页基础默认值
+        defined('PERPAGE') or define('PERPAGE', isset($this->param['limit']) ? $this->param['limit'] : 20);
+        defined('PAGE') or define('PAGE', isset($this->param['page']) ? $this->param['page'] : 1);
+    }
+
+    /**
+     * 登录验证
+     * @param $userId 用户ID
+     * @return
+     * @author laravel开发员
+     * @since 2020/8/31
+     */
+    public function initLogin($userId)
+    {
+        // 登录用户ID
+        $this->userId = $userId;
+
+        // 登录用户信息
+        if ($userId) {
+            $adminModel = new UserModel();
+            $userInfo = $adminModel->getInfo($this->userId);
+            $this->userInfo = $userInfo;
+        }
+
+    }
+
+    /**
+     * 获取数据列表
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function index()
+    {
+        $result = $this->service->getList();
+        return $result;
+    }
+
+    /**
+     * 获取数据详情
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function info()
+    {
+        $result = $this->service->info();
+        return $result;
+    }
+
+    /**
+     * 添加或编辑
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function edit()
+    {
+        $result = $this->service->edit();
+        return $result;
+    }
+
+    /**
+     * 删除数据
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function delete()
+    {
+        $result = $this->service->delete();
+        return $result;
+    }
+
+    /**
+     * 设置状态
+     * @return mixed
+     * @since 2020/11/21
+     * @author laravel开发员
+     */
+    public function status()
+    {
+        $result = $this->service->status();
+        return $result;
+    }
+
+}

+ 63 - 0
app/Http/Controllers/Admin/BalanceLogController.php

@@ -0,0 +1,63 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\AcceptorService;
+use App\Services\Common\BalanceLogService;
+use App\Services\Common\MemberService;
+
+/**
+ * 承兑商管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class BalanceLogController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new BalanceLogService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+    /**
+     * 统计
+     * @return mixed
+     */
+    public function count(){
+        $params = request()->all();
+        $result = $this->service->count($params);
+        return message(1002,true, $result);
+    }
+}

+ 36 - 0
app/Http/Controllers/Admin/CityController.php

@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\CityService;
+
+/**
+ * 城市管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class CityController
+ * @package App\Http\Controllers
+ */
+class CityController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * CityController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new CityService();
+    }
+}

+ 36 - 0
app/Http/Controllers/Admin/ConfigController.php

@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\ConfigService;
+
+/**
+ * 配置管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ConfigController
+ * @package App\Http\Controllers
+ */
+class ConfigController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * ConfigController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new ConfigService();
+    }
+}

+ 36 - 0
app/Http/Controllers/Admin/ConfigGroupController.php

@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\ConfigGroupService;
+
+/**
+ * 配置分组-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ConfigGroupController
+ * @package App\Http\Controllers
+ */
+class ConfigGroupController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * ConfigGroupController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new ConfigGroupService();
+    }
+}

+ 22 - 0
app/Http/Controllers/Admin/Controller.php

@@ -0,0 +1,22 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Foundation\Bus\DispatchesJobs;
+use Illuminate\Foundation\Validation\ValidatesRequests;
+use Illuminate\Routing\Controller as BaseController;
+
+class Controller extends BaseController
+{
+    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
+}

+ 68 - 0
app/Http/Controllers/Admin/FinanceController.php

@@ -0,0 +1,68 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\FinanceService;
+
+/**
+ * 承兑商管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class FinanceController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new FinanceService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function count()
+    {
+        $list = $this->service->getCount();
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => $list,
+        );
+        return $message;
+    }
+
+}

+ 114 - 0
app/Http/Controllers/Admin/IndexController.php

@@ -0,0 +1,114 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\MenuService;
+use App\Services\Common\UserService;
+use App\Services\RedisService;
+
+/**
+ * 系统主页控制器
+ * @author laravel开发员
+ * @since 2020/11/10
+ * Class IndexController
+ * @package App\Http\Controllers
+ */
+class IndexController extends Backend
+{
+
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/10
+     * IndexController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * 后台主页
+     * @author laravel开发员
+     * @since 2020/11/10
+     */
+    public function getMenuList()
+    {
+        $menuService = new MenuService();
+        $menuList = $menuService->getPermissionList($this->userId);
+        return $menuList;
+    }
+
+    /**
+     * 获取个人信息
+     * @return array
+     * @since 2020/11/10
+     * @author laravel开发员
+     */
+    public function getUserInfo()
+    {
+        $userService = new UserService();
+        $result = $userService->getUserInfo($this->userId);
+        return $result;
+    }
+
+    /**
+     * 更新个人资料
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function updateUserInfo()
+    {
+        $userService = new UserService();
+        $result = $userService->updateUserInfo($this->userId);
+        return $result;
+    }
+
+    /**
+     * 更新密码
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function updatePwd()
+    {
+        $userService = new UserService();
+        $result = $userService->updatePwd($this->userId);
+        return $result;
+    }
+
+    /**
+     * 清除缓存
+     * @return array
+     */
+    public function clearCache()
+    {
+        RedisService::keyDel("caches:admin*");
+        RedisService::keyDel("caches:balance*");
+        RedisService::keyDel("caches:index*");
+        RedisService::keyDel("caches:advert*");
+        RedisService::keyDel("caches:article*");
+        RedisService::keyDel("caches:member*");
+        RedisService::keyDel("caches:team*");
+        RedisService::keyDel("caches:conf*");
+        RedisService::keyDel("caches:order*");
+        RedisService::keyDel("caches:pledge*");
+        RedisService::keyDel("caches:sbtPrice*");
+        RedisService::keyDel("caches:wallet*");
+        RedisService::keyDel("caches:withdraw*");
+        RedisService::keyDel("caches:account*");
+        RedisService::keyDel("laravel_cache:model*");
+        return message(MESSAGE_OK, true);
+    }
+
+}

+ 53 - 0
app/Http/Controllers/Admin/InstitutionalController.php

@@ -0,0 +1,53 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\InstitutionalService;
+
+/**
+ * 制度参数管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class InstitutionalController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new InstitutionalService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+}

+ 37 - 0
app/Http/Controllers/Admin/LayoutController.php

@@ -0,0 +1,37 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\LayoutService;
+
+/**
+ * 布局管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class LayoutController
+ * @package App\Http\Controllers
+ */
+class LayoutController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * LayoutController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new LayoutService();
+    }
+
+}

+ 84 - 0
app/Http/Controllers/Admin/LoginController.php

@@ -0,0 +1,84 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Models\ActionLogModel;
+use App\Services\Common\LoginService;
+
+/**
+ * 登录控制器
+ * @author laravel开发员
+ * @since 2020/11/10
+ * Class LoginController
+ * @package App\Http\Controllers
+ */
+class LoginController extends Backend
+{
+
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/10
+     * LoginController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new LoginService();
+    }
+
+    /**
+     * 获取验证码
+     * @return mixed
+     * @since 2020/11/10
+     * @author laravel开发员
+     */
+    public function captcha()
+    {
+        $result = $this->service->captcha();
+        return $result;
+    }
+
+    /**
+     * 系统登录
+     * @author laravel开发员
+     * @since 2020/11/10
+     */
+    public function login()
+    {
+        $result = $this->service->login();
+        return $result;
+    }
+
+    /**
+     * 退出系统
+     * @author laravel开发员
+     * @since 2020/11/10
+     */
+    public function logout()
+    {
+        $result = $this->service->logout();
+        return $result;
+    }
+
+    /**
+     * 验证账号是否绑定谷歌
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function checkAccount()
+    {
+        $result = $this->service->checkAccount();
+        return $result;
+    }
+}

+ 36 - 0
app/Http/Controllers/Admin/LoginLogController.php

@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\LoginLogService;
+
+/**
+ * 登录日志-控制器
+ * @author laravel开发员
+ * @since 2020/11/12
+ * Class LoginLogController
+ * @package App\Http\Controllers
+ */
+class LoginLogController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/12
+     * LoginLogController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new LoginLogService();
+    }
+}

+ 94 - 0
app/Http/Controllers/Admin/MemberController.php

@@ -0,0 +1,94 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\MemberService;
+
+/**
+ * 会员管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class MemberController
+ * @package App\Http\Controllers
+ */
+class MemberController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * MemberController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new MemberService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+    /**
+     * 推荐树
+     * @return array
+     */
+    public function tree()
+    {
+        $result = $this->service->getTree();
+        return message(1002,true, $result);
+    }
+
+    /**
+     * 获取推荐人
+     * @return mixed
+     */
+    public function parents(){
+        $result = $this->service->parents();
+        return message(1002,true, $result);
+    }
+
+    /**
+     * 选项列表
+     * @return mixed
+     */
+    public function options(){
+        $result = $this->service->options();
+        return message(1002,true, $result);
+    }
+
+    /**
+     * 冻结解冻
+     * @return mixed
+     */
+    public function lock(){
+        $params = request()->post();
+        if($result = MemberService::make()->lock($params)){
+            return message(MemberService::make()->getError(),true, $result);
+        }else{
+            return message(MemberService::make()->getError(),false);
+        }
+    }
+}

+ 49 - 0
app/Http/Controllers/Admin/MemberLevelController.php

@@ -0,0 +1,49 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\MemberLevelService;
+
+/**
+ * 会员等级-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class MemberLevelController
+ * @package App\Http\Controllers
+ */
+class MemberLevelController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * MemberLevelController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new MemberLevelService();
+    }
+
+    /**
+     * 获取会员等级列表
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function getMemberLevelList()
+    {
+        $result = $this->service->getMemberLevelList();
+        return $result;
+    }
+
+}

+ 36 - 0
app/Http/Controllers/Admin/MenuController.php

@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\MenuService;
+
+/**
+ * 菜单管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class MenuController
+ * @package App\Http\Controllers
+ */
+class MenuController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * MenuController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new MenuService();
+    }
+}

+ 49 - 0
app/Http/Controllers/Admin/NoticeController.php

@@ -0,0 +1,49 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\NoticeService;
+
+/**
+ * 通知公告-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class NoticeController
+ * @package App\Http\Controllers
+ */
+class NoticeController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * NoticeController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new NoticeService();
+    }
+
+    /**
+     * 设置置顶
+     * @return mixed
+     * @since 2020/11/21
+     * @author laravel开发员
+     */
+    public function setIsTop()
+    {
+        $result = $this->service->setIsTop();
+        return $result;
+    }
+
+}

+ 67 - 0
app/Http/Controllers/Admin/PledgeOrderController.php

@@ -0,0 +1,67 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\PledgeOrderService;
+
+/**
+ * 质押订单管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class PledgeOrderController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new PledgeOrderService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+    /**
+     * 统计
+     * @return array
+     */
+    public function count()
+    {
+        $datas = $this->service->count(request()->all());
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => $datas,
+        );
+        return $message;
+    }
+}

+ 49 - 0
app/Http/Controllers/Admin/PositionController.php

@@ -0,0 +1,49 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\PositionService;
+
+/**
+ * 岗位管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class PositionController
+ * @package App\Http\Controllers
+ */
+class PositionController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * PositionController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new PositionService();
+    }
+
+    /**
+     * 获取岗位列表
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function getPositionList()
+    {
+        $result = $this->service->getPositionList();
+        return $result;
+    }
+
+}

+ 53 - 0
app/Http/Controllers/Admin/PriceLogController.php

@@ -0,0 +1,53 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\PriceLogService;
+
+/**
+ * SBT价格记录管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class PriceLogController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new PriceLogService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+}

+ 82 - 0
app/Http/Controllers/Admin/RechargeController.php

@@ -0,0 +1,82 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\AccountService;
+use App\Services\Common\BalanceLogService;
+
+/**
+ * 充值管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class RechargeController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new  BalanceLogService();
+    }
+
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 10);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+    /**
+     * 统计
+     * @return array
+     */
+    public function count()
+    {
+        $datas = $this->service->count(request()->all());
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => $datas,
+        );
+        return $message;
+    }
+
+
+    /**
+     * 审核
+     * @return mixed
+     */
+    public function auth(){
+        $params = request()->post();
+        if(!$result = BalanceLogService::make()->rechargeAuth($params)){
+            return showJson(BalanceLogService::make()->getError(), false);
+        }else{
+            return showJson(BalanceLogService::make()->getError(), true);
+        }
+    }
+}

+ 72 - 0
app/Http/Controllers/Admin/RoleController.php

@@ -0,0 +1,72 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\RoleService;
+
+/**
+ * 角色管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class RoleController
+ * @package App\Http\Controllers
+ */
+class RoleController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * RoleController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new RoleService();
+    }
+
+    /**
+     * 获取角色列表
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function getRoleList()
+    {
+        $result = $this->service->getRoleList();
+        return $result;
+    }
+
+    /**
+     * 获取角色权限列表
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function getPermissionList()
+    {
+        $result = $this->service->getPermissionList();
+        return $result;
+    }
+
+    /**
+     * 保存权限
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function savePermission()
+    {
+        $result = $this->service->savePermission();
+        return $result;
+    }
+
+}

+ 109 - 0
app/Http/Controllers/Admin/UploadController.php

@@ -0,0 +1,109 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use Illuminate\Http\Request;
+
+/**
+ * 上传文件-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class UploadController
+ * @package App\Http\Controllers
+ */
+class UploadController extends Backend
+{
+
+    /**
+     * 上传图片
+     * @param Request $request 网络请求
+     * @return array
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function uploadImage(Request $request)
+    {
+        // 上传单图统一调取方法
+        $result = upload_image($request, 'file');
+        if (!$result['success']) {
+            return message($result['message'], false);
+        }
+
+        // 文件路径
+        $file_path = $result['data']['img_path'];
+        if (!$file_path) {
+            return message("文件上传失败", false);
+        }
+
+        // 网络域名拼接
+        if ($file_path && strpos($file_path, IMG_URL) === false) {
+            $file_path = get_image_url($file_path, false);
+        }
+
+        // 返回结果
+        return message(MESSAGE_OK, true, ['url'=> $file_path, 'path'=> $result['data']['img_path']]);
+    }
+
+    /**
+     * 上传文件(单个上传)
+     * @param Request $request
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function uploadFile(Request $request)
+    {
+        $result = upload_file($request);
+        if (!$result['success']) {
+            return message(MESSAGE_FAILED, false, $result['message']);
+        }
+        // 文件路径
+        $file_path = $result['data']['file_path'];
+        if (!$file_path) {
+            return message("文件上传失败");
+        }
+
+        // 网络域名拼接
+        if ($file_path && strpos($file_path, IMG_URL) === false) {
+            $file_path = get_image_url($file_path, false);
+        }
+
+        // 返回结果
+        return message(MESSAGE_OK, true, ['url'=> $file_path, 'path'=> $result['data']['file_path']]);
+    }
+
+    /**
+     * 图片上传
+     * @return array
+     */
+    public function uploadBase64()
+    {
+        $base64 = request()->post('base64','');
+        $uuid = request()->post('uuid', '');
+        if ($base64) {
+            $fileDir =  ATTACHMENT_PATH . '/images/base64/' . date('Ymd');
+
+            // 检测文件路径是否存在,不存在则创建
+            if (!file_exists($fileDir)) {
+                mkdir($fileDir, 0777, true);
+            }
+            $fileName = 'image_'.md5($uuid? $uuid : $base64) . '.jpeg';
+            $base64 = str_replace('data:image/jpeg;base64,','',$base64);
+            file_put_contents($fileDir.'/'.$fileName, base64_decode($base64));
+            if(file_exists($fileDir.'/'.$fileName)){
+                $filePath = str_replace(ATTACHMENT_PATH, '', $fileDir) . '/' . $fileName;
+                return message(MESSAGE_OK, true, ['url'=>get_image_url($filePath, false),'path'=>$filePath]);
+            }
+        }
+
+        return message(MESSAGE_FAILED, false);
+    }
+}

+ 48 - 0
app/Http/Controllers/Admin/UserController.php

@@ -0,0 +1,48 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\UserService;
+
+/**
+ * 用户管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class UserController
+ * @package App\Http\Controllers
+ */
+class UserController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * UserController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new UserService();
+    }
+
+    /**
+     * 重置密码
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function resetPwd()
+    {
+        $result = $this->service->resetPwd();
+        return $result;
+    }
+}

+ 65 - 0
app/Http/Controllers/Admin/WalletController.php

@@ -0,0 +1,65 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\WalletService;
+
+/**
+ * 平台钱包管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class WalletController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new WalletService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+    /**
+     * 添加或编辑
+     * @return mixed
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function update()
+    {
+        $result = $this->service->update();
+        return $result;
+    }
+
+}

+ 53 - 0
app/Http/Controllers/Admin/WalletLogController.php

@@ -0,0 +1,53 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+
+use App\Services\Common\WalletLogService;
+
+/**
+ * 钱包流水管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class WalletLogController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new WalletLogService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 15);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+}

+ 95 - 0
app/Http/Controllers/Admin/WithdrawController.php

@@ -0,0 +1,95 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\BalanceLogService;
+
+/**
+ * 提现管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Http\Controllers
+ */
+class WithdrawController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new  BalanceLogService();
+    }
+
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 10);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list'])? $list['list']:[],
+            "count" => isset($list['total'])? $list['total']:0,
+        );
+        return $message;
+    }
+
+    /**
+     * 统计
+     * @return array
+     */
+    public function count()
+    {
+        $datas = $this->service->count(request()->all());
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => $datas,
+        );
+        return $message;
+    }
+
+    /**
+     * 统计
+     * @return array
+     */
+    public function checkCount()
+    {
+        $data = $this->service->checkCount();
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => $data,
+        );
+        return $message;
+    }
+
+    /**
+     * 审核
+     * @return mixed
+     */
+    public function auth(){
+        $params = request()->post();
+        if(!$result = BalanceLogService::make()->withdrawAuth($params)){
+            return showJson(BalanceLogService::make()->getError(), false);
+        }else{
+            return showJson(BalanceLogService::make()->getError(), true);
+        }
+    }
+}

+ 26 - 0
app/Http/Controllers/Api/LangController.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+use App\Services\RedisService;
+
+/**
+ * 语言控制器基类
+ * Class LangController
+ * @package App\Http\Controllers\Api
+ */
+class LangController extends webApp
+{
+    /**
+     * 切换语言
+     * @return array
+     */
+    public function switch(){
+        $locale = request()->get('locale');
+        if(empty($locale)){
+            return message('2101',false);
+        }
+        RedisService::set("caches:locale:lang_{$this->userId}", $locale, 24 * 3600);
+        session('lang_locale', $locale);
+        return message(2102);
+    }
+}

+ 39 - 0
app/Http/Controllers/Api/LoginController.php

@@ -0,0 +1,39 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+use App\Services\Api\MemberService;
+use App\Services\RedisService;
+
+/**
+ * 授权登录控制器基类
+ * Class LoginController
+ * @package App\Http\Controllers
+ */
+class LoginController extends webApp
+{
+    /**
+     * 用户登录
+     * @return array
+     */
+    public function dapp(){
+        $walletUrl = request()->post('wallet_url','');
+        try {
+            $scode = request()->post('scode','');
+            if(empty($walletUrl)){
+                return showJson('钱包授权失败',false);
+            }
+
+            // 钱包账号登录
+            if($result = MemberService::make()->loginOrRegister($walletUrl, $scode)){
+                return showJson(2004, true, $result);
+            }else{
+                $code = MemberService::make()->getError();
+                return showJson($code, false,'',$code==2015? 403: 0);
+            }
+        }catch (\Exception $exception){
+            RedisService::set("caches:login:{$walletUrl}", ['error'=>$exception->getMessage(),'line'=>$exception->getLine(),'data'=>$exception->getTrace()],600);
+            return showJson(1018, false);
+        }
+    }
+}

+ 22 - 0
app/Http/Controllers/Api/TestController.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+use App\Services\RedisService;
+use Illuminate\Http\Request;
+use QL\QueryList;
+
+/**
+ * 测试
+ * Class TestController
+ * @package App\Http\Controllers\Api
+ */
+class TestController extends webApp
+{
+
+    public function check()
+    {
+        
+        return message('获取结果');
+    }
+}

+ 81 - 0
app/Http/Controllers/Api/UploadController.php

@@ -0,0 +1,81 @@
+<?php
+// +----------------------------------------------------------------------
+// | Laravel框架 [ Laravel ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 Laravel研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: wesmiler <12345678@qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Api;
+
+use Illuminate\Http\Request;
+
+/**
+ * 上传文件-控制器
+ * @since 2020/11/11
+ * Class UploadController
+ * @package App\Http\Controllers
+ */
+class UploadController extends webApp
+{
+
+    /**
+     * 上传图片
+     * @param Request $request 网络请求
+     * @return array
+     * @since 2020/11/11
+     */
+    public function uploadImage(Request $request)
+    {
+
+        // 上传单图统一调取方法
+        $result = upload_image($request, 'file', '',$this->userId);
+        if (!$result['success']) {
+            return showJson($result['msg'], false, '');
+        }
+
+        // 文件路径
+        $file_path = $result['data']['img_path'];
+        if (!$file_path) {
+            return showJson('文件上传失败', false, '');
+        }
+
+        // 网络域名拼接
+        if ($file_path && strpos($file_path, IMG_URL) === false) {
+            $file_path = get_image_url($file_path, false);
+        }
+
+        // 返回结果
+        return showJson(MESSAGE_OK, true, ['url'=> $file_path, 'path'=> $result['data']['img_path']]);
+    }
+
+    /**
+     * 上传文件(单个上传)
+     * @param Request $request
+     * @since 2020/11/11
+     */
+    public function uploadFile(Request $request)
+    {
+        $result = upload_file($request,'file','', $this->userId);
+        if (!$result['success']) {
+            return showJson($result['msg'], false, '');
+        }
+        // 文件路径
+        $file_path = isset($result['data']['file_path'])? $result['data']['file_path'] : '';
+        if (!$file_path) {
+            return showJson("文件上传失败",false);
+        }
+
+        // 网络域名拼接
+        if (strpos($file_path, IMG_URL) === false) {
+            $file_path = get_image_url($file_path, false);
+        }
+
+        // 返回结果
+        return showJson(MESSAGE_OK, true, ['url'=> $file_path, 'path'=> $result['data']['img_path']]);
+    }
+
+}

+ 58 - 0
app/Http/Controllers/Api/v1/AccountController.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+use App\Services\Api\AccountLogService;
+use App\Services\Api\BalanceLogService;
+use App\Services\Api\PledgeOrderService;
+use App\Services\WalletService;
+
+/**
+ * 账户
+ * @package App\Http\Controllers\Api\v1
+ */
+class AccountController extends webApp
+{
+
+    /**
+     * 获取账户/账单/质押明细
+     * @return array|mixed
+     */
+    public function index()
+    {
+        $dataType = request()->post('dataType', 1);
+        $coinType = request()->post('coin_type', 0);
+        $type = request()->post('type', 0);
+        $page = request()->post('page', 1);
+        $pageSize = request()->post('pageSize', 12);
+        switch ($dataType){
+            case 1:
+                $datas = AccountLogService::make()->getDataList($this->userId, $coinType, $type, $page, $pageSize);
+                break;
+            case 2:
+                $datas = BalanceLogService::make()->getDataList($this->userId, 2, $page, $pageSize);
+                break;
+            case 3:
+                $datas = PledgeOrderService::make()->getDataList($this->userId, $page, $pageSize);
+                break;
+            default:
+                return showJson(1021, false);
+        }
+
+        return showJson(1010, true, $datas);
+    }
+
+    /**
+     * 账户USDT余额
+     * @return array
+     */
+    public function data()
+    {
+        $address = request()->post('address', '');
+        if(empty($address)){
+            return showJson(2209,false);
+        }
+        return showJson(1010, true, WalletService::make()->getUsdtBalance($address,true));
+    }
+}

+ 49 - 0
app/Http/Controllers/Api/v1/ArticleController.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+use App\Services\Api\ArticleService;
+
+/**
+ * 文章资讯
+ * @package App\Http\Controllers\Api\v1
+ */
+class ArticleController extends webApp
+{
+    /**
+     * 信息
+     * @return array
+     */
+    public function info()
+    {
+        $id = request()->post('id', 0);
+        try {
+            if($info = ArticleService::make()->getInfo($id, $this->userId)){
+                return showJson(1010, true, $info);
+            }else{
+                return showJson(1009,false,'',403);
+            }
+        } catch (\Exception $exception){
+            return showJson(1036,false,['error'=>$exception->getMessage()]);
+        }
+    }
+
+    /**
+     * 列表
+     * @return array|mixed
+     */
+    public function index()
+    {
+        $params = request()->post();
+        try {
+            if($datas = ArticleService::make()->getDataList($params, $this->userId)){
+                return showJson(1010, true, $datas);
+            }else{
+                return showJson(1009,false,'',403);
+            }
+        } catch (\Exception $exception){
+            return showJson(1041,false,['error'=>$exception->getMessage()]);
+        }
+    }
+}

+ 63 - 0
app/Http/Controllers/Api/v1/IndexController.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+use App\Services\Api\PledgeOrderService;
+use App\Services\Api\PriceLogService;
+use App\Services\Common\AdService;
+use App\Services\ConfigService;
+use App\Services\RedisService;
+
+/**
+ * 首页
+ * @package App\Http\Controllers\Api\v1
+ */
+class IndexController extends webApp
+{
+    /**
+     * 首页数据
+     * @return array
+     */
+    public function data()
+    {
+        $cacheKey = "caches:index:data";
+        $data = RedisService::get($cacheKey);
+        if(empty($data)) {
+            $sbtLimit = ConfigService::make()->getConfigByCode('sbt_exchange_limit', 100);
+            $sbtPrice = PriceLogService::make()->getSbtPrice();
+            $sbtLimit = round($sbtLimit/$sbtPrice, 2);
+            $sbtLimit = $sbtLimit>0? $sbtLimit : 0;
+            $data = [
+                'sbtData' => PriceLogService::make()->getCounts(1),
+                'banners' => [
+                    'zh' =>  AdService::make()->getListByType(1,'zh',6),
+                    'en' => AdService::make()->getListByType(1,'en',6)
+                ],
+                'siteInfo' => [
+                    'site_name' => ConfigService::make()->getConfigByCode('site_name', 'SBT'),
+                    'site_title' => ConfigService::make()->getConfigByCode('site_name', 'SBT'),
+                    'logo' => get_image_url(ConfigService::make()->getConfigByCode('site_logo', '/images/logo.png')),
+                    'exchange_sbt_fee' => ConfigService::make()->getConfigByCode('exchange_sbt_fee', 0),
+                    'sbt_exchange_limit'=> $sbtLimit,
+                    'version'=> ConfigService::make()->getConfigByCode('app_version', 'v1.2.10'),
+                ],
+            ];
+
+            RedisService::set($cacheKey, $data, rand(30, 60));
+        }
+
+        $data['pledgeCounts'] = PledgeOrderService::make()->getCountByUser($this->userId);
+        return showJson(1010,true, $data);
+    }
+
+    /**
+     * SBD价格数据
+     * @return array
+     */
+    public function priceData(){
+        $dateType = request()->post('type', 1);
+        $refresh = request()->post('refresh', 0);
+        return showJson(1010,true, PriceLogService::make()->getCounts($dateType, $refresh));
+    }
+}

+ 114 - 0
app/Http/Controllers/Api/v1/MemberController.php

@@ -0,0 +1,114 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+use App\Services\Api\MemberService;
+use function Psy\sh;
+
+/**
+ * 会员
+ * @package App\Http\Controllers\Api\v1
+ */
+class MemberController extends webApp
+{
+
+    /**
+     * 用户信息
+     * @return array|mixed
+     */
+    public function info()
+    {
+        try {
+            $type = request()->post('type', 1);
+            $refresh = request()->post('refresh', false);
+            if($info = MemberService::make()->getInfo($this->userId, $type, $refresh)){
+                return showJson(1010, true, $info);
+            }else{
+                return showJson(1009,false,'',403);
+            }
+        } catch (\Exception $exception){
+            return showJson(1036,false,['error'=>$exception->getMessage()],403);
+        }
+    }
+
+    /**
+     * 修改资料
+     * @return array
+     */
+    public function setProfile()
+    {
+        $params = request()->post();
+        if($info = MemberService::make()->setProfile($this->userId, $params)){
+            return showJson(MemberService::make()->getError(), true, $info);
+        }else{
+            return showJson(MemberService::make()->getError(),false);
+        }
+    }
+
+    /**
+     * 设置分红比例
+     * @return array
+     */
+    public function setBonus()
+    {
+        $params = request()->all();
+        if($info = MemberService::make()->setBonus($this->userId, $params)){
+            return showJson(MemberService::make()->getError(), true, $info);
+        }else{
+            return showJson(MemberService::make()->getError(),false, MemberService::make()->getErrorData());
+        }
+    }
+
+    /**
+     * 设置自动质押
+     * @return array
+     */
+    public function setPledge()
+    {
+        $params = request()->all();
+        if($info = MemberService::make()->setPledge($this->userId, $params)){
+            return showJson(MemberService::make()->getError(), true, $info);
+        }else{
+            return showJson(MemberService::make()->getError(),false);
+        }
+    }
+
+    /**
+     * 充值
+     * @return array
+     */
+    public function recharge()
+    {
+        return showJson(1009,false,'',403);
+    }
+
+    /**
+     * 提现
+     * @return array
+     */
+    public function withdraw()
+    {
+        $params = request()->post();
+        if($result = MemberService::make()->withdraw($this->userId, $params)){
+            return showJson(2027, true, $result);
+        }else{
+            return showJson(MemberService::make()->getError(),false, MemberService::make()->getErrorData());
+        }
+    }
+
+    /**
+     * 闪兑
+     * @return array
+     */
+    public function exchange()
+    {
+        $params = request()->post();
+        if($result = MemberService::make()->exchange($this->userId, $params)){
+            return showJson(2105, true, $result);
+        }else{
+            return showJson(MemberService::make()->getError(),false, MemberService::make()->getErrorData());
+        }
+    }
+
+}

+ 32 - 0
app/Http/Controllers/Api/v1/NotifyController.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+use App\Services\CregisPayService;
+
+/**
+ * 钱包回调处理
+ * Class NotifyController
+ * @package App\Http\Controllers\Api\v1
+ */
+class NotifyController extends webApp
+{
+    /**
+     * 提现回调
+     * @return string
+     */
+    public function cregisCallback()
+    {
+        return CregisPayService::make()->withdrawCallBack();
+    }
+
+    /**
+     * 充值回调
+     * @return string
+     */
+    public function rechargeCallback()
+    {
+        return CregisPayService::make()->rechargeCallBack();
+    }
+}

+ 18 - 0
app/Http/Controllers/Api/v1/PledgeOrderController.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+
+/**
+ * 质押订单
+ * @package App\Http\Controllers\Api\v1
+ */
+class PledgeOrderController extends webApp
+{
+
+    public function check()
+    {
+        return message('获取结果');
+    }
+}

+ 51 - 0
app/Http/Controllers/Api/v1/TeamController.php

@@ -0,0 +1,51 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+use App\Services\Api\TeamService;
+
+/**
+ * 团队
+ * @package App\Http\Controllers\Api\v1
+ */
+class TeamController extends webApp
+{
+    /**
+     * 团队信息
+     * @return array
+     */
+    public function data()
+    {
+        $type = request()->post('type', 1);
+        try {
+            if($info = TeamService::make()->getInfo($this->userId, $type)){
+                return showJson(1010, true, $info);
+            }else{
+                return showJson(1009,false,'',403);
+            }
+        } catch (\Exception $exception){
+            return showJson(1036,false,['error'=>$exception->getMessage()]);
+        }
+    }
+
+    /**
+     * 团队列表
+     * @return array|mixed
+     */
+    public function index()
+    {
+        $page = request()->post('page', 1);
+        $pageSize = request()->post('pageSize', 10);
+        $userId = request()->post('user_id', 0);
+        try {
+            if($datas = TeamService::make()->getDataList($userId? $userId : $this->userId, $page, $pageSize)){
+                return showJson(1010, true, $datas);
+            }else{
+                return showJson(1009,false,'',403);
+            }
+        } catch (\Exception $exception){
+            return showJson(1041,false,['error'=>$exception->getMessage()]);
+        }
+    }
+}

+ 71 - 0
app/Http/Controllers/Api/v1/TestController.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+use App\Models\MemberModel;
+use App\Models\PledgeOrderModel;
+use App\Services\Api\FinanceService;
+use App\Services\Api\MemberService;
+use App\Services\Api\PledgeOrderService;
+use App\Services\Api\PriceLogService;
+use App\Services\Common\InstitutionalService;
+use App\Services\ConfigService;
+use App\Services\CregisPayService;
+use App\Services\WalletService;
+use Earnp\GoogleAuthenticator\GoogleAuthenticator;
+
+/**
+ * 测试
+ * Class TestController
+ * @package App\Http\Controllers\Api\v1
+ */
+class TestController extends webApp
+{
+
+    public function check()
+    {
+//        $order = PledgeOrderModel::where(['id'=>29])->first();
+//        $result = FinanceService::make()->settleShareAward(10042,'10001,10034,10035,10036,10037,10038,10039,10040,',$order);
+//        var_dump(make_wallet_token('58YsXE527EojowwqSFDV1V7tCWUGVFbEqnD1f3TUUALQ',10001));
+//        $result = CregisPayService::make()->withdraw('58YsXE527EojowwqSFDV1V7tCWUGVFbEqnD1f3TUUALQ', 1, 'TS2024080201010234', '1000', '', '测试');
+//        $result = FinanceService::make()->developerSettle(1,'FD3JJToc92rxabSuuYWEqttEtDj9wwQFz79mCtPixHtL');
+//        $result = MemberService::make()->upgradeUpdate(11056);
+//        var_dump($result);
+//        var_dump(lang(FinanceService::make()->getError()));
+//        $result = CregisPayService::make()->withdraw('58YsXE527EojowwqSFDV1V7tCWUGVFbEqnD1f3TUUALQ',1,'TS'.date('YmdHis'),1000);
+//        $result = MemberService::make()->pledgeUserList();
+//        $result = PledgeOrderService::make()->orderSettle(4,'PD20240729105659045786',10023);
+//        var_dump($result);
+//
+//        $userInfo = MemberModel::where(['id'=> 13300])->first()->toArray();
+//        $result = PledgeOrderService::make()->autoMakeOrder($userInfo);
+//        var_dump($result);
+//        var_dump(lang(PledgeOrderService::make()->getError()));
+//        var_dump($userInfo);
+        $sbtPrice = PriceLogService::make()->getSbtPrice();
+        $sbtUsdtFee = ConfigService::make()->getConfigByCode('pledge_sbt_usdt_fee', 0);
+        $sbtUsdtFee = $sbtUsdtFee > 0 ? floatval($sbtUsdtFee) : 0;
+        $sbtFee = $sbtUsdtFee && $sbtPrice > 0 ? moneyFormat($sbtUsdtFee / $sbtPrice, 2) : 0;
+        var_dump($sbtFee);
+//          $result = MemberService::make()->pledgeUserList();
+//        $result = [];
+        return message('获取结果', true, $sbtFee);
+    }
+
+    /**
+     * SBT价格更新测试
+     * @return array
+     */
+    public function sbtPrice()
+    {
+//        $sdate = '2024-07-10';
+//        for($i = 1; $i <=11; $i++){
+//            $date = date('Y-m-d', strtotime($sdate)  + $i * 86400);
+//            $result = PriceLogService::make()->updateSbtPrice($date);
+//            var_dump($result);
+//        }
+
+        return message('获取结果');
+    }
+}

+ 177 - 0
app/Http/Controllers/Api/webApp.php

@@ -0,0 +1,177 @@
+<?php
+// +----------------------------------------------------------------------
+// | Laravel框架 [ Laravel ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 Laravel研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: wesmiler <12345678@qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Api;
+
+use App\Helpers\Jwt;
+use App\Http\Controllers\BaseController;
+use App\Models\MemberModel;
+use App\Services\ConfigService;
+use App\Services\RedisService;
+use Illuminate\Support\Facades\DB;
+
+/**
+ * 控制器基类
+ * @since 2020/11/10
+ * Class BaseController
+ * @package App\Http\Controllers
+ */
+class webApp extends BaseController
+{
+    // 模型
+    protected $model;
+    // 服务
+    protected $service;
+    // 校验
+    protected $validate;
+    // 登录ID
+    protected $userId = 0;
+
+    // 司机ID
+    protected $driverId = 0;
+
+    // 登录信息
+    protected $userInfo = [];
+
+    /**
+     * 构造函数
+     * @author wesmiler
+     * @since 2020/11/10
+     * Backend constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+
+        // 初始化分页参数
+        $this->initConfig();
+
+        // 登录检测中间件
+        $this->middleware('api.sign');
+
+
+        // 初始化登录信息
+        $this->middleware(function ($request, $next) {
+            // 授权用户数据
+            $userId = $request->headers->get('token_uid');
+            $userId = $userId? $userId : 0;
+            // 登录验证
+            $userInfo = RedisService::get("caches:auths:info:{$userId}");
+            if(empty($userInfo) && $userId){
+                $this->initLogin($userId);
+            }else{
+                $this->userId = $userId;
+                $this->userInfo = $userInfo;
+            }
+
+            return $next($request);
+        });
+    }
+
+    /**
+     * 初始化配置
+     * @author laravel开发员
+     * @since 2020/11/10
+     */
+    public function initConfig()
+    {
+        // 请求参数
+        $this->param = \request()->input();
+
+        // 分页基础默认值
+        defined('PERPAGE') or define('PERPAGE', isset($this->param['limit']) ? $this->param['limit'] : 20);
+        defined('PAGE') or define('PAGE', isset($this->param['page']) ? $this->param['page'] : 1);
+    }
+
+    /**
+     * 登录验证
+     * @param $userId 用户ID
+     * @return
+     * @author wesmiler
+     * @since 2020/8/31
+     */
+    public function initLogin($userId)
+    {
+        // 登录用户ID
+        $this->userId = $userId;
+
+        // 登录用户信息
+        if ($userId) {
+            $memberModel = new MemberModel();
+            $userInfo = $memberModel->getInfo($this->userId);
+            $this->userInfo = $userInfo;
+            RedisService::set("caches:auths:info:{$userId}", $this->userInfo, 7*24*3600);
+        }
+
+    }
+
+
+    /**
+     * 获取数据列表
+     * @return mixed
+     * @since 2020/11/11
+     * @author wesmiler
+     */
+    public function index()
+    {
+        $result = $this->service->getList();
+        return $result;
+    }
+
+    /**
+     * 获取数据详情
+     * @return mixed
+     * @since 2020/11/11
+     * @author wesmiler
+     */
+    public function info()
+    {
+        $result = $this->service->info();
+        return $result;
+    }
+
+    /**
+     * 添加或编辑
+     * @return mixed
+     * @since 2020/11/11
+     * @author wesmiler
+     */
+    public function edit()
+    {
+        $result = $this->service->edit();
+        return $result;
+    }
+
+    /**
+     * 删除数据
+     * @return mixed
+     * @since 2020/11/11
+     * @author wesmiler
+     */
+    public function delete()
+    {
+        $result = $this->service->delete();
+        return $result;
+    }
+
+    /**
+     * 设置状态
+     * @return mixed
+     * @since 2020/11/21
+     * @author wesmiler
+     */
+    public function status()
+    {
+        $result = $this->service->status();
+        return $result;
+    }
+
+}

+ 97 - 0
app/Http/Controllers/BaseController.php

@@ -0,0 +1,97 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers;
+use Illuminate\Support\Facades\DB;
+
+/**
+ * 控制器基类
+ */
+class BaseController extends \Illuminate\Routing\Controller
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/10
+     * BaseController constructor.
+     */
+    public function __construct()
+    {
+        // 初始化网络请求配置
+        $this->initRequestConfig();
+
+        // 初始化系统常量
+        $this->initSystemConst();
+    }
+
+    /**
+     * 初始化请求配置
+     * @since 2020/11/10
+     * @author laravel开发员
+     */
+    private function initRequestConfig()
+    {
+        // 定义是否GET请求
+        defined('IS_GET') or define('IS_GET', \request()->isMethod('GET'));
+
+        // 定义是否POST请求
+        defined('IS_POST') or define('IS_POST', \request()->isMethod('POST'));
+
+        // 定义是否AJAX请求
+        defined('IS_AJAX') or define('IS_AJAX', \request()->ajax());
+
+        // 定义是否PAJAX请求
+        defined('IS_PJAX') or define('IS_PJAX', \request()->pjax());
+
+        // 定义是否PUT请求
+        defined('IS_PUT') or define('IS_PUT', \request()->isMethod('PUT'));
+
+        // 定义是否DELETE请求
+        defined('IS_DELETE') or define('IS_DELETE', \request()->isMethod('DELETE'));
+
+        // 请求方式
+        defined('REQUEST_METHOD') or define('REQUEST_METHOD', \request()->method());
+    }
+
+    /**
+     * 初始化系统常量
+     * @author laravel开发员
+     * @since 2020/11/10
+     */
+    private function initSystemConst()
+    {
+        // 项目根目录
+        defined('ROOT_PATH') or define('ROOT_PATH', base_path());
+
+        // 文件上传目录
+        defined('ATTACHMENT_PATH') or define('ATTACHMENT_PATH', base_path('public/uploads'));
+
+        // 图片上传目录
+        defined('IMG_PATH') or define('IMG_PATH', base_path('public/uploads/images'));
+
+        // 临时存放目录
+        defined('UPLOAD_TEMP_PATH') or define('UPLOAD_TEMP_PATH', ATTACHMENT_PATH . "/temp");
+
+        // 定义普通图片域名
+        defined('IMG_URL') or define('IMG_URL', env('IMG_URL'));
+
+        // 数据表前缀
+        defined('DB_PREFIX') or define('DB_PREFIX', DB::connection()->getTablePrefix());
+
+        // 系统全称
+        define('SITE_NAME', env('SITE_NAME'));
+        // 系统简称
+        define('NICK_NAME', env('NICK_NAME'));
+        // 系统版本号
+        define('VERSION', env('VERSION'));
+    }
+
+}

+ 69 - 0
app/Http/Kernel.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace App\Http;
+
+use App\Http\Middleware\EnableCrossRequestMiddleware;
+use Illuminate\Foundation\Http\Kernel as HttpKernel;
+
+class Kernel extends HttpKernel
+{
+    /**
+     * The application's global HTTP middleware stack.
+     *
+     * These middleware are run during every request to your application.
+     *
+     * @var array
+     */
+    protected $middleware = [
+        // \App\Http\Middleware\TrustHosts::class,
+        \App\Http\Middleware\TrustProxies::class,
+        \Fruitcake\Cors\HandleCors::class,
+        \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
+        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
+        \App\Http\Middleware\TrimStrings::class,
+        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
+        \App\Http\Middleware\EnableCrossRequestMiddleware::class,
+    ];
+
+    /**
+     * The application's route middleware groups.
+     *
+     * @var array
+     */
+    protected $middlewareGroups = [
+        'web' => [
+            \App\Http\Middleware\EncryptCookies::class,
+            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
+            \Illuminate\Session\Middleware\StartSession::class,
+            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
+            \Illuminate\Routing\Middleware\SubstituteBindings::class,
+        ],
+
+        'api' => [
+            \Illuminate\Routing\Middleware\SubstituteBindings::class,
+            \Illuminate\Session\Middleware\StartSession::class,
+        ],
+    ];
+
+    /**
+     * The application's route middleware.
+     *
+     * These middleware may be assigned to groups or used individually.
+     *
+     * @var array
+     */
+    protected $routeMiddleware = [
+        'auth' => \App\Http\Middleware\Authenticate::class,
+        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
+        'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
+        'can' => \Illuminate\Auth\Middleware\Authorize::class,
+        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
+        'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
+        'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
+        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
+        'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
+        'user.login' => \App\Http\Middleware\UserLogin::class,
+        'web.login' => \App\Http\Middleware\WebLogin::class,
+        'api.sign' => \App\Http\Middleware\ApiSign::class,
+    ];
+}

+ 24 - 0
app/Http/Middleware/ActionLog.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use App\Models\ActionLogModel;
+use Closure;
+
+class ActionLog
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param \Illuminate\Http\Request $request
+     * @param \Closure $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        if ($request->isMethod('post')) {
+            ActionLogModel::record();
+        }
+        return $next($request);
+    }
+}

+ 36 - 0
app/Http/Middleware/ApiSign.php

@@ -0,0 +1,36 @@
+<?php
+
+
+namespace App\Http\Middleware;
+use Closure;
+use Illuminate\Auth\Middleware\Authenticate as Middleware;
+
+class ApiSign extends Middleware
+{
+    /**
+     * 执行句柄
+     * @param \Illuminate\Http\Request $request
+     * @param Closure $next
+     * @param mixed ...$guards
+     * @return mixed
+     * @throws \Illuminate\Auth\AuthenticationException
+     * @since 2020/8/31
+     * @author wesmiler
+     */
+    public function handle($request, Closure $next, ...$guards)
+    {
+        // 接口验证
+        $params = $request->except('s');
+        $key = $request->header('sign');
+        if(empty($key)){
+            $key = isset($params['key'])? $params['key'] : '';
+        }
+        if($key){
+            $data = api_decrypt($key);
+            $request->merge($data!=NULL && !empty($data)?$data: []);
+        }
+
+        //如果已登录则执行正常的请求
+        return $next($request);
+    }
+}

+ 21 - 0
app/Http/Middleware/Authenticate.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Illuminate\Auth\Middleware\Authenticate as Middleware;
+
+class Authenticate extends Middleware
+{
+    /**
+     * Get the path the user should be redirected to when they are not authenticated.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return string|null
+     */
+    protected function redirectTo($request)
+    {
+        if (! $request->expectsJson()) {
+            return route('login');
+        }
+    }
+}

+ 54 - 0
app/Http/Middleware/EnableCrossRequestMiddleware.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Middleware;
+
+use Closure;
+use Illuminate\Http\Request;
+
+/**
+ * 跨域解决方案
+ * @author laravel开发员
+ * @since 2021/1/10
+ * Class EnableCrossRequestMiddleware
+ * @package App\Http\Middleware
+ */
+class EnableCrossRequestMiddleware
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param \Illuminate\Http\Request $request
+     * @param \Closure $next
+     * @return mixed
+     */
+    public function handle(Request $request, Closure $next)
+    {
+        $response = $next($request);
+        $origin = $request->server('HTTP_ORIGIN') ? $request->server('HTTP_ORIGIN') : '';
+        $allow_origin = [];
+        //if (empty($allow_origin) || in_array($origin, $allow_origin)) {
+        //允许所有资源跨域
+        $response->header('Access-Control-Allow-Origin', '*');
+        // 允许通过的响应报头
+        $response->header('Access-Control-Allow-Headers', 'Origin, Content-Type, Cookie, X-CSRF-TOKEN, Accept, Authorization, X-XSRF-TOKEN');
+        // 允许axios获取响应头中的Authorization
+        $response->header('Access-Control-Expose-Headers', 'Authorization, authenticated');
+        // 允许的请求方法
+        $response->header('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, OPTIONS, DELETE');
+        //允许的请求方法
+        $response->header('Allow', 'GET, POST, PATCH, PUT, OPTIONS, delete');
+        // 运行客户端携带证书式访问
+        $response->header('Access-Control-Allow-Credentials', 'true');
+        //}
+        return $response;
+    }
+}

+ 17 - 0
app/Http/Middleware/EncryptCookies.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
+
+class EncryptCookies extends Middleware
+{
+    /**
+     * The names of the cookies that should not be encrypted.
+     *
+     * @var array
+     */
+    protected $except = [
+        //
+    ];
+}

+ 17 - 0
app/Http/Middleware/PreventRequestsDuringMaintenance.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
+
+class PreventRequestsDuringMaintenance extends Middleware
+{
+    /**
+     * The URIs that should be reachable while maintenance mode is enabled.
+     *
+     * @var array
+     */
+    protected $except = [
+        //
+    ];
+}

+ 32 - 0
app/Http/Middleware/RedirectIfAuthenticated.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use App\Providers\RouteServiceProvider;
+use Closure;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+
+class RedirectIfAuthenticated
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @param  string|null  ...$guards
+     * @return mixed
+     */
+    public function handle(Request $request, Closure $next, ...$guards)
+    {
+        $guards = empty($guards) ? [null] : $guards;
+
+        foreach ($guards as $guard) {
+            if (Auth::guard($guard)->check()) {
+                return redirect(RouteServiceProvider::HOME);
+            }
+        }
+
+        return $next($request);
+    }
+}

+ 18 - 0
app/Http/Middleware/TrimStrings.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
+
+class TrimStrings extends Middleware
+{
+    /**
+     * The names of the attributes that should not be trimmed.
+     *
+     * @var array
+     */
+    protected $except = [
+        'password',
+        'password_confirmation',
+    ];
+}

+ 20 - 0
app/Http/Middleware/TrustHosts.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Illuminate\Http\Middleware\TrustHosts as Middleware;
+
+class TrustHosts extends Middleware
+{
+    /**
+     * Get the host patterns that should be trusted.
+     *
+     * @return array
+     */
+    public function hosts()
+    {
+        return [
+            $this->allSubdomainsOfApplicationUrl(),
+        ];
+    }
+}

+ 23 - 0
app/Http/Middleware/TrustProxies.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Fideloper\Proxy\TrustProxies as Middleware;
+use Illuminate\Http\Request;
+
+class TrustProxies extends Middleware
+{
+    /**
+     * The trusted proxies for this application.
+     *
+     * @var array|string|null
+     */
+    protected $proxies;
+
+    /**
+     * The headers that should be used to detect proxies.
+     *
+     * @var int
+     */
+    protected $headers = Request::HEADER_X_FORWARDED_ALL;
+}

+ 49 - 0
app/Http/Middleware/UserLogin.php

@@ -0,0 +1,49 @@
+<?php
+
+
+namespace App\Http\Middleware;
+
+use App\Helpers\Jwt;
+use App\Services\RedisService;
+use Closure;
+use Illuminate\Auth\Middleware\Authenticate as Middleware;
+
+class UserLogin extends Middleware
+{
+    /**
+     * 执行句柄
+     * @param \Illuminate\Http\Request $request
+     * @param Closure $next
+     * @param mixed ...$guards
+     * @return mixed
+     * @throws \Illuminate\Auth\AuthenticationException
+     * @since 2020/8/31
+     * @author laravel开发员
+     */
+    public function handle($request, Closure $next, ...$guards)
+    {
+        $response = $next($request);
+
+        $action = app('request')->route()->getAction();
+        $controller = class_basename($action['controller']);
+        list($controller, $action) = explode('@', $controller);
+        $noLoginActs = ['LoginController'];
+        $token = $request->headers->get('Authorization');
+        if (strpos($token, 'Bearer ') !== false) {
+            $token = str_replace("Bearer ", null, $token);
+            // JWT解密token
+            $jwt = new Jwt();
+            $userId = $jwt->verifyToken($token);
+        } else {
+            $userId = 0;
+        }
+
+        if (!$userId && !in_array($controller, $noLoginActs)) {
+            // 判断用户未登录就跳转至登录页面
+            // 在这里可以定制你想要的返回格式, 亦或者是 JSON 编码格式
+            return response()->json(message("请登录", false, null, 401));
+        }
+        //如果已登录则执行正常的请求
+        return $response;
+    }
+}

+ 17 - 0
app/Http/Middleware/VerifyCsrfToken.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
+
+class VerifyCsrfToken extends Middleware
+{
+    /**
+     * The URIs that should be excluded from CSRF verification.
+     *
+     * @var array
+     */
+    protected $except = [
+        //
+    ];
+}

+ 75 - 0
app/Http/Middleware/WebLogin.php

@@ -0,0 +1,75 @@
+<?php
+
+
+namespace App\Http\Middleware;
+
+use App\Helpers\Jwt;
+use App\Services\ConfigService;
+use Closure;
+use Illuminate\Auth\Middleware\Authenticate as Middleware;
+
+class WebLogin extends Middleware
+{
+    /**
+     * 执行句柄
+     * @param \Illuminate\Http\Request $request
+     * @param Closure $next
+     * @param mixed ...$guards
+     * @return mixed
+     * @throws \Illuminate\Auth\AuthenticationException
+     * @since 2020/8/31
+     * @author wesmiler
+     */
+    public function handle($request, Closure $next, ...$guards)
+    {
+        $action = app('request')->route()->getAction();
+        $controller = class_basename($action['controller']);
+        list($controller, $action) = explode('@', $controller);
+        $token = $request->headers->get('Authorization');
+        if (strpos($token, 'Bearer ') !== false) {
+            $token = str_replace("Bearer ", null, $token);
+            $token = trim($token);
+            if($token){
+                // JWT解密token
+                $jwt = new Jwt('jwt_rrc_app');
+                $userId = $jwt->verifyToken($token);
+            }else{
+                return response()->json(message(1035, false, [], 403))->setEncodingOptions(256);
+            }
+
+        } else {
+            $userId = 0;
+        }
+
+        // 接口验证
+        $params = $request->except('s');
+        $key = $request->header('sign');
+        if(empty($key)){
+            $key = isset($params['key'])? $params['key'] : '';
+        }
+        $data = api_decrypt($key);
+        $ctime = isset($data['ctime']) ? $data['ctime'] : 0;
+        if ($ctime>0 && $ctime < time() - 30) {
+            return response()->json(message(1012, false, null, 403))->setEncodingOptions(256);
+        }
+
+        // 站点升级检测返回
+        $isUpgrade = ConfigService::make()->getConfigByCode('dapp_upgrade',0);
+        if(intval($isUpgrade) == 1){
+            $updateDate = ConfigService::make()->getConfigByCode('dapp_upgrade_date',date('Y-m-d H:i',time() + 3600));
+            return response()->json(message(1037, false, ['date'=> $updateDate], 405))->setEncodingOptions(256);
+        }
+
+
+        // 接口加密验证
+        if ($userId<=0) {
+            // 在这里可以定制你想要的返回格式, 亦或者是 JSON 编码格式
+            return response()->json(message(1035, false, [], 403))->setEncodingOptions(256);
+        }
+
+        $request->headers->set('token_uid' , $userId);
+        $request->merge($data!=NULL && !empty($data)?$data: []);
+        //如果已登录则执行正常的请求
+        return $next($request);
+    }
+}

+ 50 - 0
app/Http/Validator/AccountValidator.php

@@ -0,0 +1,50 @@
+<?php
+namespace App\Http\Validator;
+class AccountValidator extends BaseValidator
+{
+    // 当前模型所有验证规则
+    public static $rules = [
+        'id' => 'required',
+        'user_id' => 'required|max:10',
+        'amount' => 'required|max:30',
+        'user_type' => 'required',
+        'coin_type' => 'required',
+    ];
+    public static $msgs = [
+        'required' => ':attribute不能为空',
+        'string' => ':attribute必须是字符串',
+        'min' => ':attribute长度不能小于:min位',
+        'max' => ':attribute长度不能大于:max位',
+        'exists' => ':attribute不存在',
+        'rule' => ':attribute格式不正确',
+        'mobile' => ':attribute格式不正确',
+    ];
+
+    // 当前模型所有验证字段
+    public static $fields = [
+        'id' => 'ID',
+        'user_id' => '用户',
+        'amount' => '金额',
+        'user_type' => '用户类型',
+        'coin_type' => '账户类型',
+        'status' => '状态',
+    ];
+
+    // 当前模型所有验证场景
+    public static $scenes = [
+        'info'=> ['id'],
+        'change'=> ['user_id','amount','user_type','coin_type'],
+
+    ];
+
+    /**
+     * 验证
+     * @param $request
+     * @param string $scene
+     * @return int|mixed
+     */
+    public static function check($request, $scene=''){
+        $validator = new BaseValidator(self::$rules, self::$msgs, self::$fields, self::$scenes);
+        return $validator->checkParams($request, $scene);
+    }
+}

+ 56 - 0
app/Http/Validator/BaseValidator.php

@@ -0,0 +1,56 @@
+<?php
+namespace App\Http\Validator;
+use Illuminate\Support\Facades\Validator;
+class BaseValidator extends Validator
+{
+    // 当前模型所有验证规则
+    public static $rules = [];
+
+    // 当前模型所有错误提示信息
+    public static $msgs = [];
+
+    // 当前模型所有验证字段
+    public static $fields = [];
+
+    // 当前模型所有验证场景
+    public static $scenes = [];
+
+    public function __construct($rules=[], $msgs=[], $fields=[], $scens=[])
+    {
+        self::$rules = $rules;
+        self::$msgs = $msgs;
+        self::$fields = $fields;
+        self::$scenes = $scens;
+    }
+
+    /**
+     * 验证表单或请求参数
+     * @param $request 请求数据
+     * @param string $scene 场景,为空则全部验证
+     * @return int|mixed
+     */
+    public function checkParams($request, $scene=''){
+        // 存在验证场景
+        if($scene){
+            $sceneFields = isset(self::$scenes[$scene])? self::$scenes[$scene] : [];
+            if(empty($sceneFields)){
+                return 1008;
+            }
+
+            foreach (self::$rules as $key => $rule){
+                if(!in_array($key, $sceneFields)){
+                    unset(self::$rules[$key]);
+                    unset(self::$fields[$key]);
+                }
+            }
+        }
+
+        // 验证数据
+        $validator = Validator::make($request, self::$rules, self::$msgs, self::$fields);
+        if ($validator->fails()) {
+            return getValidatorError($validator);
+        }
+
+        return $request;
+    }
+}

+ 47 - 0
app/Http/Validator/MemberValidator.php

@@ -0,0 +1,47 @@
+<?php
+namespace App\Http\Validator;
+class MemberValidator extends BaseValidator
+{
+    // 当前模型所有验证规则
+    public static $rules = [
+        'id' => 'required',
+        'avatar' => 'required',
+        'nickname' => 'required',
+        'gender' => 'required',
+    ];
+
+    // 当前模型所有错误提示信息
+    public static $msgs = [
+        'required' => ':attribute不能为空',
+        'string' => ':attribute必须是字符串',
+        'min' => ':attribute长度不能小于:min位',
+        'max' => ':attribute长度不能大于:max位',
+        'exists' => ':attribute不存在',
+        'rule' => ':attribute格式不正确',
+    ];
+
+    // 当前模型所有验证字段
+    public static $fields = [
+        'id' => 'ID',
+        'avatar' => '头像',
+        'gender' => '性别',
+        'nickname' => '昵称',
+    ];
+
+    // 当前模型所有验证场景
+    public static $scenes = [
+        'info'=> ['id'],
+        'save'=> ['mobile','nickname','gender'],
+    ];
+
+    /**
+     * 验证
+     * @param $request
+     * @param string $scene
+     * @return int|mixed
+     */
+    public static function check($request, $scene=''){
+        $validator = new BaseValidator(self::$rules, self::$msgs, self::$fields, self::$scenes);
+        return $validator->checkParams($request, $scene);
+    }
+}

+ 2 - 0
app/Lib/phpqrcode/.gitignore

@@ -0,0 +1,2 @@
+.idea/
+temp/*.png

+ 38 - 0
app/Lib/phpqrcode/CHANGELOG

@@ -0,0 +1,38 @@
+* 1.0.0 build 2010031920 
+
+  - first public release
+  - help in readme, install
+  - cleanup ans separation of QRtools and QRspec
+  - now TCPDF binding requires minimal changes in TCPDF, having most of job
+    done in QRtools tcpdfBarcodeArray
+  - nicer QRtools::timeBenchmark output
+  - license and copyright notices in files
+  - indent cleanup - from tab to 4spc, keep it that way please :)
+  - sf project, repository, wiki
+  - simple code generator in index.php
+  
+* 1.1.0 build 2010032113
+
+  - added merge tool wich generate merged version of code
+    located in phpqrcode.php
+  - splited qrconst.php from qrlib.php
+  
+* 1.1.1 build 2010032405
+
+  - patch by Rick Seymour allowing saving PNG and displaying it at the same time
+  - added version info in VERSION file
+  - modified merge tool to include version info into generated file
+  - fixed e-mail in almost all head comments
+  
+* 1.1.2 build 2010032722
+
+  - full integration with TCPDF thanks to Nicola Asuni, it's author
+  - fixed bug with alphanumeric encoding detection
+  
+* 1.1.3 build 2010081807
+
+  - short opening tags replaced with standard ones
+  
+* 1.1.4 build 2010100721
+
+  - added missing static keyword QRinput::check (found by Luke Brookhart, Onjax LLC)

+ 165 - 0
app/Lib/phpqrcode/LICENSE

@@ -0,0 +1,165 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 3719 - 0
app/Lib/phpqrcode/QRcode.php


+ 61 - 0
app/Lib/phpqrcode/README

@@ -0,0 +1,61 @@
+This is PHP implementation of QR Code 2-D barcode generator. It is pure-php
+LGPL-licensed implementation based on C libqrencode by Kentaro Fukuchi.
+
+== UPDATE ==
+Added support for eps export
+Usage : QRcode::eps('arguments');
+
+Added support for SVG export
+Usage : QRcode::svg('arguments');
+
+Added support for color export :
+example : 
+$back_color = 0xFFFF00;
+$fore_color = 0xFF00FF;
+QRcode::png('some othertext 1234', false, 'h', 20, 1, false, $back_color, $fore_color);
+
+
+Copyright (C) 2012 by Alexandre Assouad 
+
+== LICENSING ==
+
+Copyright (C) 2010 by Dominik Dzienia 
+
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation; either version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU Lesser General Public License (LICENSE file)
+for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this library; if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+== INSTALATION AND USAGE ==
+
+ * INSTALL file
+ * http://sourceforge.net/apps/mediawiki/phpqrcode/index.php?title=Main_Page
+
+== CONTACT ==
+
+Fell free to contact me via e-mail (deltalab at poczta dot fm) or using
+folowing project pages:
+
+ * http://sourceforge.net/projects/phpqrcode/
+ * http://phpqrcode.sourceforge.net/
+  
+== ACKNOWLEDGMENTS ==
+
+Based on C libqrencode library (ver. 3.1.1) 
+Copyright (C) 2006-2010 by Kentaro Fukuchi
+http://megaui.net/fukuchi/works/qrencode/index.en.html
+
+QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other
+countries.
+
+Reed-Solomon code encoder is written by Phil Karn, KA9Q.
+Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
+ 

+ 2 - 0
app/Lib/phpqrcode/VERSION

@@ -0,0 +1,2 @@
+1.1.4
+2010100721

+ 58 - 0
app/Models/AccountLogModel.php

@@ -0,0 +1,58 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 账户明细-模型
+ * @author laravel开发员
+ * @since 2020/11/10
+ * Class ActionLogModel
+ * @package App\Models
+ */
+class AccountLogModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'account_log';
+
+    /**
+     * 用户
+     * @return \Illuminate\Database\Eloquent\Relations\HasOne
+     */
+    public function member()
+    {
+        return $this->hasOne(MemberModel::class, 'id','user_id')
+            ->where(['mark'=>1])
+            ->select(['id','nickname','usdt','wallet_url','sbt','profit','avatar','status']);
+    }
+
+    /**
+     * 账单
+     * @return \Illuminate\Database\Eloquent\Relations\HasOne
+     */
+    public function order()
+    {
+        return $this->hasOne(BalanceLogModel::class, 'order_no','order_no')
+            ->where(['mark'=>1])
+            ->select(['id','pay_status','pay_at','money','actual_money','hash','fee','fee_usdt','audit_remark','status']);
+    }
+
+    /**
+     * 质押订单
+     * @return \Illuminate\Database\Eloquent\Relations\HasOne
+     */
+    public function porder()
+    {
+        return $this->hasOne(PledgeOrderModel::class, 'order_no','order_no')
+            ->where(['mark'=>1])
+            ->select(['id','money','bonus_rate','sbt_price','profit','time','round','expired_at','settle_at','status']);
+    }
+}

+ 145 - 0
app/Models/ActionLogModel.php

@@ -0,0 +1,145 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+use Illuminate\Support\Facades\DB;
+
+/**
+ * 行为日志-模型
+ * @author laravel开发员
+ * @since 2020/11/10
+ * Class ActionLogModel
+ * @package App\Models
+ */
+class ActionLogModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = null;
+    // 自定义日志标题
+    protected static $title = '';
+    // 自定义日志内容
+    protected static $content = '';
+
+    public function __construct()
+    {
+        // 设置表名
+        $this->table = 'action_log_' . date('Y') . '_' . date('m');
+        // 初始化行为日志表
+        $this->initTable();
+    }
+
+    /**
+     * 初始化行为日志表
+     * @return string|null
+     * @since 2020/11/10
+     * @author laravel开发员
+     */
+    private function initTable()
+    {
+        $tbl = DB_PREFIX . $this->table;
+        if (!$this->tableExists($tbl)) {
+            $sql = "CREATE TABLE `{$tbl}` (
+                  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '唯一性标识',
+                  `username` varchar(60) CHARACTER SET utf8mb4 NOT NULL COMMENT '操作人用户名',
+                  `method` varchar(20) CHARACTER SET utf8mb4 NOT NULL COMMENT '请求类型',
+                  `module` varchar(30) NOT NULL COMMENT '模型',
+                  `action` varchar(255) NOT NULL COMMENT '操作方法',
+                  `url` varchar(200) CHARACTER SET utf8mb4 NOT NULL COMMENT '操作页面',
+                  `param` text CHARACTER SET utf8mb4 NOT NULL COMMENT '请求参数(JSON格式)',
+                  `title` varchar(100) NOT NULL COMMENT '日志标题',
+                  `type` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '操作类型:1登录系统 2注销系统',
+                  `content` varchar(1000) NOT NULL DEFAULT '' COMMENT '内容',
+                  `ip` varchar(18) CHARACTER SET utf8mb4 NOT NULL COMMENT 'IP地址',
+                  `user_agent` varchar(360) CHARACTER SET utf8mb4 NOT NULL COMMENT 'User-Agent',
+                  `create_user` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加人',
+                  `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间',
+                  `update_user` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新人',
+                  `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
+                  `mark` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '有效标识:1正常 0删除',
+                  PRIMARY KEY (`id`) USING BTREE
+                ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='系统行为日志表';";
+            DB::select($sql);
+        }
+        return $tbl;
+    }
+
+    /**
+     * 设置标题
+     * @param $title 标题
+     * @since 2020/11/10
+     * @author laravel开发员
+     */
+    public static function setTitle($title)
+    {
+        self::$title = $title;
+    }
+
+    /**
+     * 设置内容
+     * @param $content 内容
+     * @since 2020/11/10
+     * @author laravel开发员
+     */
+    public static function setContent($content)
+    {
+        self::$content = $content;
+    }
+
+    /**
+     * 创建行为日志
+     * @author laravel开发员
+     * @since 2020/11/10
+     */
+    public static function record($userId=0)
+    {
+        if (!self::$title) {
+            // 操作控制器名
+            $menuModel = new MenuModel();
+            $info = $menuModel->getOne([
+                ['url', '=', request()->url()],
+            ]);
+            if ($info) {
+                if ($info['type'] == 1) {
+                    $menuInfo = $menuModel->getInfo($info['pid']);
+                    self::$title = $menuInfo['title'];
+                } else {
+                    self::$title = $info['title'];
+                }
+            }
+        }
+
+        // 登录用户ID
+        $adminId = request()->header('admin_id',0);
+        $userId = $userId? $userId : $adminId;
+        $userModel = new UserModel();
+        $userInfo = $userModel->getInfo($userId);
+
+        // 日志数据
+        $data = [
+            'username' => isset($userInfo['username']) ? $userInfo['username'] : '未知',
+            'module' => 'admin',
+            'action' => request()->path(),
+            'method' => request()->method(),
+            'url' => request()->url(true), // 获取完成URL
+            'param' => request()->all() ? json_encode(request()->all()) : '',
+            'title' => self::$title ? self::$title : '操作日志',
+            'type' => self::$title == '登录系统' ? 1 : (self::$title == '注销系统' ? 2 : 0),
+            'content' => self::$content,
+            'ip' => request()->ip(),
+            'user_agent' => request()->server('HTTP_USER_AGENT'),
+            'create_user' => intval($userId),
+            'create_time' => time(),
+        ];
+        // 日志入库
+        self::insert($data);
+    }
+}

+ 45 - 0
app/Models/AdModel.php

@@ -0,0 +1,45 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 广告管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class AdModel
+ * @package App\Models
+ */
+class AdModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'ad';
+
+    /**
+     * 获取广告信息
+     * @param int $id
+     * @return array|string
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function getInfo($id)
+    {
+        $info = parent::getInfo($id); // TODO: Change the autogenerated stub
+        if ($info) {
+            // 广告封面
+            if ($info['cover']) {
+                $info['cover'] = get_image_url($info['cover']);
+            }
+        }
+        return $info;
+    }
+
+}

+ 40 - 0
app/Models/AdSortModel.php

@@ -0,0 +1,40 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 广告位管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class AdSortModel
+ * @package App\Models
+ */
+class AdSortModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'ad_sort';
+
+    public function getInfo($id)
+    {
+        $info = parent::getInfo($id); // TODO: Change the autogenerated stub
+        if ($info) {
+            // 获取栏目名称
+            if ($info['cate_id']) {
+                $itemCateModel = new ItemCateModel();
+                $itemCateName = $itemCateModel->getCateName($info['cate_id'], ">>");
+                $info['item_cate_name'] = $itemCateName;
+            }
+        }
+        return $info;
+    }
+
+}

+ 25 - 0
app/Models/ArticleCateModel.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 文章分类管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ArticleCateModel
+ * @package App\Models
+ */
+class ArticleCateModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'article_cate';
+}

+ 32 - 0
app/Models/ArticleModel.php

@@ -0,0 +1,32 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 文章管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ArticleModel
+ * @package App\Models
+ */
+class ArticleModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'article';
+
+    public function articleCate()
+    {
+        return $this->hasOne(ArticleCateModel::class, 'id','cate_id')
+            ->where(['mark'=>1])
+            ->select(['id','name','icon']);
+    }
+}

+ 60 - 0
app/Models/BalanceLogModel.php

@@ -0,0 +1,60 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+use App\Services\RedisService;
+
+/**
+ * 充值提现订单管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class BalanceLogModel
+ * @package App\Models
+ */
+class BalanceLogModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'balance_logs';
+
+    /**
+     * 验证记录是否已经存在
+     * @param $hash
+     * @return array|bool
+     */
+    public static function checkExists($hash)
+    {
+        $cacheKey = "caches:wallet:balanceLog:{$hash}";
+        $check = RedisService::get($cacheKey);
+        if(RedisService::exists($cacheKey)){
+            return $check;
+        }
+
+        $info = BalanceLogModel::where(['hash'=> $hash,'mark'=>1])->first();
+        $info = $info? $info->toArray() : [];
+        if($info){
+            RedisService::set($cacheKey, $info, rand(3600,7200));
+        }
+
+        return $info;
+    }
+
+    /**
+     * 用户
+     * @return \Illuminate\Database\Eloquent\Relations\HasOne
+     */
+    public function member()
+    {
+        return $this->hasOne(MemberModel::class, 'id','user_id')
+            ->where(['mark'=>1])
+            ->select(['id','nickname','usdt','wallet_url','wallet_token','sbt','profit','avatar','status']);
+    }
+}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1254 - 0
app/Models/BaseModel.php


+ 286 - 0
app/Models/CacheModel.php

@@ -0,0 +1,286 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
+
+/**
+ * 缓存模型
+ * @author zongjl
+ * @date 2019/5/23
+ * Class CacheModel
+ * @package App\Models
+ */
+class CacheModel extends Model
+{
+    // 是否启用缓存
+    protected $is_cache = true;
+
+    /**
+     * 重置缓存
+     * @param int $id 记录ID
+     * @param array $data 数据源
+     * @param bool $is_edit 是否编辑
+     * @return bool 返回结果
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function cacheReset($id, $data = [], $is_edit = false)
+    {
+        if (!$data) {
+            $this->resetCacheFunc('info', $id);
+        }
+        $info = [];
+        if ($is_edit) {
+            $info = $this->getCacheFunc("info", $id);
+        }
+        if (is_array($data)) {
+            $info = array_merge($info, $data);
+        } else {
+            $info = $data;
+        }
+        $cache_key = $this->getCacheKey('info', $id);
+        $result = $this->setCache($cache_key, $info);
+        return $result;
+    }
+
+    /**
+     * 删除缓存
+     * @param int $id 删除缓存ID
+     * @return bool 返回true或false
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function cacheDelete($id)
+    {
+        $cache_key = $this->getCacheKey("info", $id);
+        $result = $this->deleteCache($cache_key);
+        return $result;
+    }
+
+    /**
+     * 设置单条数据缓存
+     * @param int $id 记录ID
+     * @return array 返回结果
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function cacheInfo($id)
+    {
+        if (!$id) {
+            return false;
+        }
+        $data = $this->find((int)$id);
+        return $data ? $data->toArray() : [];
+    }
+
+    /**
+     * 获取缓存KEY
+     * @return string 缓存KEY
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function getCacheKey()
+    {
+        $arg_list = func_get_args();
+        if ($this->table) {
+            array_unshift($arg_list, $this->table);
+        }
+        foreach ($arg_list as $key => $val) {
+            if (is_array($val)) {
+                unset($arg_list[$key]);
+            }
+        }
+        $cache_key = implode("_", $arg_list);
+        return $cache_key;
+    }
+
+    /**
+     * 设置缓存
+     * @param string $cache_key 缓存KEY
+     * @param array $data 缓存数据
+     * @param int $ttl 过期时间
+     * @return bool 返回结果
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function setCache($cache_key, $data, $ttl = 0)
+    {
+        if (isset($GLOBALS['trans']) && $GLOBALS['trans'] === true) {
+            $GLOBALS['trans_keys'][] = $cache_key;
+        }
+
+        // 不设置缓存,直接返回
+        if (!$this->is_cache) {
+            return true;
+        }
+        if (!$data) {
+            return Cache::put($cache_key, null, $ttl);
+        }
+        $isGzcompress = gzcompress(json_encode($data));
+        if ($isGzcompress) {
+            $result = Cache::put($cache_key, $isGzcompress);
+        }
+        return $result;
+    }
+
+    /**
+     * 获取缓存
+     * @param string $cache_key 缓存KEY
+     * @return mixed 返回缓存数据
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function getCache($cache_key)
+    {
+        $data = Cache::get($cache_key);
+        if ($data) {
+            $data = json_decode(gzuncompress($data), true);
+        }
+        return $data;
+    }
+
+    /**
+     * 删除缓存
+     * @param string $cache_key 缓存KEY
+     * @return bool 返回结果true或false
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function deleteCache($cache_key)
+    {
+        // 判断缓存键值是否存在,存在则删除
+        if (Cache::has($cache_key)) {
+            return Cache::forget($cache_key);
+        }
+        return false;
+    }
+
+    /**
+     * 设置缓存函数
+     * @param string $funcName 方法名
+     * @param string $id 缓存数据ID
+     * @return bool 返回结果true或false
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function resetCacheFunc($funcName, $id = '')
+    {
+        // 获取缓存KEY
+        $cache_key = $this->getCacheKey($funcName, $id);
+        // 删除缓存
+        $result = $this->deleteCache($cache_key);
+
+        // 设置缓存
+        $arg_list = func_get_args();
+        if ($this->table) {
+            array_shift($arg_list);
+        }
+        $act = "cache" . ucfirst($funcName);
+        $data = call_user_func_array(array($this, $act), $arg_list);
+        return $this->setCache($cache_key, $data);
+    }
+
+    /**
+     * 获取缓存函数
+     * @param string $funcName 方法名
+     * @param string $id 缓存数据ID
+     * @return mixed 返回结果
+     * @author zongjl
+     * @date 2019/5/23
+     */
+    public function getCacheFunc($funcName, $id = '')
+    {
+        $arg_list = func_get_args();
+        if ($this->table) {
+            array_shift($arg_list);
+        }
+        $act = "cache" . ucfirst($funcName);
+        $data = call_user_func_array(array($this, $act), $arg_list);
+        return $data;
+    }
+
+    /**
+     * 获取整表缓存
+     * @param array $map 查询条件
+     * @param bool $is_pri 是否只缓存主键true或false
+     * @param bool $pri_key 是否以主键作为键值true或false
+     * @return mixed 返回结果
+     * @author zongjl
+     * @date 2019/6/5
+     */
+    public function getAll($map = [], $is_pri = false, $pri_key = false)
+    {
+        $list = $this->getCacheFunc('all', $map, $is_pri, $pri_key);
+        return $list;
+    }
+
+    /**
+     * 设置整表缓存
+     * @param array $map 查询条件
+     * @param bool $is_pri 是否只缓存主键true或false
+     * @param bool $pri_key 是否以主键作为键值true或false
+     * @return mixed 返回结果
+     * @author zongjl
+     * @date 2019/6/5
+     */
+    public function cacheAll($map = [], $is_pri = false, $pri_key = false)
+    {
+        // 必备查询条件
+        $map[] = ['mark', '=', 1];
+
+        // 格式化查询条件
+        if (method_exists($this, 'formatQuery')) {
+            $query = $this->formatQuery($this, $map);
+        }
+
+        // 是否缓存主键
+        if ($is_pri) {
+            if (is_array($is_pri)) {
+                // 字段数组
+                $query->select($is_pri);
+            } elseif (is_string($is_pri)) {
+                // 字段字符串
+                $fields = explode(',', $is_pri);
+                $query->select($fields);
+            } else {
+                // 默认主键ID
+                $query->select('id');
+            }
+        }
+
+        // 查询数据并转数组
+        $list = $query->get()->toArray();
+
+        // 设置主键ID为数组键值
+        if ($pri_key) {
+            $list = array_column($list, null, 'id');
+        }
+
+        return $list;
+    }
+
+    /**
+     * 重置全表缓存
+     * @param array $map 查询条件
+     * @param bool $is_pri 是否只缓存主键true或false
+     * @param bool $pri_key 是否以主键作为键值true或false
+     * @return bool 返回结果true(重置成功)或false(重置失败)
+     * @author zongjl
+     * @date 2019/6/5
+     */
+    public function cacheResetAll($map = [], $is_pri = false, $pri_key = false)
+    {
+        return $this->resetCacheFunc('all', $map, $is_pri, $pri_key);
+    }
+}

+ 25 - 0
app/Models/CityModel.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 城市-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class CityModel
+ * @package App\Models
+ */
+class CityModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'city';
+}

+ 25 - 0
app/Models/ConfigGroupModel.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 配置分组-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ConfigGroupModel
+ * @package App\Models
+ */
+class ConfigGroupModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'config_group';
+}

+ 41 - 0
app/Models/ConfigModel.php

@@ -0,0 +1,41 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 配置管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ConfigModel
+ * @package App\Models
+ */
+class ConfigModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'config';
+    public function getInfo($id)
+    {
+        $info =  parent::getInfo($id); // TODO: Change the autogenerated stub
+        if($info){
+            $type = isset($info['type'])? $info['type'] : 'text';
+            if(isset($info['value']) && $type=='image'){
+                $info['value'] = get_image_url($info['value']);
+            }
+
+            if(isset($info['value']) && $type=='daterange'){
+                $info['value'] = json_decode($info['value'], true);
+            }
+
+        }
+        return $info;
+    }
+}

+ 24 - 0
app/Models/DeveloperModel.php

@@ -0,0 +1,24 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 开发者-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Models
+ */
+class DeveloperModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'developer';
+}

+ 49 - 0
app/Models/FinanceModel.php

@@ -0,0 +1,49 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 财务统计管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class FinanceModel
+ * @package App\Models
+ */
+class FinanceModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'finance';
+
+    /**
+     * @return \Illuminate\Database\Eloquent\Relations\HasOne
+     */
+    public function member()
+    {
+        return $this->hasOne(MemberModel::class, 'id','user_id')
+            ->where(['mark'=>1])
+            ->select(['id','nickname','parent_id','usdt','wallet_url','status']);
+    }
+
+    /**
+     * 获取信息
+     * @param int $id
+     * @return array|string
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function getInfo($id)
+    {
+        $info = parent::getInfo($id); // TODO: Change the autogenerated stub
+        return $info;
+    }
+
+}

+ 25 - 0
app/Models/InstitutionalModel.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 制度参数-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Models
+ */
+class InstitutionalModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'institutional';
+
+}

+ 72 - 0
app/Models/ItemCateModel.php

@@ -0,0 +1,72 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 栏目模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ItemCateModel
+ * @package App\Models
+ */
+class ItemCateModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'item_cate';
+
+    /**
+     * 获取记录信息
+     * @param int $id
+     * @return array|string
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function getInfo($id)
+    {
+        $info = parent::getInfo($id); // TODO: Change the autogenerated stub
+        if ($info) {
+            // 封面
+            if ($info['cover']) {
+                $info['cover'] = get_image_url($info['cover']);
+            }
+        }
+        return $info;
+    }
+
+    /**
+     * 获取栏目名称
+     * @param $cateId 栏目ID
+     * @param string $delimiter 分隔符
+     * @return string|null
+     * @since 2020/11/11
+     * @author laravel开发员
+     */
+    public function getCateName($cateId, $delimiter = "")
+    {
+        do {
+            $info = $this->getInfo($cateId);
+            $names[] = $info['name'];
+            $cateId = $info['pid'];
+        } while ($cateId > 0);
+        if (!empty($names)) {
+            $names = array_reverse($names);
+            if (count($names) >= 2) {
+                if (strpos($names[1], $names[0]) === 0) {
+                    unset($names[0]);
+                }
+            }
+            return implode($delimiter, $names);
+        }
+        return null;
+    }
+
+}

+ 45 - 0
app/Models/ItemModel.php

@@ -0,0 +1,45 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 站点-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ItemModel
+ * @package App\Models
+ */
+class ItemModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'item';
+
+    /**
+     * 获取数据信息
+     * @param int $id 记录ID
+     * @return array|string
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function getInfo($id)
+    {
+        $info = parent::getInfo($id); // TODO: Change the autogenerated stub
+        if ($info) {
+            // 站点图片
+            if ($info['image']) {
+                $info['image'] = get_image_url($info['image']);
+            }
+        }
+        return $info;
+    }
+
+}

+ 49 - 0
app/Models/LayoutDescModel.php

@@ -0,0 +1,49 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 布局描述-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class LayoutDescModel
+ * @package App\Models
+ */
+class LayoutDescModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'layout_desc';
+
+    /**
+     * 获取数据信息
+     * @param int $id
+     * @return array|string
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function getInfo($id)
+    {
+        $info = parent::getInfo($id); // TODO: Change the autogenerated stub
+        if ($info) {
+            // 站点名称
+            if ($info['item_id']) {
+                $itemModel = new ItemModel();
+                $itemInfo = $itemModel->getInfo($info['item_id']);
+                if ($itemInfo) {
+                    $info['item_name'] = $itemInfo['name'];
+                }
+            }
+        }
+        return $info;
+    }
+
+}

+ 54 - 0
app/Models/LayoutModel.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 布局管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class LayoutModel
+ * @package App\Models
+ */
+class LayoutModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'layout';
+
+    /**
+     * 获取数据信息
+     * @param int $id 记录ID
+     * @return array|string
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function getInfo($id)
+    {
+        $info = parent::getInfo($id); // TODO: Change the autogenerated stub
+        if ($info) {
+            // 布局图片
+            if ($info['image']) {
+                $info['image'] = get_image_url($info['image']);
+            }
+
+            // 站点名称
+            if ($info['item_id']) {
+                $itemModel = new ItemModel();
+                $itemInfo = $itemModel->getInfo($info['item_id']);
+                if ($itemInfo) {
+                    $info['item_name'] = $itemInfo['name'];
+                }
+            }
+        }
+        return $info;
+    }
+
+}

+ 25 - 0
app/Models/LevelModel.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 职级-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class LevelModel
+ * @package App\Models
+ */
+class LevelModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'level';
+}

+ 0 - 0
app/Models/MemberLevelModel.php


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä