12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?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::select(['name as title','image','episode_id'])
- ->where('status',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);
- }
- }
|