1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- namespace App\Http\Controllers\V1;
- use App\Models\Banner;
- use App\Models\HomeColumn;
- use App\Models\NavBar;
- use App\Models\RechargeCombo;
- use App\Models\Setting;
- use App\Models\Tabbar;
- use App\Models\VipCombo;
- class SettingController extends Controller
- {
- /**
- * 底部导航.
- */
- public function tabBar()
- {
- $all = Tabbar::select(['name as text', 'icon', 'selected_icon', 'type'])
- ->where('status', 1)
- ->orderBy('sort')
- ->get();
- return $this->success($all);
- }
- /**
- * 首页顶部分类.
- */
- public function navBar()
- {
- $all = NavBar::select(['name', 'icon', 'type'])
- ->where('status', 1)
- ->orderBy('sort')
- ->get();
- return $this->success($all);
- }
- /**
- * 首页顶部分类.
- */
- public function banner()
- {
- $all = Banner::query()
- ->where('state', 1)
- ->orderBy('sort')
- ->get();
- return $this->success($all);
- }
- public function homeColumn()
- {
- $all = HomeColumn::select(['name', 'type'])
- ->where('status', 1)
- ->orderBy('sort')
- ->get();
- return $this->success($all);
- }
- public function rechargeCombo()
- {
- $lists = RechargeCombo::where('status', 1)->get()->toArray();
- $vipCombo = VipCombo::select(['id', 'name', 'price', 'valid_day', 'desc'])
- ->where('status', 1)
- ->orderByDesc('valid_day')
- ->first()->toArray();
- $vipCombo['vip_combo'] = 1;
- $offset = collect($lists)->count() > 6 ? 5 : collect($lists)->count();
- array_splice($lists, $offset, 1, [$vipCombo]);
- return $this->success($lists);
- }
- public function config()
- {
- $config = Setting::first();
- return $this->success($config);
- }
- }
|