1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Http\Controllers\Api\V1;
- use App\Http\Controllers\Controller;
- use Illuminate\Http\Request;
- use App\Facades\ThirdWxFacade;
- use App\Facades\UserFacade;
- use Illuminate\Support\Facades\Log;
- class ThirdWxController extends Controller
- {
- /**
- * 授权的url
- *
- * @return \Illuminate\Http\Response
- */
- public function auth(Request $request)
- {
- return ThirdWxFacade::authorization();
- }
- public function getUserInfo(Request $request)
- {
- if (empty($request->weichat_uid)) {
- return 0;
- }
- $userInfo = ThirdWxFacade::getUserInfo($request->weichat_uid);
- Log::info('getUserInfo', [$userInfo]);
- $wxUserInfo = $userInfo->getData()->data->datas;
- Log::info('wxUserInfo', [$wxUserInfo]);
- Log::info('IP', [$request->ip()]);
- if (isset($wxUserInfo->id)){
- return $login = UserFacade::wxWebLoginOrReg('', $request->ip(), $wxUserInfo, $request->weichat_uid);
- }
- // return $userInfo;
- }
- public function getJsSdk(Request $request){
- $url = $request->url;
- return ThirdWxFacade::getJsSdk(config('console.thirdWx.weid'), $url);
- }
- }
|