Jelajahi Sumber

修复小程序 unionid 获取

邹景立 4 tahun lalu
induk
melakukan
41362b42c8

+ 1 - 1
app/data/controller/api/Wxapp.php

@@ -117,7 +117,7 @@ class Wxapp extends Controller
             $result = Crypt::instance($this->config)->session($code);
             if (isset($result['openid']) && isset($result['session_key'])) {
                 $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'])) {
                 $this->error($result['errmsg']);
             } else {

+ 1 - 1
app/data/service/UserAdminService.php

@@ -120,7 +120,7 @@ class UserAdminService extends Service
     public function getUserUniMap(string $field, string $openid, string $unionid = ''): array
     {
         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')) {
                 return ['id' => $uid];
             }