集成微信登录

article/2025/9/21 20:49:49

目录标题

  • 集成微信登录
    • 1、OAuth2
      • 1.1 作用
      • 1.2 多方授权的解决方法
      • 1.3 OAuth2最简向导
      • 1.4 OAuth2的应用
    • 2、微信登录介绍
      • 2.1 前期准备
      • 2.2 授权流程
    • 3、服务器端开发
      • 3.1 返回微信登录参数
      • 3.2 前端显示登录二维码
      • 3.3 处理微信回调
      • 3.4 回调返回页面

集成微信登录

1、OAuth2

1.1 作用

开放系统间授权

1.2 多方授权的解决方法

方式一:用户名密码复制

将受保护的资源中的用户名和密码存储在客户应用的服务器上,使用时直接使用这个用户名和密码登录

适用于同一公司内部的多个系统,不适用于不受信的第三方应用
方式二:通用开发者key
适用于合作商或者授信的不同业务部门之间

方式三:颁发令牌
接近OAuth2方式,需要考虑如何管理令牌、颁发令牌、吊销令牌,需要统一的协议,因此就有了OAuth2协议

1.3 OAuth2最简向导

最简向导
川崎高彦:OAuth2领域专家,开发了一个OAuth2 sass服务,OAuth2 as Service,并且做成了一个公司
在融资的过程中为了向投资人解释OAuth2是什么,于是写了一篇文章,《OAuth2最简向导》

1.4 OAuth2的应用

  1. 微服务安全
    现代微服务中系统微服务化以及应用的形态和设备类型增多,不能用传统的登录方式,核心的技术不是用户名和密码,而是token,由AuthServer颁发token,用户使用token进行登录

  2. 社交登录

2、微信登录介绍

2.1 前期准备

1、注册
微信开放平台:https://open.weixin.qq.com
2、邮箱激活
3、完善开发者资料
4、开发者资质认证
准备营业执照,1-2个工作日审批、300元
5、创建网站应用
提交审核,7个工作日审批
6、内网穿透
ngrok的使用

2.2 授权流程

参考文档:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=e547653f995d8f402704d5cb2945177dc8aa4e7e&lang=zh_CN
在这里插入图片描述

第一步:请求CODE(生成授权URL)
第二步:通过code获取access_token(开发回调URL)

3、服务器端开发

操作模块:service-user
说明:微信登录二维码我们是以弹出层的形式打开,不是以页面形式,所以做法是不一样的,参考如下链接,上面有相关弹出层的方式
https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html
如图:
在这里插入图片描述

因此我们的操作步骤为:

第一步我们通过接口把对应参数返回页面;
第二步在头部页面启动打开微信登录二维码;
第三步处理登录回调接口;
第四步回调返回页面通知微信登录层回调成功
第五步如果是第一次扫描登录,则绑定手机号码,登录成功
接下来我们根据步骤,一步一步实现

3.1 返回微信登录参数

3.1.1 添加配置
在application-dev.yml添加配置

wx.open.app_id=wxed9954c01bb89b47
wx.open.app_secret=a7482517235173ddb4083788de60b90e
wx.open.redirect_url=http://guli.shop/api/ucenter/wx/callback
yygh.baseUrl=http://localhost:3000

3.1.2 添加配置类

@Component
public class ConstantPropertiesUtil implements InitializingBean {@Value("${wx.open.app_id}")private String appId;@Value("${wx.open.app_secret}")private String appSecret;@Value("${wx.open.redirect_url}")private String redirectUrl;@Value("${yygh.baseUrl}")private String yyghBaseUrl;public static String WX_OPEN_APP_ID;public static String WX_OPEN_APP_SECRET;public static String WX_OPEN_REDIRECT_URL;public static String YYGH_BASE_URL;@Overridepublic void afterPropertiesSet() throws Exception {WX_OPEN_APP_ID = appId;WX_OPEN_APP_SECRET = appSecret;WX_OPEN_REDIRECT_URL = redirectUrl;YYGH_BASE_URL = yyghBaseUrl;}
}

3.1.3 添加接口
添加com.atguigu.yygh.user.api.WeixinApiController 类

@Controller
@RequestMapping("/api/ucenter/wx")
public class WeixinApiController {@Autowiredprivate UserInfoService userInfoService;@Autowiredprivate RedisTemplate redisTemplate;/*** 获取微信登录参数*/@GetMapping("getLoginParam")@ResponseBodypublic Result genQrConnect(HttpSession session) throws UnsupportedEncodingException {String redirectUri = URLEncoder.encode(ConstantPropertiesUtil.WX_OPEN_REDIRECT_URL, "UTF-8");Map<String, Object> map = new HashMap<>();map.put("appid", ConstantPropertiesUtil.WX_OPEN_APP_ID);map.put("redirectUri", redirectUri);map.put("scope", "snsapi_login");map.put("state", System.currentTimeMillis()+"");//System.currentTimeMillis()+""return Result.ok(map);}
}

3.2 前端显示登录二维码

3.2.1 封装api请求
创建/api/user/wexin.js文件

import request from '@/utils/request'const api_name = `/api/ucenter/wx`export default {getLoginParam() {return request({url: `${api_name}/getLoginParam`,method: `get`})}
}

3.2.2 修改组件
修改layouts/myheader.vue文件,添加微信二维码登录逻辑
1、引入api

import weixinApi from '@/api/weixin'

2、引入微信js

  mounted() {// 注册全局登录事件对象window.loginEvent = new Vue();// 监听登录事件loginEvent.$on('loginDialogEvent', function () {document.getElementById("loginDialog").click();})// 触发事件,显示登录层:loginEvent.$emit('loginDialogEvent')//初始化微信jsconst script = document.createElement('script')script.type = 'text/javascript'script.src = 'https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js'document.body.appendChild(script)// 微信登录回调处理let self = this;window["loginCallback"] = (name,token, openid) => {self.loginCallback(name, token, openid);}},

3、实例化微信JS对象
添加微信登录方法

loginCallback(name, token, openid) {// 打开手机登录层,绑定手机号,改逻辑与手机登录一致if(openid != '') {this.userInfo.openid = openidthis.showLogin()} else {this.setCookies(name, token)}
},weixinLogin() {this.dialogAtrr.showLoginType = 'weixin'weixinApi.getLoginParam().then(response => {var obj = new WxLogin({self_redirect:true,id: 'weixinLogin', // 需要显示的容器idappid: response.data.appid, // 公众号appid wx*******scope: response.data.scope, // 网页默认即可redirect_uri: response.data.redirectUri, // 授权成功后回调的urlstate: response.data.state, // 可设置为简单的随机数加session用来校验style: 'black', // 提供"black"、"white"可选。二维码的样式href: '' // 外部css文件url,需要https})})
},

说明:微信登录方法已绑定weixinLogin(),查看页面

3.3 处理微信回调

3.3.1 添加httpclient工具类
添加com.atguigu.yygh.user.util.HttpClientUtils类

public class HttpClientUtils {public static final int connTimeout=10000;public static final int readTimeout=10000;public static final String charset="UTF-8";private static HttpClient client = null;static {PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();cm.setMaxTotal(128);cm.setDefaultMaxPerRoute(128);client = HttpClients.custom().setConnectionManager(cm).build();}public static String postParameters(String url, String parameterStr) throws ConnectTimeoutException, SocketTimeoutException, Exception{return post(url,parameterStr,"application/x-www-form-urlencoded",charset,connTimeout,readTimeout);}public static String postParameters(String url, String parameterStr,String charset, Integer connTimeout, Integer readTimeout) throws ConnectTimeoutException, SocketTimeoutException, Exception{return post(url,parameterStr,"application/x-www-form-urlencoded",charset,connTimeout,readTimeout);}public static String postParameters(String url, Map<String, String> params) throws ConnectTimeoutException,SocketTimeoutException, Exception {return postForm(url, params, null, connTimeout, readTimeout);}public static String postParameters(String url, Map<String, String> params, Integer connTimeout,Integer readTimeout) throws ConnectTimeoutException,SocketTimeoutException, Exception {return postForm(url, params, null, connTimeout, readTimeout);}public static String get(String url) throws Exception {return get(url, charset, null, null);}public static String get(String url, String charset) throws Exception {return get(url, charset, connTimeout, readTimeout);}/*** 发送一个 Post 请求, 使用指定的字符集编码.** @param url* @param body RequestBody* @param mimeType 例如 application/xml "application/x-www-form-urlencoded" a=1&b=2&c=3* @param charset 编码* @param connTimeout 建立链接超时时间,毫秒.* @param readTimeout 响应超时时间,毫秒.* @return ResponseBody, 使用指定的字符集编码.* @throws ConnectTimeoutException 建立链接超时异常* @throws SocketTimeoutException  响应超时* @throws Exception*/public static String post(String url, String body, String mimeType,String charset, Integer connTimeout, Integer readTimeout)throws ConnectTimeoutException, SocketTimeoutException, Exception {HttpClient client = null;HttpPost post = new HttpPost(url);String result = "";try {if (StringUtils.isNotBlank(body)) {HttpEntity entity = new StringEntity(body, ContentType.create(mimeType, charset));post.setEntity(entity);}// 设置参数Builder customReqConf = RequestConfig.custom();if (connTimeout != null) {customReqConf.setConnectTimeout(connTimeout);}if (readTimeout != null) {customReqConf.setSocketTimeout(readTimeout);}post.setConfig(customReqConf.build());HttpResponse res;if (url.startsWith("https")) {// 执行 Https 请求.client = createSSLInsecureClient();res = client.execute(post);} else {// 执行 Http 请求.client = HttpClientUtils.client;res = client.execute(post);}result = IOUtils.toString(res.getEntity().getContent(), charset);} finally {post.releaseConnection();if (url.startsWith("https") && client != null&& client instanceof CloseableHttpClient) {((CloseableHttpClient) client).close();}}return result;}/*** 提交form表单** @param url* @param params* @param connTimeout* @param readTimeout* @return* @throws ConnectTimeoutException* @throws SocketTimeoutException* @throws Exception*/public static String postForm(String url, Map<String, String> params, Map<String, String> headers, Integer connTimeout,Integer readTimeout) throws ConnectTimeoutException,SocketTimeoutException, Exception {HttpClient client = null;HttpPost post = new HttpPost(url);try {if (params != null && !params.isEmpty()) {List<NameValuePair> formParams = new ArrayList<NameValuePair>();Set<Entry<String, String>> entrySet = params.entrySet();for (Entry<String, String> entry : entrySet) {formParams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));}UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, Consts.UTF_8);post.setEntity(entity);}if (headers != null && !headers.isEmpty()) {for (Entry<String, String> entry : headers.entrySet()) {post.addHeader(entry.getKey(), entry.getValue());}}// 设置参数Builder customReqConf = RequestConfig.custom();if (connTimeout != null) {customReqConf.setConnectTimeout(connTimeout);}if (readTimeout != null) {customReqConf.setSocketTimeout(readTimeout);}post.setConfig(customReqConf.build());HttpResponse res = null;if (url.startsWith("https")) {// 执行 Https 请求.client = createSSLInsecureClient();res = client.execute(post);} else {// 执行 Http 请求.client = HttpClientUtils.client;res = client.execute(post);}return IOUtils.toString(res.getEntity().getContent(), "UTF-8");} finally {post.releaseConnection();if (url.startsWith("https") && client != null&& client instanceof CloseableHttpClient) {((CloseableHttpClient) client).close();}}}/*** 发送一个 GET 请求*/public static String get(String url, String charset, Integer connTimeout,Integer readTimeout)throws ConnectTimeoutException,SocketTimeoutException, Exception {HttpClient client = null;HttpGet get = new HttpGet(url);String result = "";try {// 设置参数Builder customReqConf = RequestConfig.custom();if (connTimeout != null) {customReqConf.setConnectTimeout(connTimeout);}if (readTimeout != null) {customReqConf.setSocketTimeout(readTimeout);}get.setConfig(customReqConf.build());HttpResponse res = null;if (url.startsWith("https")) {// 执行 Https 请求.client = createSSLInsecureClient();res = client.execute(get);} else {// 执行 Http 请求.client = HttpClientUtils.client;res = client.execute(get);}result = IOUtils.toString(res.getEntity().getContent(), charset);} finally {get.releaseConnection();if (url.startsWith("https") && client != null && client instanceof CloseableHttpClient) {((CloseableHttpClient) client).close();}}return result;}/*** 从 response 里获取 charset*/@SuppressWarnings("unused")private static String getCharsetFromResponse(HttpResponse ressponse) {// Content-Type:text/html; charset=GBKif (ressponse.getEntity() != null  && ressponse.getEntity().getContentType() != null && ressponse.getEntity().getContentType().getValue() != null) {String contentType = ressponse.getEntity().getContentType().getValue();if (contentType.contains("charset=")) {return contentType.substring(contentType.indexOf("charset=") + 8);}}return null;}/*** 创建 SSL连接* @return* @throws GeneralSecurityException*/private static CloseableHttpClient createSSLInsecureClient() throws GeneralSecurityException {try {SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {public boolean isTrusted(X509Certificate[] chain,String authType) throws CertificateException {return true;}}).build();SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new X509HostnameVerifier() {@Overridepublic boolean verify(String arg0, SSLSession arg1) {return true;}@Overridepublic void verify(String host, SSLSocket ssl)throws IOException {}@Overridepublic void verify(String host, X509Certificate cert)throws SSLException {}@Overridepublic void verify(String host, String[] cns,String[] subjectAlts) throws SSLException {}});return HttpClients.custom().setSSLSocketFactory(sslsf).build();} catch (GeneralSecurityException e) {throw e;}}
}

3.3.2 添加回调接口获取access_token
在WeixinApiController 类添加回调方法

/*** 微信登录回调** @param code* @param state* @return*/
@RequestMapping("callback")
public String callback(String code, String state) {//获取授权临时票据System.out.println("微信授权服务器回调。。。。。。");System.out.println("state = " + state);System.out.println("code = " + code);if (StringUtils.isEmpty(state) || StringUtils.isEmpty(code)) {log.error("非法回调请求");throw new YyghException(ResultCodeEnum.ILLEGAL_CALLBACK_REQUEST_ERROR);}//使用code和appid以及appscrect换取access_tokenStringBuffer baseAccessTokenUrl = new StringBuffer().append("https://api.weixin.qq.com/sns/oauth2/access_token").append("?appid=%s").append("&secret=%s").append("&code=%s").append("&grant_type=authorization_code");String accessTokenUrl = String.format(baseAccessTokenUrl.toString(),ConstantPropertiesUtil.WX_OPEN_APP_ID,ConstantPropertiesUtil.WX_OPEN_APP_SECRET,code);String result = null;try {result = HttpClientUtils.get(accessTokenUrl);} catch (Exception e) {throw new YyghException(ResultCodeEnum.FETCH_ACCESSTOKEN_FAILD);}System.out.println("使用code换取的access_token结果 = " + result);JSONObject resultJson = JSONObject.parseObject(result);if(resultJson.getString("errcode") != null){log.error("获取access_token失败:" + resultJson.getString("errcode") + resultJson.getString("errmsg"));throw new YyghException(ResultCodeEnum.FETCH_ACCESSTOKEN_FAILD);}String accessToken = resultJson.getString("access_token");String openId = resultJson.getString("openid");log.info(accessToken);log.info(openId);//根据access_token获取微信用户的基本信息//先根据openid进行数据库查询// UserInfo userInfo = userInfoService.getByOpenid(openId);// 如果没有查到用户信息,那么调用微信个人信息获取的接口// if(null == userInfo){//如果查询到个人信息,那么直接进行登录//使用access_token换取受保护的资源:微信的个人信息String baseUserInfoUrl = "https://api.weixin.qq.com/sns/userinfo" +"?access_token=%s" +"&openid=%s";String userInfoUrl = String.format(baseUserInfoUrl, accessToken, openId);String resultUserInfo = null;try {resultUserInfo = HttpClientUtils.get(userInfoUrl);} catch (Exception e) {throw new YyghException(ResultCodeEnum.FETCH_USERINFO_ERROR);}System.out.println("使用access_token获取用户信息的结果 = " + resultUserInfo);JSONObject resultUserInfoJson = JSONObject.parseObject(resultUserInfo);if(resultUserInfoJson.getString("errcode") != null){log.error("获取用户信息失败:" + resultUserInfoJson.getString("errcode") + resultUserInfoJson.getString("errmsg"));throw new YyghException(ResultCodeEnum.FETCH_USERINFO_ERROR);}//解析用户信息String nickname = resultUserInfoJson.getString("nickname");String headimgurl = resultUserInfoJson.getString("headimgurl");UserInfo userInfo = new UserInfo();userInfo.setOpenid(openId);userInfo.setNickName(nickname);userInfo.setStatus(1);userInfoService.save(userInfo);// }Map<String, Object> map = new HashMap<>();String name = userInfo.getName();if(StringUtils.isEmpty(name)) {name = userInfo.getNickName();}if(StringUtils.isEmpty(name)) {name = userInfo.getPhone();}map.put("name", name);if(StringUtils.isEmpty(userInfo.getPhone())) {map.put("openid", userInfo.getOpenid());} else {map.put("openid", "");}String token = JwtHelper.createToken(userInfo.getId(), name);map.put("token", token);return "redirect:" + ConstantPropertiesUtil.YYGH_BASE_URL + "/weixin/callback?token="+map.get("token")+"&openid="+map.get("openid")+"&name="+URLEncoder.encode((String)map.get("name"));
}

3.3.3 获取用户信息
3.3.3.1 根据openid查询用户是否已注册

1UserInfoService类添加接口
/*** 根据微信openid获取用户信息* @param openid
* @return
*/
UserInfo getByOpenid(String openid);

2、UserInfoServiceImpl类添加接口实现

@Override
public UserInfo getByOpenid(String openid) {
return userInfoMapper.selectOne(new QueryWrapper<UserInfo>().eq("openid", openid));
}3.3.3.2 根据access_token获取用户信息
@Autowired
private UserInfoService userInfoService;
@RequestMapping("callback")
public String callback(String code, String state) {
//获取授权临时票据
...//根据access_token获取微信用户的基本信息//先根据openid进行数据库查询
UserInfo userInfo = userInfoService.getByOpenid(openId);
// 如果没有查到用户信息,那么调用微信个人信息获取的接口
if(null == userInfo){
//如果查询到个人信息,那么直接进行登录//使用access_token换取受保护的资源:微信的个人信息
String baseUserInfoUrl = "https://api.weixin.qq.com/sns/userinfo"+
"?access_token=%s"+
"&openid=%s";String userInfoUrl = String.format(baseUserInfoUrl, accessToken, openId);String resultUserInfo = null;
try {resultUserInfo = HttpClientUtils.get(userInfoUrl);} catch (Exception e) {
throw new YyghException(ResultCodeEnum.FETCH_USERINFO_ERROR);}System.out.println("使用access_token获取用户信息的结果 = "+ resultUserInfo);JSONObject resultUserInfoJson = JSONObject.parseObject(resultUserInfo);
if(resultUserInfoJson.getString("errcode") != null){
log.error("获取用户信息失败:"+ resultUserInfoJson.getString("errcode") + resultUserInfoJson.getString("errmsg"));
throw new YyghException(ResultCodeEnum.FETCH_USERINFO_ERROR);}//解析用户信息
String nickname = resultUserInfoJson.getString("nickname");String headimgurl = resultUserInfoJson.getString("headimgurl");userInfo = new UserInfo();userInfo.setOpenid(openId);userInfo.setNickName(nickname);userInfo.setStatus(1);
userInfoService.save(userInfo);}Map<String, Object> map = new HashMap<>();String name = userInfo.getName();
if(StringUtils.isEmpty(name)) {name = userInfo.getNickName();}
if(StringUtils.isEmpty(name)) {name = userInfo.getPhone();}map.put("name", name);
if(StringUtils.isEmpty(userInfo.getPhone())) {map.put("openid", userInfo.getOpenid());} else {map.put("openid", "");}String token = JwtHelper.createToken(userInfo.getId(), name);map.put("token", token);
return "redirect:"+ ConstantPropertiesUtil.YYGH_BASE_URL + "/weixin/callback?token="+map.get("token")+"&openid="+map.get("openid")+"&name="+URLEncoder.encode((String)map.get("name"));
}

说明:我们根据返回openid判断是否需要绑定手机号码,如果需要绑定,那么我们要根据openid用户用户信息,然后更新上手机号码

3.4 回调返回页面

操作:yygh-site
说明:我们只期望返回一个空页面,然后跟登录层通信就可以了,其实就是一个过渡页面,所以我们要给这个过渡页面定义一个空模板
3.4.1定义空模块
添加空模板组件:/layouts/empty.vue

<template>
<div>
<nuxt/>
</div>
</template>

3.4.2回调返回页面
根据返回路径/weixin/cakkback,我们创建组件/weixin/cakkback.vue

<template><!-- header --><div></div><!-- footer -->
</template>
<script>
export default {layout: "empty",data() {return {}},mounted() {let token = this.$route.query.tokenlet name = this.$route.query.namelet openid = this.$route.query.openid// 调用父vue方法window.parent['loginCallback'](name, token, openid)}
}
</script>

说明:在页面我们就能够接收到返回来的参数
3.4.3 父组件定义回调方法
在myheader.vue添加方法

  mounted() {// 注册全局登录事件对象window.loginEvent = new Vue();// 监听登录事件loginEvent.$on('loginDialogEvent', function () {document.getElementById("loginDialog").click();})// 触发事件,显示登录层:loginEvent.$emit('loginDialogEvent')//初始化微信jsconst script = document.createElement('script')script.type = 'text/javascript'script.src = 'https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js'document.body.appendChild(script)// 微信登录回调处理let self = this;window["loginCallback"] = (name,token, openid) => {self.loginCallback(name, token, openid);}},loginCallback(name, token, openid) {// 打开手机登录层,绑定手机号,改逻辑与手机登录一致if(openid != '') {this.userInfo.openid = openidthis.showLogin()} else {this.setCookies(name, token)}},

3.5 服务器绑定手机号码
页面绑定手机号码会把openid传递过来,我们根据openid找到用户信息,然后绑定手机号码
修改UserInfoServiceImpl类登录方法

@Override
public Map<String, Object> login(LoginVo loginVo) {String phone = loginVo.getPhone();String code = loginVo.getCode();//校验参数
if(StringUtils.isEmpty(phone) ||StringUtils.isEmpty(code)) {
throw new YyghException(ResultCodeEnum.PARAM_ERROR);}//校验校验验证码
String mobleCode = redisTemplate.opsForValue().get(phone);
if(!code.equals(mobleCode)) {
throw new YyghException(ResultCodeEnum.CODE_ERROR);}//绑定手机号码
UserInfo userInfo = null;
if(!StringUtils.isEmpty(loginVo.getOpenid())) {userInfo = this.getByOpenid(loginVo.getOpenid());
if(null != userInfo) {userInfo.setPhone(loginVo.getPhone());
this.updateById(userInfo);} else {
throw new YyghException(ResultCodeEnum.DATA_ERROR);}}//userInfo=null 说明手机直接登录
if(null == userInfo) {QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();queryWrapper.eq("phone", phone);userInfo = userInfoMapper.selectOne(queryWrapper);
if(null == userInfo) {userInfo = new UserInfo();userInfo.setName("");userInfo.setPhone(phone);userInfo.setStatus(1);
this.save(userInfo);}}//校验是否被禁用
if(userInfo.getStatus() == 0) {
throw new YyghException(ResultCodeEnum.LOGIN_DISABLED_ERROR);}//记录登录
UserLoginRecord userLoginRecord = new UserLoginRecord();userLoginRecord.setUserId(userInfo.getId());userLoginRecord.setIp(loginVo.getIp());
userLoginRecordMapper.insert(userLoginRecord);//返回页面显示名称
Map<String, Object> map = new HashMap<>();String name = userInfo.getName();
if(StringUtils.isEmpty(name)) {name = userInfo.getNickName();}
if(StringUtils.isEmpty(name)) {name = userInfo.getPhone();}map.put("name", name);String token = JwtHelper.createToken(userInfo.getId(), name);map.put("token", token);
return map;
}

http://chatgpt.dhexx.cn/article/r11rudQb.shtml

相关文章

微信数据库解析总结

1.微信数据库解密 微信数据库在在哪个文件夹 EnMicroMsg.db的父文件加密规则是 md5("mm" uin)这样就可以准确的获取到db文件的位置. uin的获取&#xff1a;/data/data/com.tencent.mm/shared_prefs/auth_info_key_prefs.xml里面有个uinz字段&#xff0c;直接获取val…

微信个人公众号推广

作者&#xff1a;余伟峰链接&#xff1a;https://www.zhihu.com/question/34151231/answer/118281456来源&#xff1a;知乎著作权归作者所有。商业转载请联系作者获得授权&#xff0c;非商业转载请注明出处。 &#xff08;转&#xff09; 个人公众号常见的运营和推广可以参考以…

微信小程序云开发|个人博客小程序

&#x1f315;文章目录 1.前言2.博客首页数据展示3.使用data中的数据渲染博客展示4.使用云数据库创建集合blogs5.读取数据库中的数据6.创建添加博客页面7.博客添加页面样式设计8.总结 1.前言 这篇文章详细的介绍了个人博客小程序的云开发流程&#xff0c;包括博客展示页面&…

【个人开发】通过企业微信实现消息推送到个人微信

1. 背景 个人有个消息推送到任务&#xff0c;一直在飞书上跑&#xff0c;消息触达率太低&#xff0c;寻思着尝试用一些方法&#xff0c;将消息推送到微信。 2. 写在前面 坑1&#xff1a;寻思着企业微信有机器人&#xff0c;将机器人所在群拉上微信号&#xff0c;结果&#x…

个人开发者实现微信扫码登录

使用码上登录中转微信扫码登录 使用之前最好有一个公网服务器&#xff0c;能够公网访问的 redis 和 mysql 数据库&#xff0c;并且能够部署公网访问的服务 码上登录是一个小程序&#xff0c;对个体开发者提供了免费的微信扫一扫登录入口&#xff1a;官网 http://login.vicy.c…

深度解读企业微信与个人微信的区别?

收到我们售前服务团队同事的反馈&#xff0c;很多老板或运营小伙伴并不是很清楚个人微信与企业微信具体有哪些本质区别&#xff0c;很多人还停留在企业微信只是作为OA办公打卡工具的认知内。 今天我们将从11个要点28个细分点来聊一聊企业微信作为私域流量运营必备工具&#xff…

个人小程序申请微信支付

个人小程序如何申请微信支付功能&#xff1f; 给你们看一下效果 一、准备材料 ① 个体户营业执照 1️⃣可以去当地 工商局办理&#xff0c;免费&#xff08;一般提供一个地址&#xff0c;提供3张身份证复印件&#xff09; 2️⃣可以去淘宝叫人代理办理&#xff0c;收费&…

VC/MFC 检查指定的文件是否存在 判断文件是否存在

#include <iostream> #include <windows.h> #include <tchar.h>/*功能: 检查指定的文件是否存在编译环境: VS2017, 字符集可随意切换 */// 函数功能: 检查指定的文件是否存在, 文件存在则返回 TRUE, 不存在则返回 FALSE // LPCTSTR lpszFile 要检查的文件的绝…

html 判断本地文件存在,javascript怎么判断文件是否存在?

javascript怎么判断文件是否存在&#xff1f;下面本篇文章就来给大家介绍一下利用javascript判断文件是否存在的方法&#xff0c;希望对大家有所帮助。 在JavaScript中&#xff0c;可以通过ActiveXObject对象判断本地文件路径来判断本地文件是否存在&#xff0c;网络文件通过判…

matlab怎么分析数据,MATLAB应用——数据分析与统计

数学建模是用数学方法解决各种实际问题的桥梁,它已经渗透到各个领域,而且发挥出越来越重要的作用。面对自然科学和工程应用中的难题,大部分人无从入手,而个别人却能短时间内给出切实可行的解决方案,其差别往往在于驾驭数学知识的能力不同。现代计算机技术的应用不仅减少了…

大数据分析那点事

写在前文&#xff0c;首先声明博主对数据分析领域也在不断学习当中&#xff0c;文章中难免可能会出现一些错误&#xff0c;欢迎大家及时指正&#xff0c;博主在此之前也曾对不同量级、不同领域的数据进行过分析&#xff0c;但是在过程中总是感觉有许多困惑&#xff0c;即自己也…

【python与数据分析】Python与数据分析概述

目录 一、认识数据分析 1、数据分析的方法论与数据分析方法 &#xff08;一&#xff09;七何分析法——建立框架 &#xff08;二&#xff09;演绎树分析法——问题分层 &#xff08;三&#xff09;PEST分析法——设计环境 &#xff08;四&#xff09;金字塔原理分析法——…

2022年10个最佳地理空间数据分析 GIS 软件

数据可视化并不是简单的把数据变成图表, 而是以数据为视角看待世界。换言之&#xff0c;数据可视化的客体是数据&#xff0c;但我们往往想要的其实是数据视觉&#xff0c;以数据为工具&#xff0c;以可视化为手段&#xff0c;目的是描述真实&#xff0c;探索世界。GIS 就是这样…

数据分析报告编写规范

Ⅰ、数据分析报告编写规范 - 资料来源&#xff1a;百度文库 一份专业的数据分析报告&#xff0c;除了图表化呈现数据分析结果&#xff0c;还需要介绍此项分析的背景/目的&#xff0c;通过此次分析得到结论&#xff0c;以及结合业务知识给出的建议。在做数据报告之前&#xff0…

python数据分析常用图大集合

我们在做数据分析的时候&#xff0c;难免会用到图像来表示你要展示的东西&#xff0c;接下来写一下demo来表示一下各种图&#xff1a; 以下默认所有的操作都先导入了numpy、pandas、matplotlib、seaborn import numpy as np import pandas as pd import matplotlib.pyplot as…

数据分析自学路线

首先必须要对想要自学数据分析的朋友表示敬佩&#xff01;数据分析是个很庞大的学科体系&#xff0c;零零碎碎的知识点可能一辈子都学不尽&#xff0c;敢自学挑战的一定是个学习力和行动力超强的人&#xff01; 作为一个非科班转型的初级数据分析师&#xff0c;常有身边朋友问…

Python数据分析常用的类库

本节只对这些库进行一个简单介绍。 1. NumPy NumPy&#xff08;Numerical Python&#xff09;是 Python 科学计算的基础包&#xff0c;它可以提供以下功能。口快速高效的多维数组对象 ndarray。 口用于对数组执行元素级计算和直接对数组执行数学运算的函数。口用于读写硬盘…

10 个最佳地理空间数据分析 GIS 软件

有人说&#xff1a;一个人从1岁活到80岁很平凡&#xff0c;但如果从80岁倒着活&#xff0c;那么一半以上的人都可能不凡。 生活没有捷径&#xff0c;我们踩过的坑都成为了生活的经验&#xff0c;这些经验越早知道&#xff0c;你要走的弯路就会越少。 数据可视化并不是简单的把…

云计算机平台的特性,云平台对比传统平台特点分析

云计算的一个核心理念就是通过不断提高“云”的处理能力来减少用户终端的处理负担,最终使用户终端简化成一个单纯的输入输出设备,并能够按需享受“云”的强大计算能力。 而云计算平台与传统应用模式相比,具有如下特点。 1、虚拟化技术 现有的云计算平台的最大的特点是利用软…

什么是SAP Cloud Platform(SAP云平台) ?

1. 引言 SAP Cloud Platform (SCP) 是SAP目前主推的一个发展方向&#xff0c;从2012年SAP HANA Cloud Portfolio到后来的SAP HANA Cloud Platform&#xff0c;再到2017年SAP Cloud Platform的发布&#xff0c;SAP的云平台经过了一系列的演化过程。 在讨论SCP这一技术时&#…