Przeglądaj źródła

后台功能同步

Tree 2 tygodni temu
rodzic
commit
30ea6c505d

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

@@ -0,0 +1,95 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Game\Banner;
+use App\Game\WebThemeConfig;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Validator;
+
+class BannerController
+{
+    public function index(Request $request)
+    {
+        $query = Banner::query();
+
+        // 可以根据主题筛选
+        if ($request->has('theme_key') && !empty($request->theme_key)) {
+            $query->where('theme_key', $request->theme_key);
+        }
+
+        $list = $query->orderBy('bid', 'desc')->paginate(20);
+
+        // 获取所有主题用于筛选
+        $themes = WebThemeConfig::all();
+
+        return view('admin.banner.index', [
+            'list' => $list,
+            'theme_key' => $request->theme_key ?? '',
+            'themes' => $themes
+        ]);
+    }
+
+    public function add(Request $request)
+    {
+        if ($request->isMethod('post')) {
+            $validator = Validator::make($request->all(), [
+                'img' => 'required|string',
+                'alt' => 'nullable|string',
+                'link_game' => 'nullable|integer',
+                'link_module' => 'nullable|integer',
+                'theme_key' => 'nullable|string|max:30',
+            ]);
+
+            if ($validator->fails()) {
+                return apiReturnFail($validator->errors()->first());
+            }
+
+            $data = $request->only(['img', 'img_pt', 'img_es', 'alt', 'link_game', 'link_module', 'theme_key']);
+            Banner::create($data);
+
+            return apiReturnSuc();
+        }
+
+        $themes = WebThemeConfig::all();
+        return view('admin.banner.add', ['themes' => $themes]);
+    }
+
+    public function edit(Request $request, $id)
+    {
+        $info = Banner::findOrFail($id);
+
+        if ($request->isMethod('post')) {
+            $validator = Validator::make($request->all(), [
+                'img' => 'required|string',
+                'alt' => 'nullable|string',
+                'link_game' => 'nullable|integer',
+                'link_module' => 'nullable|integer',
+                'theme_key' => 'nullable|string|max:30',
+            ]);
+
+            if ($validator->fails()) {
+                return apiReturnFail($validator->errors()->first());
+            }
+
+            $data = $request->only(['img', 'img_pt', 'img_es', 'alt', 'link_game', 'link_module', 'theme_key']);
+            $info->update($data);
+
+            return apiReturnSuc();
+        }
+
+        $themes = WebThemeConfig::all();
+        return view('admin.banner.edit', [
+            'info' => $info,
+            'themes' => $themes
+        ]);
+    }
+
+    public function delete($id)
+    {
+        $info = Banner::findOrFail($id);
+        $info->delete();
+
+        return apiReturnSuc();
+    }
+}

+ 64 - 0
app/Http/Controllers/Admin/ChannelController.php

@@ -823,4 +823,68 @@ class ChannelController
 
         return apiReturnSuc();
     }
+
+    public function quickCreateChannel(Request $request)
+    {
+        if ($request->isMethod('post')) {
+            $packageName = $request->input('packageName');
+            $channelName = $request->input('channelName');
+            $adminSign = $request->input('adminSign', 'dk');
+
+            // 检查包名是否已存在
+            $exists = DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
+                ->where('PackageName', $packageName)
+                ->exists();
+
+            if ($exists) {
+                return apiReturnFail('包名已存在');
+            }
+
+            try {
+                // 调用自动创建渠道方法
+                $autoApkController = new \App\Http\Controllers\Api\AutoApkController();
+                $packageConfig = $autoApkController->autoCreateChannel($packageName, $channelName, $adminSign);
+                $autoApkController->modifyRights($packageConfig, $adminSign);
+
+                return apiReturnSuc(['message' => '渠道创建成功', 'channel' => $packageConfig['Channel']]);
+            } catch (\Exception $e) {
+                Util::WriteLog('quick_create_channel', $e->getMessage());
+                return apiReturnFail('创建失败:' . $e->getMessage());
+            }
+        } else {
+            // 获取最后一个包名和渠道名,用于生成默认值
+            $lastPackage = DB::connection('read')->table('QPPlatformDB.dbo.ChannelPackageName')
+                ->orderByDesc('ID')
+                ->first();
+
+            $defaultPackageName = '';
+            $defaultChannelName = '';
+
+            if ($lastPackage) {
+                // 提取包名中的数字并+1
+                if (preg_match('/^(.+?)(\d+)$/', $lastPackage->PackageName, $matches)) {
+                    $defaultPackageName = $matches[1] . ($matches[2] + 1);
+                } else {
+                    $defaultPackageName = $lastPackage->PackageName . '1';
+                }
+
+                // 提取渠道名中的数字并+1
+                $aliasName = $lastPackage->AliasName ?? $lastPackage->Remarks ?? '';
+                // 去掉前缀(USA_、NEW_等),只保留下划线后面的部分
+                if (strpos($aliasName, '_') !== false) {
+                    $aliasName = substr($aliasName, strrpos($aliasName, '_') + 1);
+                }
+                if (preg_match('/^(.+?)(\d+)$/', $aliasName, $matches)) {
+                    $defaultChannelName = $matches[1] . ($matches[2] + 1);
+                } else {
+                    $defaultChannelName = $aliasName . '1';
+                }
+            }
+
+            return view('admin.channel.quick_create_channel', [
+                'defaultPackageName' => $defaultPackageName,
+                'defaultChannelName' => $defaultChannelName,
+            ]);
+        }
+    }
 }

+ 23 - 24
app/Http/Controllers/Admin/WebChannelConfigController.php

@@ -193,6 +193,7 @@ class WebChannelConfigController
         $data['FullApk'] = $data['FullApk'] ?? '';
         $data['PlatformID'] = $data['PlatformID'] ?? '';
         $data['RegionID'] = $data['RegionID'] ?? '';
+        $data['PlatformName'] = $data['PlatformName'] ?? '';
 
         $oldRegionID = $info->RegionID;
         $oldChannel = $info->Channel;
@@ -209,33 +210,31 @@ class WebChannelConfigController
 
         $info->update($data);
 
-        // 如果 RegionID 或 Channel 发生变化,需要同步更新 WebRegionConfig
-        if ($oldRegionID != $info->RegionID || $oldChannel != $info->Channel) {
-            // 1. 从旧的 RegionID 中移除旧的 Channel
-            if (!empty($oldRegionID)) {
-                $oldRegion = WebRegionConfig::where('RegionID', $oldRegionID)->first();
-                if ($oldRegion) {
-                    $bindChannels = is_array($oldRegion->BindChannels) ? $oldRegion->BindChannels : [];
-                    $key = array_search($oldChannel, $bindChannels);
-                    if ($key !== false) {
-                        unset($bindChannels[$key]);
-                        $oldRegion->BindChannels = array_values($bindChannels);
-                        $oldRegion->save();
-                    }
+        // 同步更新 WebRegionConfig 的 BindChannels
+        // 1. 从旧的 RegionID 中移除旧的 Channel
+        if (!empty($oldRegionID)) {
+            $oldRegion = WebRegionConfig::where('RegionID', $oldRegionID)->first();
+            if ($oldRegion) {
+                $bindChannels = is_array($oldRegion->BindChannels) ? $oldRegion->BindChannels : [];
+                $key = array_search($oldChannel, $bindChannels);
+                if ($key !== false) {
+                    unset($bindChannels[$key]);
+                    $oldRegion->BindChannels = array_values($bindChannels);
+                    $oldRegion->save();
                 }
             }
+        }
 
-            // 2. 向新的 RegionID 中添加新的 Channel
-            if (!empty($info->RegionID)) {
-                $newRegion = WebRegionConfig::where('RegionID', $info->RegionID)->first();
-                if ($newRegion) {
-                    $bindChannels = is_array($newRegion->BindChannels) ? $newRegion->BindChannels : [];
-                    if (!in_array($info->Channel, $bindChannels)) {
-                        $bindChannels[] = (int)$info->Channel;
-                        sort($bindChannels);
-                        $newRegion->BindChannels = $bindChannels;
-                        $newRegion->save();
-                    }
+        // 2. 向新的 RegionID 中添加新的 Channel(如果新 RegionID 不为空)
+        if (!empty($info->RegionID)) {
+            $newRegion = WebRegionConfig::where('RegionID', $info->RegionID)->first();
+            if ($newRegion) {
+                $bindChannels = is_array($newRegion->BindChannels) ? $newRegion->BindChannels : [];
+                if (!in_array($info->Channel, $bindChannels)) {
+                    $bindChannels[] = (int)$info->Channel;
+                    sort($bindChannels);
+                    $newRegion->BindChannels = $bindChannels;
+                    $newRegion->save();
                 }
             }
         }

+ 28 - 1
app/Http/Controllers/Admin/WebRegionConfigController.php

@@ -10,9 +10,36 @@ class WebRegionConfigController
     public function index(Request $request)
     {
         $list = WebRegionConfig::orderBy('GroupID', 'asc')->orderBy('id', 'asc')->paginate(40);
-        
+
         return view('admin.web_region_config.index', [
             'list' => $list,
         ]);
     }
+
+    public function edit(Request $request, $id)
+    {
+        $info = WebRegionConfig::findOrFail($id);
+
+        if ($request->isMethod('post')) {
+            $post = $request->post();
+
+            // 处理 BindChannels
+            if (isset($post['BindChannels']) && is_string($post['BindChannels'])) {
+                $channelIds = array_filter(array_map('trim', explode(',', $post['BindChannels'])));
+                $post['BindChannels'] = array_map('intval', $channelIds);
+            }
+
+            $info->update($post);
+
+            return apiReturnSuc();
+        }
+
+        // 获取所有主题配置供选择
+        $themes = \App\Game\WebThemeConfig::all();
+
+        return view('admin.web_region_config.edit', [
+            'info' => $info,
+            'themes' => $themes
+        ]);
+    }
 }

+ 97 - 0
app/Http/Controllers/Admin/WebThemeConfigController.php

@@ -0,0 +1,97 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Game\WebThemeConfig;
+use App\Game\WebRegionConfig;
+use Illuminate\Http\Request;
+
+class WebThemeConfigController
+{
+    public function index(Request $request)
+    {
+        $list = WebThemeConfig::orderBy('id', 'asc')->paginate(40);
+
+        return view('admin.web_theme_config.index', [
+            'list' => $list,
+        ]);
+    }
+
+    public function add(Request $request)
+    {
+        if ($request->isMethod('post')) {
+            $post = $request->post();
+
+            // 处理 BindRegions,将字符串转换为数组
+            if (isset($post['BindRegions']) && is_string($post['BindRegions'])) {
+                $regionIds = array_filter(array_map('trim', explode(',', $post['BindRegions'])));
+                $post['BindRegions'] = array_map('intval', $regionIds);
+            }
+
+            WebThemeConfig::create($post);
+
+            // 更新对应 Region 的 ThemeKey
+            if (!empty($post['BindRegions']) && !empty($post['ThemeKey'])) {
+                WebRegionConfig::whereIn('id', $post['BindRegions'])
+                    ->update(['ThemeKey' => $post['ThemeKey']]);
+            }
+
+            return apiReturnSuc();
+        }
+
+        $regions = WebRegionConfig::orderBy('GroupID', 'asc')->orderBy('id', 'asc')->get();
+        return view('admin.web_theme_config.add', ['regions' => $regions]);
+    }
+
+    public function edit(Request $request, $id)
+    {
+        $info = WebThemeConfig::findOrFail($id);
+
+        if ($request->isMethod('post')) {
+            $post = $request->post();
+
+            // 处理 BindRegions
+            if (isset($post['BindRegions']) && is_string($post['BindRegions'])) {
+                $regionIds = array_filter(array_map('trim', explode(',', $post['BindRegions'])));
+                $post['BindRegions'] = array_map('intval', $regionIds);
+            }
+
+            // 清除原有绑定的 Region 的 ThemeKey
+            if (!empty($info->BindRegions)) {
+                WebRegionConfig::whereIn('id', $info->BindRegions)
+                    ->update(['ThemeKey' => '']);
+            }
+
+            $info->update($post);
+
+            // 更新新绑定的 Region 的 ThemeKey
+            if (!empty($post['BindRegions']) && !empty($post['ThemeKey'])) {
+                WebRegionConfig::whereIn('id', $post['BindRegions'])
+                    ->update(['ThemeKey' => $post['ThemeKey']]);
+            }
+
+            return apiReturnSuc();
+        }
+
+        $regions = WebRegionConfig::orderBy('GroupID', 'asc')->orderBy('id', 'asc')->get();
+        return view('admin.web_theme_config.edit', [
+            'info' => $info,
+            'regions' => $regions
+        ]);
+    }
+
+    public function delete($id)
+    {
+        $info = WebThemeConfig::findOrFail($id);
+
+        // 清除绑定的 Region 的 ThemeKey
+        if (!empty($info->BindRegions)) {
+            WebRegionConfig::whereIn('id', $info->BindRegions)
+                ->update(['ThemeKey' => '']);
+        }
+
+        $info->delete();
+
+        return apiReturnSuc();
+    }
+}

+ 82 - 0
resources/views/admin/banner/add.blade.php

@@ -0,0 +1,82 @@
+@extends('base.base')
+@section('base')
+    <div class="main-panel">
+        <div class="content-wrapper">
+            <div class="page-header">
+                <h3 class="page-title">
+                    <span class="page-title-icon bg-gradient-primary text-white mr-2">
+                        <i class="mdi mdi-image-multiple"></i>
+                    </span>
+                    {{ __('auto.添加Banner') }}
+                </h3>
+            </div>
+            <div class="row">
+                <div class="col-12 grid-margin">
+                    <div class="card">
+                        <div class="card-body">
+                            <form id="bannerForm">
+                                <div class="form-group">
+                                    <label>{{ __('auto.图片URL') }} *</label>
+                                    <input type="text" class="form-control" name="img" required>
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.葡萄牙语图片URL') }}</label>
+                                    <input type="text" class="form-control" name="img_pt">
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.西班牙语图片URL') }}</label>
+                                    <input type="text" class="form-control" name="img_es">
+                                </div>
+                                <div class="form-group">
+                                    <label>Alt Text</label>
+                                    <input type="text" class="form-control" name="alt">
+                                </div>
+                                <div class="form-group">
+                                    <label>Link Game ID</label>
+                                    <input type="number" class="form-control" name="link_game">
+                                </div>
+                                <div class="form-group">
+                                    <label>Link Module ID</label>
+                                    <input type="number" class="form-control" name="link_module">
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.主题KEY') }}</label>
+                                    <select class="form-control" name="theme_key">
+                                        <option value="">-- 无主题 --</option>
+                                        @foreach($themes as $theme)
+                                            <option value="{{$theme->ThemeKey}}">{{$theme->ThemeKey}}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <button type="submit" class="btn btn-gradient-primary mr-2">{{ __('auto.提交') }}</button>
+                                <a href="{{ url('admin/banner') }}" class="btn btn-light">{{ __('auto.取消') }}</a>
+                            </form>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script>
+        $('#bannerForm').on('submit', function(e) {
+            e.preventDefault();
+
+            var formData = $(this).serialize();
+
+            $.ajax({
+                url: '{{ url("admin/banner/add") }}',
+                type: 'POST',
+                data: formData,
+                success: function(res) {
+                    if (res.code === 200) {
+                        alert('添加成功');
+                        window.location.href = '{{ url("admin/banner") }}';
+                    } else {
+                        alert(res.msg || '添加失败');
+                    }
+                }
+            });
+        });
+    </script>
+@endsection

+ 84 - 0
resources/views/admin/banner/edit.blade.php

@@ -0,0 +1,84 @@
+@extends('base.base')
+@section('base')
+    <div class="main-panel">
+        <div class="content-wrapper">
+            <div class="page-header">
+                <h3 class="page-title">
+                    <span class="page-title-icon bg-gradient-primary text-white mr-2">
+                        <i class="mdi mdi-image-multiple"></i>
+                    </span>
+                    {{ __('auto.编辑Banner') }}
+                </h3>
+            </div>
+            <div class="row">
+                <div class="col-12 grid-margin">
+                    <div class="card">
+                        <div class="card-body">
+                            <form id="bannerForm">
+                                <div class="form-group">
+                                    <label>{{ __('auto.图片URL') }} *</label>
+                                    <input type="text" class="form-control" name="img" value="{{$info->img}}" required>
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.葡萄牙语图片URL') }}</label>
+                                    <input type="text" class="form-control" name="img_pt" value="{{$info->img_pt}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.西班牙语图片URL') }}</label>
+                                    <input type="text" class="form-control" name="img_es" value="{{$info->img_es}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>Alt Text</label>
+                                    <input type="text" class="form-control" name="alt" value="{{$info->alt}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>Link Game ID</label>
+                                    <input type="number" class="form-control" name="link_game" value="{{$info->link_game}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>Link Module ID</label>
+                                    <input type="number" class="form-control" name="link_module" value="{{$info->link_module}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.主题KEY') }}</label>
+                                    <select class="form-control" name="theme_key">
+                                        <option value="">-- 无主题 --</option>
+                                        @foreach($themes as $theme)
+                                            <option value="{{$theme->ThemeKey}}" {{ $info->theme_key == $theme->ThemeKey ? 'selected' : '' }}>
+                                                {{$theme->ThemeKey}}
+                                            </option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <button type="submit" class="btn btn-gradient-primary mr-2">{{ __('auto.提交') }}</button>
+                                <a href="{{ url('admin/banner') }}" class="btn btn-light">{{ __('auto.取消') }}</a>
+                            </form>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script>
+        $('#bannerForm').on('submit', function(e) {
+            e.preventDefault();
+
+            var formData = $(this).serialize();
+
+            $.ajax({
+                url: '{{ url("admin/banner/edit/".$info->bid) }}',
+                type: 'POST',
+                data: formData,
+                success: function(res) {
+                    if (res.code === 200) {
+                        alert('更新成功');
+                        window.location.href = '{{ url("admin/banner") }}';
+                    } else {
+                        alert(res.msg || '更新失败');
+                    }
+                }
+            });
+        });
+    </script>
+@endsection

+ 109 - 0
resources/views/admin/banner/index.blade.php

@@ -0,0 +1,109 @@
+@extends('base.base')
+@section('base')
+    <div class="main-panel">
+        <div class="content-wrapper">
+            <div class="page-header">
+                <h3 class="page-title">
+                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
+                        <i class="mdi mdi-image-multiple"></i>
+                    </span>
+                    {{ __('auto.Banner管理') }}
+                </h3>
+                <nav aria-label="breadcrumb">
+                    <ol class="breadcrumb">
+                        <li class="breadcrumb-item"><a href="#">{{ __('auto.内容管理') }}</a></li>
+                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.Banner管理') }}</li>
+                    </ol>
+                </nav>
+            </div>
+            <div class="row">
+                <div class="col-lg-12 grid-margin stretch-card">
+                    <div class="card">
+                        <div class="card-body">
+                            <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
+                                <h4 class="card-title">{{ __('auto.Banner列表') }}</h4>
+                                <a href="{{ url('admin/banner/add') }}" class="btn btn-gradient-primary">{{ __('auto.添加Banner') }}</a>
+                            </div>
+
+                            <!-- 筛选 -->
+                            <form method="GET" action="{{ url('admin/banner') }}" class="mb-3">
+                                <div class="form-row">
+                                    <div class="col-md-3">
+                                        <select class="form-control" name="theme_key">
+                                            <option value="">-- 全部主题 --</option>
+                                            @foreach($themes as $theme)
+                                                <option value="{{$theme->ThemeKey}}" {{ $theme_key == $theme->ThemeKey ? 'selected' : '' }}>
+                                                    {{$theme->ThemeKey}}
+                                                </option>
+                                            @endforeach
+                                        </select>
+                                    </div>
+                                    <div class="col-md-2">
+                                        <button type="submit" class="btn btn-primary">{{ __('auto.搜索') }}</button>
+                                    </div>
+                                </div>
+                            </form>
+
+                            <table class="table table-bordered">
+                                <thead>
+                                <tr>
+                                    <th>ID</th>
+                                    <th>{{ __('auto.图片') }}</th>
+                                    <th>Alt</th>
+                                    <th>Link Game</th>
+                                    <th>Link Module</th>
+                                    <th>{{ __('auto.主题KEY') }}</th>
+                                    <th>{{ __('auto.操作') }}</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                @foreach($list as $v)
+                                    <tr>
+                                        <td>{{$v->bid}}</td>
+                                        <td>
+                                            @if($v->img)
+                                                <img src="{{$v->img}}" style="max-width: 200px; height: auto;" alt="Banner">
+                                            @endif
+                                        </td>
+                                        <td>{{$v->alt}}</td>
+                                        <td>{{$v->link_game}}</td>
+                                        <td>{{$v->link_module}}</td>
+                                        <td>{{$v->theme_key}}</td>
+                                        <td>
+                                            <a href="{{ url('admin/banner/edit/'.$v->bid) }}" class="btn btn-sm btn-gradient-info">{{ __('auto.编辑') }}</a>
+                                            <button class="btn btn-sm btn-gradient-danger" onclick="deleteBanner({{$v->bid}})">{{ __('auto.删除') }}</button>
+                                        </td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+                            <div class="box-footer clearfix" id="pages">
+                                {{ __('auto.总共') }} <b>{{ $list->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
+                                {!! $list->links() !!}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script>
+        function deleteBanner(id) {
+            if (confirm('确认删除此Banner?')) {
+                $.ajax({
+                    url: '/admin/banner/delete/' + id,
+                    type: 'POST',
+                    success: function(res) {
+                        if (res.code === 200) {
+                            alert('删除成功');
+                            location.reload();
+                        } else {
+                            alert(res.msg || '删除失败');
+                        }
+                    }
+                });
+            }
+        }
+    </script>
+@endsection

+ 2 - 6
resources/views/admin/channel/quick_create_channel.blade.php

@@ -45,9 +45,7 @@
                                 <div class="form-group">
                                     <label for="adminSign">{{ __('auto.权限群组') }} <span class="text-danger">*</span></label>
                                     <select class="form-control" name="adminSign" id="adminSign" required>
-                                        <option value="dk">dk (Aries)</option>
-                                        <option value="xidu">xidu ({{ __('auto.自营') }})</option>
-                                        <option value="aresbigs">aresbigs (msea{{ __('auto.代投') }})</option>
+                                        <option value="xidu">({{ __('auto.自营') }})</option>
                                     </select>
                                     <small class="form-text text-muted">{{ __('auto.选择该渠道所属的权限群组') }}</small>
                                 </div>
@@ -55,9 +53,7 @@
                                 <div class="alert alert-info" role="alert">
                                     <strong>{{ __('auto.说明') }}:</strong>
                                     <ul class="mb-0">
-                                        <li>dk (Aries): {{ __('auto.联运通道,渠道名会自动添加 USA_ 前缀') }}</li>
-                                        <li>xidu ({{ __('auto.自营') }}): {{ __('auto.自营渠道,渠道名会自动添加 NEW_ 前缀') }}</li>
-                                        <li>aresbigs (msea{{ __('auto.代投') }}): {{ __('auto.代投渠道,渠道名会自动添加 NEW_ 前缀') }}</li>
+                                        <li>({{ __('auto.自营') }}): {{ __('auto.自营渠道,渠道名会自动添加 NEW_ 前缀') }}</li>
                                     </ul>
                                 </div>
 

+ 93 - 0
resources/views/admin/web_region_config/edit.blade.php

@@ -0,0 +1,93 @@
+@extends('base.base')
+@section('base')
+    <div class="main-panel">
+        <div class="content-wrapper">
+            <div class="page-header">
+                <h3 class="page-title">
+                    <span class="page-title-icon bg-gradient-primary text-white mr-2">
+                        <i class="mdi mdi-earth"></i>
+                    </span>
+                    {{ __('auto.编辑虚拟分区配置') }}
+                </h3>
+            </div>
+            <div class="row">
+                <div class="col-12 grid-margin">
+                    <div class="card">
+                        <div class="card-body">
+                            <form id="regionForm">
+                                <div class="form-group">
+                                    <label>RegionID</label>
+                                    <input type="text" class="form-control" name="RegionID" value="{{$info->RegionID}}" required>
+                                </div>
+                                <div class="form-group">
+                                    <label>DomainUrl</label>
+                                    <input type="text" class="form-control" name="DomainUrl" value="{{$info->DomainUrl}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>LogoUrl</label>
+                                    <input type="text" class="form-control" name="LogoUrl" value="{{$info->LogoUrl}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>IconUrl</label>
+                                    <input type="text" class="form-control" name="IconUrl" value="{{$info->IconUrl}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>GroupID</label>
+                                    <input type="number" class="form-control" name="GroupID" value="{{$info->GroupID}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>GameDesc</label>
+                                    <textarea class="form-control" name="GameDesc" rows="3">{{$info->GameDesc}}</textarea>
+                                </div>
+                                <div class="form-group">
+                                    <label>SuggestChannel</label>
+                                    <input type="text" class="form-control" name="SuggestChannel" value="{{$info->SuggestChannel}}">
+                                </div>
+                                <div class="form-group">
+                                    <label>BindChannels (多个用逗号分隔)</label>
+                                    <input type="text" class="form-control" name="BindChannels"
+                                        value="{{ is_array($info->BindChannels) ? implode(',', $info->BindChannels) : $info->BindChannels }}">
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.主题配色') }}</label>
+                                    <select class="form-control" name="ThemeKey">
+                                        <option value="">-- 无主题 --</option>
+                                        @foreach($themes as $theme)
+                                            <option value="{{$theme->ThemeKey}}" {{ $info->ThemeKey == $theme->ThemeKey ? 'selected' : '' }}>
+                                                {{$theme->ThemeKey}}
+                                            </option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <button type="submit" class="btn btn-gradient-primary mr-2">{{ __('auto.提交') }}</button>
+                                <a href="{{ url('admin/web_region_config') }}" class="btn btn-light">{{ __('auto.取消') }}</a>
+                            </form>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script>
+        $('#regionForm').on('submit', function(e) {
+            e.preventDefault();
+
+            var formData = $(this).serialize();
+
+            $.ajax({
+                url: '{{ url("admin/web_region_config/edit/".$info->id) }}',
+                type: 'POST',
+                data: formData,
+                success: function(res) {
+                    if (res.code === 200) {
+                        alert('更新成功');
+                        window.location.href = '{{ url("admin/web_region_config") }}';
+                    } else {
+                        alert(res.msg || '更新失败');
+                    }
+                }
+            });
+        });
+    </script>
+@endsection

+ 6 - 0
resources/views/admin/web_region_config/index.blade.php

@@ -32,6 +32,8 @@
                                     <th>Icon</th>
                                     <th>GroupID</th>
                                     <th>BindChannels</th>
+                                    <th>ThemeKey</th>
+                                    <th>{{ __('auto.操作') }}</th>
                                 </tr>
                                 </thead>
                                 <tbody>
@@ -58,6 +60,10 @@
                                                 {{ is_array($v->BindChannels) ? implode(',', $v->BindChannels) : $v->BindChannels }}
                                             @endif
                                         </td>
+                                        <td>{{$v->ThemeKey}}</td>
+                                        <td>
+                                            <a href="{{ url('admin/web_region_config/edit/'.$v->id) }}" class="btn btn-sm btn-gradient-info">{{ __('auto.编辑') }}</a>
+                                        </td>
                                     </tr>
                                 @endforeach
                                 </tbody>

+ 74 - 0
resources/views/admin/web_theme_config/add.blade.php

@@ -0,0 +1,74 @@
+@extends('base.base')
+@section('base')
+    <div class="main-panel">
+        <div class="content-wrapper">
+            <div class="page-header">
+                <h3 class="page-title">
+                    <span class="page-title-icon bg-gradient-primary text-white mr-2">
+                        <i class="mdi mdi-palette"></i>
+                    </span>
+                    {{ __('auto.添加主题配置') }}
+                </h3>
+            </div>
+            <div class="row">
+                <div class="col-12 grid-margin">
+                    <div class="card">
+                        <div class="card-body">
+                            <form id="themeForm">
+                                <div class="form-group">
+                                    <label>{{ __('auto.主题KEY') }}</label>
+                                    <input type="text" class="form-control" name="ThemeKey" required>
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.绑定的Region (多个用逗号分隔)') }}</label>
+                                    <div class="region-checkboxes">
+                                        @foreach($regions as $region)
+                                            <div class="form-check">
+                                                <label class="form-check-label">
+                                                    <input type="checkbox" class="form-check-input" name="region_ids[]" value="{{$region->id}}">
+                                                    {{$region->RegionID}} (ID: {{$region->id}})
+                                                </label>
+                                            </div>
+                                        @endforeach
+                                    </div>
+                                </div>
+                                <button type="submit" class="btn btn-gradient-primary mr-2">{{ __('auto.提交') }}</button>
+                                <a href="{{ url('admin/web_theme_config') }}" class="btn btn-light">{{ __('auto.取消') }}</a>
+                            </form>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script>
+        $('#themeForm').on('submit', function(e) {
+            e.preventDefault();
+
+            var checkedIds = [];
+            $('input[name="region_ids[]"]:checked').each(function() {
+                checkedIds.push($(this).val());
+            });
+
+            var formData = {
+                ThemeKey: $('input[name="ThemeKey"]').val(),
+                BindRegions: checkedIds.join(',')
+            };
+
+            $.ajax({
+                url: '{{ url("admin/web_theme_config/add") }}',
+                type: 'POST',
+                data: formData,
+                success: function(res) {
+                    if (res.code === 200) {
+                        alert('添加成功');
+                        window.location.href = '{{ url("admin/web_theme_config") }}';
+                    } else {
+                        alert(res.msg || '添加失败');
+                    }
+                }
+            });
+        });
+    </script>
+@endsection

+ 78 - 0
resources/views/admin/web_theme_config/edit.blade.php

@@ -0,0 +1,78 @@
+@extends('base.base')
+@section('base')
+    <div class="main-panel">
+        <div class="content-wrapper">
+            <div class="page-header">
+                <h3 class="page-title">
+                    <span class="page-title-icon bg-gradient-primary text-white mr-2">
+                        <i class="mdi mdi-palette"></i>
+                    </span>
+                    {{ __('auto.编辑主题配置') }}
+                </h3>
+            </div>
+            <div class="row">
+                <div class="col-12 grid-margin">
+                    <div class="card">
+                        <div class="card-body">
+                            <form id="themeForm">
+                                <div class="form-group">
+                                    <label>{{ __('auto.主题KEY') }}</label>
+                                    <input type="text" class="form-control" name="ThemeKey" value="{{$info->ThemeKey}}" required>
+                                </div>
+                                <div class="form-group">
+                                    <label>{{ __('auto.绑定的Region') }}</label>
+                                    <div class="region-checkboxes">
+                                        @php
+                                            $bindRegions = is_array($info->BindRegions) ? $info->BindRegions : [];
+                                        @endphp
+                                        @foreach($regions as $region)
+                                            <div class="form-check">
+                                                <label class="form-check-label">
+                                                    <input type="checkbox" class="form-check-input" name="region_ids[]" value="{{$region->id}}"
+                                                        {{ in_array($region->id, $bindRegions) ? 'checked' : '' }}>
+                                                    {{$region->RegionID}} (ID: {{$region->id}})
+                                                </label>
+                                            </div>
+                                        @endforeach
+                                    </div>
+                                </div>
+                                <button type="submit" class="btn btn-gradient-primary mr-2">{{ __('auto.提交') }}</button>
+                                <a href="{{ url('admin/web_theme_config') }}" class="btn btn-light">{{ __('auto.取消') }}</a>
+                            </form>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script>
+        $('#themeForm').on('submit', function(e) {
+            e.preventDefault();
+
+            var checkedIds = [];
+            $('input[name="region_ids[]"]:checked').each(function() {
+                checkedIds.push($(this).val());
+            });
+
+            var formData = {
+                ThemeKey: $('input[name="ThemeKey"]').val(),
+                BindRegions: checkedIds.join(',')
+            };
+
+            $.ajax({
+                url: '{{ url("admin/web_theme_config/edit/".$info->id) }}',
+                type: 'POST',
+                data: formData,
+                success: function(res) {
+                    if (res.code === 200) {
+                        alert('更新成功');
+                        window.location.href = '{{ url("admin/web_theme_config") }}';
+                    } else {
+                        alert(res.msg || '更新失败');
+                    }
+                }
+            });
+        });
+    </script>
+@endsection

+ 84 - 0
resources/views/admin/web_theme_config/index.blade.php

@@ -0,0 +1,84 @@
+@extends('base.base')
+@section('base')
+    <!-- 内容区域 -->
+    <div class="main-panel">
+        <div class="content-wrapper">
+            <div class="page-header">
+                <h3 class="page-title">
+                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
+                        <i class="mdi mdi-palette"></i>
+                    </span>
+                    {{ __('auto.主题配置管理') }}
+                </h3>
+                <nav aria-label="breadcrumb">
+                    <ol class="breadcrumb">
+                        <li class="breadcrumb-item"><a href="#">{{ __('auto.渠道管理') }}</a></li>
+                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.主题配置管理') }}</li>
+                    </ol>
+                </nav>
+            </div>
+            <div class="row">
+                <div class="col-lg-12 grid-margin stretch-card">
+                    <div class="card">
+                        <div class="card-body">
+                            <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
+                                <h4 class="card-title">{{ __('auto.主题列表') }}</h4>
+                                <a href="{{ url('admin/web_theme_config/add') }}" class="btn btn-gradient-primary">{{ __('auto.添加主题') }}</a>
+                            </div>
+                            <table class="table table-bordered">
+                                <thead>
+                                <tr>
+                                    <th>ID</th>
+                                    <th>{{ __('auto.主题KEY') }}</th>
+                                    <th>{{ __('auto.绑定的Region ID') }}</th>
+                                    <th>{{ __('auto.操作') }}</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                @foreach($list as $v)
+                                    <tr>
+                                        <td>{{$v->id}}</td>
+                                        <td>{{$v->ThemeKey}}</td>
+                                        <td>
+                                            @if($v->BindRegions)
+                                                {{ is_array($v->BindRegions) ? implode(',', $v->BindRegions) : $v->BindRegions }}
+                                            @endif
+                                        </td>
+                                        <td>
+                                            <a href="{{ url('admin/web_theme_config/edit/'.$v->id) }}" class="btn btn-sm btn-gradient-info">{{ __('auto.编辑') }}</a>
+                                            <button class="btn btn-sm btn-gradient-danger" onclick="deleteTheme({{$v->id}})">{{ __('auto.删除') }}</button>
+                                        </td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+                            <div class="box-footer clearfix" id="pages">
+                                {{ __('auto.总共') }} <b>{{ $list->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
+                                {!! $list->links() !!}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script>
+        function deleteTheme(id) {
+            if (confirm('确认删除此主题配置?')) {
+                $.ajax({
+                    url: '/admin/web_theme_config/delete/' + id,
+                    type: 'POST',
+                    success: function(res) {
+                        if (res.code === 200) {
+                            alert('删除成功');
+                            location.reload();
+                        } else {
+                            alert(res.msg || '删除失败');
+                        }
+                    }
+                });
+            }
+        }
+    </script>
+@endsection

+ 17 - 0
routes/web.php

@@ -269,6 +269,8 @@ Route::group([
 
         $route->any('/channel/channel_new', 'Admin\ChannelController@channelNew');
 
+        $route->any('/channel/quick_create_channel', 'Admin\ChannelController@quickCreateChannel');
+
         $route->get('/channel/list', 'Admin\ChannelController@index');
         $route->any('/channel/channel_add', 'Admin\ChannelController@channelAdd');
         $route->any('/channel/channel_edit/{id}', 'Admin\ChannelController@channelEdit');
@@ -336,6 +338,21 @@ Route::group([
         // 虚拟分区配置查看
         $route->get('/web_region_config/list', 'Admin\WebRegionConfigController@index');
 
+        $route->any('/web_region_config/edit/{id}', 'Admin\WebRegionConfigController@edit');
+
+        // 主题配置管理
+        $route->get('/web_theme_config', 'Admin\WebThemeConfigController@index');
+        $route->any('/web_theme_config/add', 'Admin\WebThemeConfigController@add');
+        $route->any('/web_theme_config/edit/{id}', 'Admin\WebThemeConfigController@edit');
+        $route->post('/web_theme_config/delete/{id}', 'Admin\WebThemeConfigController@delete');
+
+        // Banner管理
+        $route->get('/banner', 'Admin\BannerController@index');
+        $route->any('/banner/add', 'Admin\BannerController@add');
+        $route->any('/banner/edit/{id}', 'Admin\BannerController@edit');
+        $route->post('/banner/delete/{id}', 'Admin\BannerController@delete');
+
+
 
         //实时数据
         $route->get('/livedata/gameinfo', 'Admin\LiveDataController@gameInfo');