SettingController.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Http\Controllers\V1;
  3. use App\Models\Banner;
  4. use App\Models\Contact;
  5. use App\Models\ProductHot;
  6. use App\Models\User;
  7. use Cache;
  8. use EasyWeChat\Factory;
  9. use Illuminate\Http\JsonResponse;
  10. use Illuminate\Http\Request;
  11. use Illuminate\Support\Facades\Auth;
  12. use Illuminate\Support\Facades\DB;
  13. use Laravel\Socialite\Facades\Socialite;
  14. use PHPUnit\Util\Exception;
  15. use Validator;
  16. class SettingController extends Controller
  17. {
  18. public function loginBanner(): JsonResponse
  19. {
  20. $lists = Banner::select(['name','image'])
  21. ->where('is_opened' ,1)
  22. ->orderByDesc('sort')
  23. ->get();
  24. return $this->success($lists);
  25. }
  26. public function contact(): JsonResponse
  27. {
  28. $lists = Contact::select(['name','phone_num','wechat_num'])->get();
  29. return $this->success($lists);
  30. }
  31. public function indexBanner(): JsonResponse
  32. {
  33. $lists = ProductHot::select(['cover_img as image','product_id'])
  34. ->where('type',\user()->account->type)
  35. ->where('is_opened' ,1)
  36. ->orderByDesc('sort')
  37. ->get();
  38. return $this->success($lists);
  39. }
  40. }