IndexController.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace App\Http\Controllers\V1;
  3. use App\Auth;
  4. use App\libs\helpers\Curl;
  5. use App\libs\helpers\LogHelper;
  6. use App\libs\wechat\auth\WeChat;
  7. use App\Models\Help;
  8. use App\Models\Region;
  9. use Illuminate\Http\Request;
  10. use App\Models\Setting;
  11. use Illuminate\Support\Facades\Redis;
  12. use App\libs\helpers\Response;
  13. class IndexController extends Controller
  14. {
  15. private $code = '_Index';
  16. /**
  17. * 首页
  18. *
  19. * @return \Illuminate\Http\JsonResponse
  20. */
  21. public function index(){
  22. try {
  23. $weChat = WeChat::General();
  24. $userInfo = $weChat->auth('snsapi_userinfo');
  25. var_dump($userInfo);
  26. return Response::success();
  27. }catch (\Exception $exception){
  28. LogHelper::exceptionLog($exception,$this->code);
  29. return Response::fail($exception->getMessage());
  30. }
  31. }
  32. //隐私政策
  33. public function privacyPolice()
  34. {
  35. $info = Setting::where('key', 'privacy')->where('is_delete', 0)->select('title', 'key', 'value')->first();
  36. return $this->success($info);
  37. }
  38. //用户协议
  39. public function userAgreement()
  40. {
  41. $info = Setting::where('key', 'agreement')->where('is_delete', 0)->select('title', 'key', 'value')->first();
  42. return $this->success($info);
  43. }
  44. //关于我们
  45. public function aboutus()
  46. {
  47. $info = Setting::where('key', 'aboutus')->where('is_delete', 0)->select('title', 'key', 'value')->first();
  48. return $this->success($info);
  49. }
  50. }