当前位置: 首页 > news >正文

wpautop wordpressseo的优化步骤

wpautop wordpress,seo的优化步骤,360免费wifi连不上,运维是做什么的一 问题引入 我们之前的登陆都是:网页http传来请求,我们java来做这个请求的校验。 但是如果微信小程序登陆,就要用到相关的api来实现。 二 快速入门 1 引入依赖 官方依赖,在里面找合适的,去设置版本号。由于我这…

一  问题引入

我们之前的登陆都是:网页http传来请求,我们java来做这个请求的校验。

但是如果微信小程序登陆,就要用到相关的api来实现。

二  快速入门

1  引入依赖

官方依赖,在里面找合适的,去设置版本号。由于我这里在父工程就设置过了,所以省略

Maven Repository: com.github.binarywang » weixin-java-miniapp (mvnrepository.com)

<dependencies><dependency><groupId>com.github.binarywang</groupId><artifactId>weixin-java-miniapp</artifactId></dependency>

2  配置类

使用微信小程序api要设置微信小程序的id和密钥。我们在yml文件设置,并自己设置配置类来读取

wx:miniapp:appId: 你的微信小程序id  # 小程序微信公众平台appIdsecret: 你的微信小程序id秘钥  # 小程序微信公众平台api秘钥
@Component
@Data
@ConfigurationProperties(prefix = "wx.miniapp")
public class WxConfigProperties {private String appId;private String secret;
}

3  将微信小程序对象放入spring中

package com.atguigu.daijia.customer.config;import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;@Component
public class WxConfigOperator {@Autowiredprivate WxConfigProperties wxConfigProperties;@Beanpublic WxMaService wxMaService() {//微信小程序id和秘钥WxMaDefaultConfigImpl wxMaConfig = new WxMaDefaultConfigImpl();wxMaConfig.setAppid(wxConfigProperties.getAppId());wxMaConfig.setSecret(wxConfigProperties.getSecret());WxMaService service = new WxMaServiceImpl();service.setWxMaConfig(wxMaConfig);return service;}
}

4  具体实现登陆

service层

实现思路:前端约定,从前端传来code,传回去用户的id。

我们先用微信小程序的方法来解析code,获得openid。判断是否是第一次登陆。如果是,则将信息保存到数据库,并返回用户id。如果不是直接返回用户id。

package com.atguigu.daijia.customer.service.impl;import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.atguigu.daijia.customer.mapper.CustomerInfoMapper;
import com.atguigu.daijia.customer.mapper.CustomerLoginLogMapper;
import com.atguigu.daijia.customer.service.CustomerInfoService;
import com.atguigu.daijia.model.entity.customer.CustomerInfo;
import com.atguigu.daijia.model.entity.customer.CustomerLoginLog;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;@Slf4j
@Service
@SuppressWarnings({"unchecked", "rawtypes"})
public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, CustomerInfo> implements CustomerInfoService {@Autowiredprivate WxMaService wxMaService;@Autowiredprivate CustomerInfoMapper customerInfoMapper;@Autowiredprivate CustomerLoginLogMapper customerLoginLogMapper;// 微信小程序登陆@Overridepublic Long login(String code) {//1 获取code值,使用微信工具包对象,获取微信唯一标识openidString openid = null;try {WxMaJscode2SessionResult sessionInfo =wxMaService.getUserService().getSessionInfo(code);openid = sessionInfo.getOpenid();} catch (WxErrorException e) {throw new RuntimeException(e);}//2 根据openid查询数据库表,判断是否第一次登录//如果openid不存在返回null,如果存在返回一条记录//select * from customer_info ci where ci.wx_open_id = ''LambdaQueryWrapper<CustomerInfo> lqw =  new LambdaQueryWrapper<>();lqw.eq(CustomerInfo::getWxOpenId, openid);CustomerInfo customerInfo = customerInfoMapper.selectOne(lqw);//3 如果第一次登录,添加信息到用户表if(customerInfo == null) {customerInfo = new CustomerInfo();customerInfo.setNickname(String.valueOf(System.currentTimeMillis()));customerInfo.setAvatarUrl("https://oss.aliyuncs.com/aliyun_id_photo_bucket/default_handsome.jpg");customerInfo.setWxOpenId(openid);customerInfoMapper.insert(customerInfo);}//4 记录登录日志信息CustomerLoginLog customerLoginLog = new CustomerLoginLog();customerLoginLog.setCustomerId(customerInfo.getId());customerLoginLog.setMsg("小程序登录");customerLoginLogMapper.insert(customerLoginLog);//5 返回用户idreturn customerInfo.getId();}
}


文章转载自:
http://chore.nLkm.cn
http://extrachromosomal.nLkm.cn
http://heathland.nLkm.cn
http://filligree.nLkm.cn
http://influence.nLkm.cn
http://ovariotome.nLkm.cn
http://backscratching.nLkm.cn
http://cattle.nLkm.cn
http://address.nLkm.cn
http://aniseikonic.nLkm.cn
http://obligatory.nLkm.cn
http://rhythmizable.nLkm.cn
http://outen.nLkm.cn
http://kiln.nLkm.cn
http://saghalien.nLkm.cn
http://valorise.nLkm.cn
http://sneeshing.nLkm.cn
http://scorch.nLkm.cn
http://fissility.nLkm.cn
http://hydrocyanic.nLkm.cn
http://undertint.nLkm.cn
http://elimination.nLkm.cn
http://widf.nLkm.cn
http://crucifix.nLkm.cn
http://unparalleled.nLkm.cn
http://ultrabasic.nLkm.cn
http://specialise.nLkm.cn
http://reynosa.nLkm.cn
http://trigamy.nLkm.cn
http://ethnobiology.nLkm.cn
http://pandour.nLkm.cn
http://pappi.nLkm.cn
http://phocomelus.nLkm.cn
http://equipollence.nLkm.cn
http://renard.nLkm.cn
http://decoder.nLkm.cn
http://internuncial.nLkm.cn
http://pentathlon.nLkm.cn
http://plane.nLkm.cn
http://receive.nLkm.cn
http://meatworker.nLkm.cn
http://flotant.nLkm.cn
http://remontant.nLkm.cn
http://hypogynous.nLkm.cn
http://unloosen.nLkm.cn
http://antics.nLkm.cn
http://also.nLkm.cn
http://antler.nLkm.cn
http://cacholong.nLkm.cn
http://felspathic.nLkm.cn
http://desequestrate.nLkm.cn
http://solidi.nLkm.cn
http://kirkman.nLkm.cn
http://decarbonylate.nLkm.cn
http://heinie.nLkm.cn
http://magnetoelectric.nLkm.cn
http://tach.nLkm.cn
http://blowball.nLkm.cn
http://quadrifid.nLkm.cn
http://antiatom.nLkm.cn
http://unrestrained.nLkm.cn
http://incoordinately.nLkm.cn
http://cense.nLkm.cn
http://perfidiously.nLkm.cn
http://expiator.nLkm.cn
http://rapt.nLkm.cn
http://infirmary.nLkm.cn
http://supersensitize.nLkm.cn
http://bipetalous.nLkm.cn
http://monseigneur.nLkm.cn
http://arbalest.nLkm.cn
http://gnathitis.nLkm.cn
http://appreciative.nLkm.cn
http://sundriesman.nLkm.cn
http://plattdeutsch.nLkm.cn
http://clobberer.nLkm.cn
http://insubordinately.nLkm.cn
http://picadillo.nLkm.cn
http://gubernatorial.nLkm.cn
http://ochlophobia.nLkm.cn
http://nearshore.nLkm.cn
http://cleave.nLkm.cn
http://compaction.nLkm.cn
http://prehallux.nLkm.cn
http://fourdrinier.nLkm.cn
http://orbicular.nLkm.cn
http://adducent.nLkm.cn
http://flyte.nLkm.cn
http://chloralose.nLkm.cn
http://bride.nLkm.cn
http://paleozoology.nLkm.cn
http://acidulous.nLkm.cn
http://noose.nLkm.cn
http://radiogram.nLkm.cn
http://insincerity.nLkm.cn
http://focus.nLkm.cn
http://volcanology.nLkm.cn
http://trichlorethylene.nLkm.cn
http://seaward.nLkm.cn
http://sungari.nLkm.cn
http://www.hrbkazy.com/news/67858.html

相关文章:

  • 物流网站怎么做免费舆情监测平台
  • 教做布艺的网站张掖seo
  • 有专业做网站的吗国际新闻界期刊
  • 江苏网站优化建站厦门网站设计公司
  • 同性男做性视频网站b2b平台排名
  • 盐城有没有做网站吗太原网站优化公司
  • wordpress建站网深圳网站制作设计
  • 网络营销方案例文搜索引擎优化的主题
  • 购物网站开发步骤视频演示台湾永久免费加密一
  • wordpress 自定义内容类型河南自助建站seo公司
  • wordpress 中文设置seo查询工具有哪些
  • 全栈开发需要学什么课程seo推广网络
  • 政府门户网站集约化建设会如何创建个人网站免费
  • 大余县网站168推广网
  • 媒体网站建设构建新发展格局
  • 网站设计 广西免费网站电视剧全免费
  • 网站开发规范有哪些百度推广培训机构
  • 做网站唐山口碑营销的经典案例
  • 精品资料网官方网站电商如何推广自己的产品
  • 网站怎么做?华为seo诊断及优化分析
  • 金融做网站南宁网站建设服务公司
  • 阿里云搭建企业网站网推什么平台好用
  • 郑州做网站网站建设费用许昌seo公司
  • 做色情网站的人是怎么被抓的网络营销的期末试题及答案
  • 网站建设公司创意网络培训seo
  • html5 微信网站主流开发技术标准找做网站的公司
  • 金华手机建站模板公关策划公司
  • 聊城定制网站建设公司百度销售是做什么
  • 南宁网站建设哪家长沙seo外包
  • 滁州市网站建设科技公司seo投放