当前位置:网站首页>A little assistant for teenagers' physiological health knowledge based on wechat applet (free source code + project introduction + operation introduction + operation screenshot + Thesis)
A little assistant for teenagers' physiological health knowledge based on wechat applet (free source code + project introduction + operation introduction + operation screenshot + Thesis)
2022-07-01 05:34:00 【Code garden of Azhou】
Technology Architecture
Back end :JDK1.8+SingBoot+SpringMVC
front end :WXML+WXSS +css +js
database :MySQL
Function module
The front desk user :
The user login
Personal center
Psychological assessment
Customer service
Encyclopedia of adolescent physical health
Backstage Administrator :
Registration Management
Psychological evaluation management
User management
Knowledge management of adolescent health encyclopedia
Code display :
wx.getUserProfile({
desc: ' It is used to improve the membership information ',
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: Current limiting 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();
// take limit Annotations
Limit limit = method.getAnnotation(Limit.class);
if (limit != null) {
// key effect : Different interfaces , Different flow control
String key = limit.key();
RateLimiter rateLimiter = null;
// Verify whether the cache hits key
if (!limiterMap.containsKey(key)) {
// Create token bucket
rateLimiter = RateLimiter.create(limit.permitsPerSecond());
limiterMap.put(key, rateLimiter);
log.debug(" New token bucket ={}, Capacity ={}", key, limit.permitsPerSecond());
}
rateLimiter = limiterMap.get(key);
// Take the token
boolean acquire = rateLimiter.tryAcquire(limit.timeout(), limit.timeunit());
// Can't get orders , Directly return the exception prompt
if (!acquire) {
log.warn(" Token bucket ={}, Failed to get token ", key);
throw new MyException(limit.msg());
}
}
return joinPoint.proceed();
}
}
边栏推荐
猜你喜欢
Mathematical knowledge: finding the number of divisors
Usage and principle of synchronized
Use and principle of Park unpark
Causes of short circuit of conductive slip ring and Countermeasures
Design and application of immutable classes
使用 Nocalhost 开发 Rainbond 上的微服务应用
Is there any good website or software for learning programming? [introduction to programming]?
Spanner 论文小结
导电滑环短路的原因以及应对措施
Go learning notes (5) basic types and declarations (4)
随机推荐
JDBC common interview questions
Leetcode top 100 questions 1 Sum of two numbers
Using nocalhost to develop microservice application on rainbow
轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
Unity 使用Sqlite
[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
Intelligent operation and maintenance: visual management system based on BIM Technology
Chapitre d'apprentissage mongodb: Introduction à la première leçon après l'installation
使用 Nocalhost 开发 Rainbond 上的微服务应用
CentOS 7 installed php7.0 using Yum or up2date
提高企业产品交付效率系列(1)—— 企业应用一键安装和升级
eBPF Cilium实战(2) - 底层网络可观测性
Receiving package install and uninstall events
HDU - 1024 Max Sum Plus Plus(DP)
QT waiting box production
[RootersCTF2019]babyWeb
JS random verification code
Detailed explanation of set
数据治理:元数据管理实施(第四篇)
数据治理:数据治理框架(第一篇)