2
0

WebRegionConfigController.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Game\WebRegionConfig;
  4. use Illuminate\Http\Request;
  5. class WebRegionConfigController
  6. {
  7. public function index(Request $request)
  8. {
  9. $list = WebRegionConfig::orderBy('GroupID', 'asc')->orderBy('id', 'asc')->paginate(40);
  10. return view('admin.web_region_config.index', [
  11. 'list' => $list,
  12. ]);
  13. }
  14. public function edit(Request $request, $id)
  15. {
  16. $info = WebRegionConfig::findOrFail($id);
  17. if ($request->isMethod('post')) {
  18. $post = $request->post();
  19. // 处理 BindChannels
  20. if (isset($post['BindChannels']) && is_string($post['BindChannels'])) {
  21. $channelIds = array_filter(array_map('trim', explode(',', $post['BindChannels'])));
  22. $post['BindChannels'] = array_map('intval', $channelIds);
  23. }
  24. $info->update($post);
  25. return apiReturnSuc();
  26. }
  27. // 获取所有主题配置供选择
  28. $themes = \App\Game\WebThemeConfig::all();
  29. return view('admin.web_region_config.edit', [
  30. 'info' => $info,
  31. 'themes' => $themes
  32. ]);
  33. }
  34. }