liyinglin 3 years ago
parent fc9ace9cee
commit 883f0f1cfa

@ -41,7 +41,6 @@ class UserController extends CommonController
$appSecret = \config('app.wechat_appsecret'); $appSecret = \config('app.wechat_appsecret');
$url = "https://api.weixin.qq.com/sns/jscode2session?appid=" . $appid . "&secret=" . $appSecret . "&js_code={$all['code']}&grant_type=authorization_code"; $url = "https://api.weixin.qq.com/sns/jscode2session?appid=" . $appid . "&secret=" . $appSecret . "&js_code={$all['code']}&grant_type=authorization_code";
$userInfo = json_decode(file_get_contents($url), true); $userInfo = json_decode(file_get_contents($url), true);
dd($userInfo);
if (!isset($userInfo['openid'])) { if (!isset($userInfo['openid'])) {
return $this->fail([ResponseCode::ERROR_BUSINESS, 'code异常']); return $this->fail([ResponseCode::ERROR_BUSINESS, 'code异常']);
} }

@ -12,6 +12,7 @@ class User extends Authenticatable
{ {
use HasApiTokens, HasFactory, Notifiable; use HasApiTokens, HasFactory, Notifiable;
protected $guarded = ['id'];
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
* *

Loading…
Cancel
Save