修复钉钉登录异常问题
Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
parent
b145cc9336
commit
a669a8a670
@ -136,8 +136,8 @@ class Member extends CommonModel
|
||||
public static function dingtalkLogin($userInfo)
|
||||
{
|
||||
$currentMember = getCurrentMember();
|
||||
$where = ['code' => $currentMember['code']];
|
||||
if ($currentMember) {
|
||||
$where = ['code' => $currentMember['code']];
|
||||
$currentMember = self::where($where)->find();
|
||||
}
|
||||
$unionid = $userInfo['unionid'];
|
||||
@ -157,7 +157,7 @@ class Member extends CommonModel
|
||||
$member = self::createMember($memberData);
|
||||
} else {
|
||||
//已登录且未绑定,则绑定
|
||||
if (!$currentMember['dingtalk_unionid']) {
|
||||
if (!$currentMember['dingtalk_unionid'] || !$currentMember['dingtalk_userid']) {
|
||||
self::update($memberData, $where);
|
||||
$member = self::where($where)->find();
|
||||
}
|
||||
@ -166,6 +166,9 @@ class Member extends CommonModel
|
||||
if ($currentMember && $member['dingtalk_unionid'] != $currentMember['dingtalk_unionid']) {
|
||||
return error('1', '您想要绑定的第三方帐号已经被绑定给其他帐号,请先用该第三方帐号登录后,解绑释放它,再切回当前帐号发起绑定');
|
||||
}
|
||||
if (!$member['dingtalk_userid']) {
|
||||
self::update($memberData, ['code' => $member['code']]);
|
||||
}
|
||||
}
|
||||
self::login($member);
|
||||
return $member;
|
||||
|
@ -25,6 +25,27 @@ class Oauth extends BasicApi
|
||||
|
||||
public function index()
|
||||
{
|
||||
$app = new Application(config('dingtalk.'));
|
||||
$msg = [
|
||||
'msgtype' => "oa",
|
||||
'oa' => [
|
||||
'message_url' => 'http://dingtalk.com',
|
||||
'head' => ['bgcolor' => 'FFBBBBBB', 'title' => '消息通知'],
|
||||
'body' => ['title' => '888', 'content' => '666'],
|
||||
]
|
||||
];
|
||||
$params = [
|
||||
'agent_id'=> '271863764',
|
||||
'userid_list' => 'manager9168',
|
||||
'msg'=> json_encode($msg)
|
||||
];
|
||||
$res = $app->conversation->sendCorporationMessage($params);
|
||||
echo json_encode($res);die;
|
||||
$userId = $app->user->getUseridByUnionid('3CnKFHEE7mX1hayPIHvpCwiEiE');
|
||||
// echo json_encode($userId);die;
|
||||
$userId = $userId['userid'];
|
||||
$user = $app->user->get($userId, $lang = null);
|
||||
echo json_encode($user);die;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +95,7 @@ class Oauth extends BasicApi
|
||||
'unionid' => $user['unionid'],
|
||||
'openid' => $user['openId'],
|
||||
'userId' => $user['userid'],
|
||||
'name' => $user['name'],
|
||||
'nick' => $user['name'],
|
||||
'avatar' => $user['avatar'],
|
||||
'mobile' => $user['mobile'],
|
||||
'email' => $user['email'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user