IndexController.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. $userInfo = $weChat->userDetailInfo($userInfo['openid']);
  26. var_dump($userInfo);
  27. return Response::success();
  28. }catch (\Exception $exception){
  29. LogHelper::exceptionLog($exception,$this->code);
  30. return Response::fail($exception->getMessage());
  31. }
  32. }
  33. //隐私政策
  34. public function privacyPolice()
  35. {
  36. $info = Setting::where('key', 'privacy')->where('is_delete', 0)->select('title', 'key', 'value')->first();
  37. return $this->success($info);
  38. }
  39. //用户协议
  40. public function userAgreement()
  41. {
  42. $info = Setting::where('key', 'agreement')->where('is_delete', 0)->select('title', 'key', 'value')->first();
  43. return $this->success($info);
  44. }
  45. //关于我们
  46. public function aboutus()
  47. {
  48. $info = Setting::where('key', 'aboutus')->where('is_delete', 0)->select('title', 'key', 'value')->first();
  49. return $this->success($info);
  50. }
  51. }