SettingController.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. $type = \user()->account->type != 1 ? 2 : 1;
  34. $lists = ProductHot::select(['cover_img as image','product_id'])
  35. ->where('type',$type)
  36. ->where('is_opened' ,1)
  37. ->orderByDesc('sort')
  38. ->get();
  39. return $this->success($lists);
  40. }
  41. }