mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-22 14:59:14 +08:00
修复小程序 unionid 获取
This commit is contained in:
parent
c65cacdea3
commit
41362b42c8
@ -117,7 +117,7 @@ class Wxapp extends Controller
|
|||||||
$result = Crypt::instance($this->config)->session($code);
|
$result = Crypt::instance($this->config)->session($code);
|
||||||
if (isset($result['openid']) && isset($result['session_key'])) {
|
if (isset($result['openid']) && isset($result['session_key'])) {
|
||||||
$this->app->cache->set($code, $result, 60);
|
$this->app->cache->set($code, $result, 60);
|
||||||
return [$result['openid'], $cache['unionid'] ?? '', $result['session_key']];
|
return [$result['openid'], $result['unionid'] ?? '', $result['session_key']];
|
||||||
} elseif (isset($result['errmsg'])) {
|
} elseif (isset($result['errmsg'])) {
|
||||||
$this->error($result['errmsg']);
|
$this->error($result['errmsg']);
|
||||||
} else {
|
} else {
|
||||||
|
@ -120,7 +120,7 @@ class UserAdminService extends Service
|
|||||||
public function getUserUniMap(string $field, string $openid, string $unionid = ''): array
|
public function getUserUniMap(string $field, string $openid, string $unionid = ''): array
|
||||||
{
|
{
|
||||||
if (!empty($unionid)) {
|
if (!empty($unionid)) {
|
||||||
[$map1, $map2] = [[['unionid', 'eq', $unionid]], [[$field, 'eq', $openid]]];
|
[$map1, $map2] = [[['unionid', '=', $unionid]], [[$field, '=', $openid]]];
|
||||||
if ($uid = $this->app->db->name('DataUser')->whereOr([$map1, $map2])->value('id')) {
|
if ($uid = $this->app->db->name('DataUser')->whereOr([$map1, $map2])->value('id')) {
|
||||||
return ['id' => $uid];
|
return ['id' => $uid];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user