微信小程序和公众号中,同一个用户在不同的应用中的openId是不同的,也就是说同一个用户在一个小程序和对应的公众号上是无法通过openId对应的,需要用微信唯一的unionId进行对应,还需要进行unionid和openId的转换。
先写拉取关注公众号的用户数据列表。
数据库表结构:
/*
Navicat Premium Data Transfer
Source Server : yixue1
Source Server Type : MySQL
Source Server Version : 80024
Source Host : 110.42.3.22:3306
Source Schema : yixue
Target Server Type : MySQL
Target Server Version : 80024
File Encoding : 65001
Date: 15/08/2022 16:40:25
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for wx_official_account_user
-- ----------------------------
DROP TABLE IF EXISTS `wx_official_account_user`;
CREATE TABLE `wx_official_account_user` (
`id`