当前位置:网站首页>基于微信小程序的青少年生理健康知识小助手(免费获取源码+项目介绍+运行介绍+运行截图+论文)
基于微信小程序的青少年生理健康知识小助手(免费获取源码+项目介绍+运行介绍+运行截图+论文)
2022-07-01 05:30:00 【azhou的代码园】
技术架构
后端:JDK1.8+SingBoot+SpringMVC
前端:WXML+WXSS +css +js
数据库:MySQL
功能模块
前台用户:
用户登录
个人中心
心理测评
客服服务
青少年生理健康百科知识
后台管理员:
注册管理
心理测评管理
用户管理
青少年健康百科知识管理
代码展示:
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
var sessionKey = app.globalData.sessionKey;
console.log("userInfo", res.userInfo)
app.globalData.userInfo = res.userInfo
this.setData({
'userInfo': res.userInfo,
'hiddenName': true
})
wx.request({
url: 'http://localhost:8080/wx/getUserInfo',
header: {
"accept": "*/*",
'Content-Type': 'application/x-www-form-urlencoded',
},
data: {
'encryptedData': res.encryptedData,
'iv': res.iv,
'sessionKey': sessionKey,
},
method: 'POST',
success(res) {
console.log("userInfo:", res)
}
})
}
package com.azhou.code.aop;
import com.azhou.code.annotations.Limit;
import com.azhou.code.common.exception.MyException;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.RateLimiter;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.Map;
/**
* @description: 限流aop
* @author: azhou
* @Create: 2022-05-29 12:40
*/
@Slf4j
@Aspect
@Component
public class LimitAop {
private final Map<String, RateLimiter> limiterMap = Maps.newConcurrentMap();
@Around("@annotation(com.azhou.code.annotations.Limit)")
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method method = methodSignature.getMethod();
// 拿limit的注解
Limit limit = method.getAnnotation(Limit.class);
if (limit != null) {
// key作用:不同的接口,不同的流量控制
String key = limit.key();
RateLimiter rateLimiter = null;
// 验证缓存是否有命中key
if (!limiterMap.containsKey(key)) {
// 创建令牌桶
rateLimiter = RateLimiter.create(limit.permitsPerSecond());
limiterMap.put(key, rateLimiter);
log.debug("新建了令牌桶={},容量={}", key, limit.permitsPerSecond());
}
rateLimiter = limiterMap.get(key);
// 拿令牌
boolean acquire = rateLimiter.tryAcquire(limit.timeout(), limit.timeunit());
// 拿不到命令,直接返回异常提示
if (!acquire) {
log.warn("令牌桶={},获取令牌失败", key);
throw new MyException(limit.msg());
}
}
return joinPoint.proceed();
}
}






边栏推荐
- Mongodb學習篇:安裝後的入門第一課
- [data recovery in North Asia] a data recovery case of raid crash caused by hard disk drop during data synchronization of hot spare disk of RAID5 disk array
- Vérification simple de la lecture et de l'écriture de qdatastream
- [Yugong series] February 2022 Net architecture class 005 ABP vNext Net core web application getting started configuration
- Youqitong [vip] v3.7.2022.0106 official January 22 Edition
- Unit testing with mongodb
- Using nocalhost to develop microservice application on rainbow
- 使用 Nocalhost 开发 Rainbond 上的微服务应用
- [excel] column operation, which performs specific column for data in a cell, such as text division by comma, colon, space, etc
- 数据治理:数据治理框架(第一篇)
猜你喜欢

Leetcode top 100 question 2 Add two numbers

Multi table operation - foreign key cascade operation

0xc000007b应用程序无法正常启动解决方案(亲测有效)

el-form表单新增表单项动态校验;el-form校验动态表单v-if不生效;

Rainbond结合NeuVector实践容器安全管理

Vmware workstation network card settings and three common network modes

JDBC common interview questions
![Fiber Bragg grating (FBG) notes [1]: waveguide structure and Bragg wavelength derivation](/img/83/97c0c6e23cbb7b4c2b630c217c5206.jpg)
Fiber Bragg grating (FBG) notes [1]: waveguide structure and Bragg wavelength derivation

Mongodb learning chapter: introduction after installation lesson 1

Mathematical knowledge: finding the number of divisors
随机推荐
Explanation of characteristics of hydraulic slip ring
C# wpf 使用DockPanel实现截屏框
printk 调试总结
Floweable source code annotation (40) class delegation
小程序常用组件小结
Software intelligence: the "world" and "boundary" of AI sentient beings in AAAs system
Is there any good website or software for learning programming? [introduction to programming]?
Day 05 - file operation function
Use and principle of Park unpark
CockroachDB: The Resilient Geo-Distributed SQL Database 论文阅读笔记
Leetcode top 100 question 2 Add two numbers
Lock free concurrency of JUC (leguan lock)
Global and Chinese market of solder wire 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets of superconductor 2022-2028: Research Report on technology, participants, trends, market size and share
3D建模与处理软件简介 刘利刚 中国科技大学
Rainbond结合NeuVector实践容器安全管理
Daily code 300 lines learning notes day 11
轩逸保养手册
One click deployment of highly available emqx clusters in rainbow
2022.6.30-----leetcode.1175