<?php

namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use App\Services\ConfigService;
use Illuminate\Http\Request;

class ApiMapController extends Controller
{

  //获取站点配置信息
  public function h5()
  {
    $base_url = env('APP_URL');
    return [];
  }

  //获取站点配置信息
  public function public()
  {
    $base_url = env('APP_URL');
    return [
      'OrderList' => $base_url . '/api/H5/Order/list',
      'ComboList' => $base_url . '/api/H5/Combo/list',
      'ComboSelect' => $base_url . '/api/H5/Combo/select',
      'UserInfo' => $base_url . '/api/H5/User/info',
      'ConfigVersion' => $base_url . '/api/H5/Config/version',
      'ConfigConfig' => $base_url . '/api/H5/Config/config',
      'DemoPay' => $base_url . '/api/Demo/pay',
      'ApiMapTest' => $base_url . '/api/ApiMap/test',
    ];
  }

  public function test()
  {
    return \Yz::Return(true, '获取成功', [
      'name' => env('APP_NAME'),
      'datetime' => date('Y-m-d H:i:s'),
    ]);
  }

  public function list($type)
  {
    $list = self::public();
    switch ($type) {
      case 'h5':
        $list = array_merge($list, self::h5());
        break;
    }
    return \Yz::Return(true, '获取成功', [
      'list' => $list
    ]);
  }
}
