1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

[后端] 微服务添加获取&更新微信小程序access_token相关逻辑

This commit is contained in:
程序员小墨 2022-11-28 00:11:50 +08:00
parent fcd46cba4f
commit 5f142254f2
12 changed files with 409 additions and 185 deletions

View File

@ -3,5 +3,4 @@
更多:
完成项目代码中的 TODO 部分
用户登录接口 后端返回结构有变动,小程序需要同步修改
身份码后端接口考虑与其他系统的集成逻辑

View File

@ -0,0 +1,20 @@
package com.cxyxiaomo.epp.common.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
// 数据库关系映射
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
// 微服务必须要实现Serializable
public class Setting implements Serializable {
private String key;
private String value;
private LocalDateTime time;
}

View File

@ -91,6 +91,13 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<!-- Fastjson -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
</dependency>
</dependencies>

View File

@ -0,0 +1,24 @@
package com.cxyxiaomo.epp.access.controller;
import com.cxyxiaomo.epp.access.service.WeChatTokenServiceImpl;
import com.cxyxiaomo.epp.common.response.Res;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/access/wechat")
public class WeChatTokenController {
@Autowired
private WeChatTokenServiceImpl weChatTokenService;
@GetMapping("/getAccessToken")
@ResponseBody
public Res getAccessToken() {
String accessToken = weChatTokenService.getAccessToken();
return Res.success(accessToken);
}
}

View File

@ -1,10 +1,13 @@
package com.cxyxiaomo.epp.access.dao;
import com.cxyxiaomo.epp.common.pojo.Setting;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface AccessDao {
Integer updateSetting(Setting setting);
Setting getValueByKey(String key);
}

View File

@ -0,0 +1,5 @@
package com.cxyxiaomo.epp.access.service;
public interface WeChatTokenService {
String getAccessToken();
}

View File

@ -0,0 +1,84 @@
package com.cxyxiaomo.epp.access.service;
import com.alibaba.fastjson2.JSONObject;
import com.cxyxiaomo.epp.access.dao.AccessDao;
import com.cxyxiaomo.epp.access.utils.RestUtil;
import com.cxyxiaomo.epp.common.pojo.Setting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@Service
public class WeChatTokenServiceImpl implements WeChatTokenService {
@Autowired
AccessDao accessDao;
// 数据库中该 key 保存的 time 是失效时间
final String SETTING_KEY = "wechat_access_token";
// 小程序信息
final String APPID = "wxa70348746d2b562f";
final String APPSECRET = "7da57703136fefb0584a5a6ab1aca152";
@Override
public String getAccessToken() {
// 首先从数据库中查询是否存在 access_token
// 如果存在且没有过期那么就直接返回距离失效时间小于 3 分钟就当作过期
Setting atSetting = accessDao.getValueByKey(SETTING_KEY);
if (atSetting != null && LocalDateTime.now().plusMinutes(3L).compareTo(atSetting.getTime()) < 0) {
return atSetting.getValue();
}
// 否则则去请求一个新的 access_token
JSONObject jsonObject = getAccessTokenFromApi();
String access_token = jsonObject.getString("access_token");
Integer expires_in = jsonObject.getInteger("expires_in");
// 如果请求成功那么更新数据库中的记录
if (access_token != null) {
Setting setting = new Setting();
setting.setKey(SETTING_KEY);
setting.setValue(access_token);
setting.setTime(LocalDateTime.now().plusSeconds(expires_in));
accessDao.updateSetting(setting);
}
return access_token;
// Map<String, Object> map = new HashMap<>();
// map.put("raw", jsonObject);
// if (access_token == null) {
// // 获取失败
// Integer errcode = jsonObject.getInteger("errcode");
// String errmsg = jsonObject.getString("errmsg");
// map.put("errcode", errcode);
// map.put("errmsg", errmsg);
// } else {
// // 获取成功
// map.put("access_token", access_token);
// map.put("expires_in", expires_in);
// }
// return map;
}
private JSONObject getAccessTokenFromApi() {
// refer: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
String url = String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", APPID, APPSECRET);
HttpHeaders headers = new HttpHeaders();
// headers.set("Authorization", "Token " + this.accessToken);
String jsonStr = RestUtil.doGetRequest(url, headers);
return JSONObject.parseObject(jsonStr);
}
}
/*
{
"success": true,
"msg": "操作成功",
"data": "{\"access_token\":\"63_ez5i6A4ib1-kwi-g6n_3LLqdthenpZGIHTs1tXXcYqia8mnntJlTc_Mkl8CtuiXx0oplHbEVXrkVycvNwkyXhbA2Yj5K1kCan-AjOjH_-zaleYfg-S3zDWO9uoUQWVbACALRQ\",\"expires_in\":7200}"
}
*/

View File

@ -0,0 +1,23 @@
package com.cxyxiaomo.epp.access.utils;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
public class RestUtil {
private RestUtil() {
}
public static String doGetRequest(String url, HttpHeaders headers) {
RestTemplate client = new RestTemplate();
HttpMethod method = HttpMethod.GET;
HttpEntity<String> requestEntity = new HttpEntity<String>("parameters", headers);
// 执行HTTP请求将返回的结构使用String类格式化
ResponseEntity<String> response = client.exchange(url, method, requestEntity, String.class);
return response.getBody();
}
}

View File

@ -3,5 +3,14 @@
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.epp.access.dao.AccessDao">
<insert id="updateSetting" parameterType="com.cxyxiaomo.epp.common.pojo.Setting">
INSERT INTO setting (`key`, `value`, `time`)
VALUES (#{key}, #{value}, #{time})
ON DUPLICATE KEY UPDATE
`value` = VALUES(`value`), `time` = VALUES(`time`)
</insert>
<select id="getValueByKey" parameterType="java.lang.String" resultType="com.cxyxiaomo.epp.common.pojo.Setting">
SELECT * FROM setting
WHERE `key` = #{key}
</select>
</mapper>

View File

@ -121,6 +121,13 @@
<version>2.2.2</version>
</dependency>
<!-- Fastjson -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.19</version>
</dependency>
<!-- jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>

View File

@ -11,17 +11,17 @@
Target Server Version : 80012
File Encoding : 65001
Date: 24/11/2022 01:25:43
Date: 28/11/2022 00:01:00
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for apply
-- Table structure for apply1
-- ----------------------------
DROP TABLE IF EXISTS `apply`;
CREATE TABLE `apply` (
DROP TABLE IF EXISTS `apply1`;
CREATE TABLE `apply1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`stu_id` int(11) NULL DEFAULT NULL COMMENT '用户id',
`issue` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '申请事由',
@ -32,27 +32,27 @@ CREATE TABLE `apply` (
`state` int(11) NULL DEFAULT 0 COMMENT '状态(0:审批中,1:通过,2:驳回)',
`reason` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '驳回原因',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of apply
-- Records of apply1
-- ----------------------------
INSERT INTO `apply` VALUES (1, 1, '11', '飞机', '33', '2022-02-15 11:20:00', '2022-02-15 13:20:00', 2, '格式错误');
INSERT INTO `apply` VALUES (2, 2, '333', '大巴', '333', '2022-02-15 11:51:00', '2022-02-15 13:51:00', 1, '');
INSERT INTO `apply` VALUES (3, 2, '333', '大巴', '333', '2022-02-15 11:51:00', '2022-02-15 13:51:00', 2, '格式错误');
INSERT INTO `apply` VALUES (4, 2, '1', '动车', '2', '2022-03-12 13:45:00', '2022-03-12 15:45:00', 1, '');
INSERT INTO `apply` VALUES (5, 2, '11', '飞机', '22', '2022-03-12 20:29:00', '2022-03-12 22:29:00', 1, '');
INSERT INTO `apply` VALUES (6, 1, '123', '飞机', '123', '2022-03-19 13:37:00', '2022-03-19 15:37:00', 1, '');
INSERT INTO `apply` VALUES (9, 10, '1', '飞机', '1', '2022-06-15 10:41:00', '2022-06-15 12:41:00', 1, '');
INSERT INTO `apply` VALUES (10, 12, '1', '飞机', '1', '2022-06-15 10:53:00', '2022-06-15 12:53:00', 2, '格式错误');
INSERT INTO `apply` VALUES (11, 2, '1', '飞机', '1', '2022-10-23 16:17:00', '2022-10-23 18:17:00', 1, '');
INSERT INTO `apply` VALUES (12, 13, '1', '飞机', '1', '2022-10-26 19:25:00', '2022-10-26 21:25:00', 1, '');
INSERT INTO `apply1` VALUES (1, 1, '11', '飞机', '33', '2022-02-15 11:20:00', '2022-02-15 13:20:00', 2, '格式错误');
INSERT INTO `apply1` VALUES (2, 2, '333', '大巴', '333', '2022-02-15 11:51:00', '2022-02-15 13:51:00', 1, '');
INSERT INTO `apply1` VALUES (3, 2, '333', '大巴', '333', '2022-02-15 11:51:00', '2022-02-15 13:51:00', 2, '格式错误');
INSERT INTO `apply1` VALUES (4, 2, '1', '动车', '2', '2022-03-12 13:45:00', '2022-03-12 15:45:00', 1, '');
INSERT INTO `apply1` VALUES (5, 2, '11', '飞机', '22', '2022-03-12 20:29:00', '2022-03-12 22:29:00', 1, '');
INSERT INTO `apply1` VALUES (6, 1, '123', '飞机', '123', '2022-03-19 13:37:00', '2022-03-19 15:37:00', 1, '');
INSERT INTO `apply1` VALUES (9, 10, '1', '飞机', '1', '2022-06-15 10:41:00', '2022-06-15 12:41:00', 1, '');
INSERT INTO `apply1` VALUES (10, 12, '1', '飞机', '1', '2022-06-15 10:53:00', '2022-06-15 12:53:00', 2, '格式错误');
INSERT INTO `apply1` VALUES (11, 2, '1', '飞机', '1', '2022-10-23 16:17:00', '2022-10-23 18:17:00', 1, '');
INSERT INTO `apply1` VALUES (12, 13, '1', '飞机', '1', '2022-10-26 19:25:00', '2022-10-26 21:25:00', 1, '');
-- ----------------------------
-- Table structure for count
-- Table structure for count1
-- ----------------------------
DROP TABLE IF EXISTS `count`;
CREATE TABLE `count` (
DROP TABLE IF EXISTS `count1`;
CREATE TABLE `count1` (
`date` date NOT NULL COMMENT '日期',
`time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '时间',
`in_num` int(11) NULL DEFAULT NULL COMMENT '入校人数',
@ -61,14 +61,14 @@ CREATE TABLE `count` (
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of count
-- Records of count1
-- ----------------------------
-- ----------------------------
-- Table structure for feedback
-- Table structure for feedback1
-- ----------------------------
DROP TABLE IF EXISTS `feedback`;
CREATE TABLE `feedback` (
DROP TABLE IF EXISTS `feedback1`;
CREATE TABLE `feedback1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '反馈标题',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '反馈内容',
@ -76,37 +76,37 @@ CREATE TABLE `feedback` (
`user_id` int(11) NULL DEFAULT NULL COMMENT '反馈用户id',
`reply` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '回复',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of feedback
-- Records of feedback1
-- ----------------------------
INSERT INTO `feedback` VALUES (1, '111', '222', '2022-02-14 10:18:29', 1, '22');
INSERT INTO `feedback` VALUES (2, '111', '222', '2022-02-14 10:20:05', 1, '33');
INSERT INTO `feedback` VALUES (3, '22', '33', '2022-02-14 10:20:29', 1, 'no');
INSERT INTO `feedback` VALUES (4, '``', '11', '2022-02-14 10:22:12', 1, '111');
INSERT INTO `feedback` VALUES (5, '123', '123456', '2022-03-28 19:34:04', 2, NULL);
INSERT INTO `feedback1` VALUES (1, '111', '222', '2022-02-14 10:18:29', 1, '22');
INSERT INTO `feedback1` VALUES (2, '111', '222', '2022-02-14 10:20:05', 1, '33');
INSERT INTO `feedback1` VALUES (3, '22', '33', '2022-02-14 10:20:29', 1, 'no');
INSERT INTO `feedback1` VALUES (4, '``', '11', '2022-02-14 10:22:12', 1, '111');
INSERT INTO `feedback1` VALUES (5, '123', '123456', '2022-03-28 19:34:04', 2, NULL);
-- ----------------------------
-- Table structure for notice
-- Table structure for notice1
-- ----------------------------
DROP TABLE IF EXISTS `notice`;
CREATE TABLE `notice` (
DROP TABLE IF EXISTS `notice1`;
CREATE TABLE `notice1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标题',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '内容',
`time` date NULL DEFAULT NULL COMMENT '时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of notice
-- Records of notice1
-- ----------------------------
INSERT INTO `notice` VALUES (1, '请各位学生戴好口罩', NULL, '2022-03-15');
INSERT INTO `notice` VALUES (2, '请各位学生不要随意出入校门', NULL, '2022-03-15');
INSERT INTO `notice` VALUES (7, '11', '22', '2022-03-22');
INSERT INTO `notice` VALUES (8, '22', '22', '2022-04-14');
INSERT INTO `notice` VALUES (9, '33', '33', '2022-04-14');
INSERT INTO `notice1` VALUES (1, '请各位学生戴好口罩', NULL, '2022-03-15');
INSERT INTO `notice1` VALUES (2, '请各位学生不要随意出入校门', NULL, '2022-03-15');
INSERT INTO `notice1` VALUES (7, '11', '22', '2022-03-22');
INSERT INTO `notice1` VALUES (8, '22', '22', '2022-04-14');
INSERT INTO `notice1` VALUES (9, '33', '33', '2022-04-14');
-- ----------------------------
-- Table structure for report
@ -119,9 +119,6 @@ CREATE TABLE `report` (
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
`time` datetime NULL DEFAULT NULL COMMENT '填报时间',
`normal` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '体温是否正常',
`yes_noon_temp` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昨日午检体温',
`yes_night_temp` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昨日晚检体温',
`today_morning_temp` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '今日晨检体温',
`isolation` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '隔离情况',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 44 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
@ -129,50 +126,65 @@ CREATE TABLE `report` (
-- ----------------------------
-- Records of report
-- ----------------------------
INSERT INTO `report` VALUES (1, 2, '廖鸿志', '福建省福州市晋安区福新中路109-19号', '2022-02-15 15:17:16', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (2, 2, '廖鸿志', '福建省福州市晋安区福新中路109-19号', '2022-02-15 15:57:33', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (3, 1, '管理员', '河南省郑州市中原区桐柏北路6号', '2022-03-07 20:39:28', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (4, 1, '管理员', '河南省郑州市中原区桐柏北路6号', '2022-03-07 20:39:28', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (5, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 14:46:02', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (6, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:09:35', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (7, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:12:27', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (8, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:13:04', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (9, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:14:23', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (10, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:15:23', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (11, 2, '廖鸿志', '福建省福州市鼓楼区乌山路96号', '2022-03-11 11:11:49', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (12, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-18 09:55:44', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (13, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-18 09:55:35', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (14, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-18 09:55:35', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (15, 2, '廖鸿志', '福建省福州市晋安区福新中路109-19号', '2022-03-18 09:59:39', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (16, 1, '管理员', '河南省安阳市文峰区文明大道东段72号', '2022-03-19 13:39:05', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (17, 1, '管理员', '河南省安阳市文峰区文明大道东段72号', '2022-03-19 13:39:05', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (18, 1, '管理员', '河南省安阳市文峰区文明大道72号', '2022-03-19 13:40:19', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (19, 1, '管理员', '河南省安阳市文峰区文明大道72号', '2022-03-19 13:40:19', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (20, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-03-28 19:06:51', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (21, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-03-28 19:06:51', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (22, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-03-28 19:06:51', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (23, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 15:52:50', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (24, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 15:55:32', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (25, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 15:57:57', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (26, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 16:04:07', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (27, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 16:04:07', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (28, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 16:04:53', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (29, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 10:53:29', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (30, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 10:54:12', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (31, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 10:58:59', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (32, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 11:01:08', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (33, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 11:01:51', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (34, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-04-14 18:28:08', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (35, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-04-14 18:32:43', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (36, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-04-16 00:06:00', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (37, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-04-16 00:13:06', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (38, 11, '老师', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:35:13', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (39, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:45:05', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (40, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:45:24', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (41, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:45:24', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (42, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:49:32', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (43, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:51:51', '发热', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (44, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:53:00', '正常', '36.2', '36.4', '36.2', '无需隔离');
INSERT INTO `report` VALUES (1, 2, '廖鸿志', '福建省福州市晋安区福新中路109-19号', '2022-02-15 15:17:16', '正常', '无需隔离');
INSERT INTO `report` VALUES (2, 2, '廖鸿志', '福建省福州市晋安区福新中路109-19号', '2022-02-15 15:57:33', '正常', '无需隔离');
INSERT INTO `report` VALUES (3, 1, '管理员', '河南省郑州市中原区桐柏北路6号', '2022-03-07 20:39:28', '正常', '无需隔离');
INSERT INTO `report` VALUES (4, 1, '管理员', '河南省郑州市中原区桐柏北路6号', '2022-03-07 20:39:28', '正常', '无需隔离');
INSERT INTO `report` VALUES (5, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 14:46:02', '正常', '无需隔离');
INSERT INTO `report` VALUES (6, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:09:35', '正常', '无需隔离');
INSERT INTO `report` VALUES (7, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:12:27', '正常', '无需隔离');
INSERT INTO `report` VALUES (8, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:13:04', '正常', '无需隔离');
INSERT INTO `report` VALUES (9, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:14:23', '正常', '无需隔离');
INSERT INTO `report` VALUES (10, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-09 15:15:23', '正常', '无需隔离');
INSERT INTO `report` VALUES (11, 2, '廖鸿志', '福建省福州市鼓楼区乌山路96号', '2022-03-11 11:11:49', '正常', '无需隔离');
INSERT INTO `report` VALUES (12, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-18 09:55:44', '正常', '无需隔离');
INSERT INTO `report` VALUES (13, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-18 09:55:35', '正常', '无需隔离');
INSERT INTO `report` VALUES (14, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-18 09:55:35', '正常', '无需隔离');
INSERT INTO `report` VALUES (15, 2, '廖鸿志', '福建省福州市晋安区福新中路109-19号', '2022-03-18 09:59:39', '正常', '无需隔离');
INSERT INTO `report` VALUES (16, 1, '管理员', '河南省安阳市文峰区文明大道东段72号', '2022-03-19 13:39:05', '正常', '无需隔离');
INSERT INTO `report` VALUES (17, 1, '管理员', '河南省安阳市文峰区文明大道东段72号', '2022-03-19 13:39:05', '正常', '无需隔离');
INSERT INTO `report` VALUES (18, 1, '管理员', '河南省安阳市文峰区文明大道72号', '2022-03-19 13:40:19', '正常', '无需隔离');
INSERT INTO `report` VALUES (19, 1, '管理员', '河南省安阳市文峰区文明大道72号', '2022-03-19 13:40:19', '正常', '无需隔离');
INSERT INTO `report` VALUES (20, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-03-28 19:06:51', '正常', '无需隔离');
INSERT INTO `report` VALUES (21, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-03-28 19:06:51', '正常', '无需隔离');
INSERT INTO `report` VALUES (22, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-03-28 19:06:51', '正常', '无需隔离');
INSERT INTO `report` VALUES (23, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 15:52:50', '发热', '无需隔离');
INSERT INTO `report` VALUES (24, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 15:55:32', '发热', '无需隔离');
INSERT INTO `report` VALUES (25, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 15:57:57', '正常', '无需隔离');
INSERT INTO `report` VALUES (26, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 16:04:07', '发热', '无需隔离');
INSERT INTO `report` VALUES (27, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 16:04:07', '发热', '无需隔离');
INSERT INTO `report` VALUES (28, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-03-30 16:04:53', '发热', '无需隔离');
INSERT INTO `report` VALUES (29, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 10:53:29', '正常', '无需隔离');
INSERT INTO `report` VALUES (30, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 10:54:12', '发热', '无需隔离');
INSERT INTO `report` VALUES (31, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 10:58:59', '正常', '无需隔离');
INSERT INTO `report` VALUES (32, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 11:01:08', '正常', '无需隔离');
INSERT INTO `report` VALUES (33, 1, '管理员', '福建省福州市鼓楼区乌山路96号', '2022-04-05 11:01:51', '正常', '无需隔离');
INSERT INTO `report` VALUES (34, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-04-14 18:28:08', '正常', '无需隔离');
INSERT INTO `report` VALUES (35, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-04-14 18:32:43', '正常', '无需隔离');
INSERT INTO `report` VALUES (36, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-04-16 00:06:00', '正常', '无需隔离');
INSERT INTO `report` VALUES (37, 1, '管理员', '福建省福州市晋安区福新中路109-19号', '2022-04-16 00:13:06', '正常', '无需隔离');
INSERT INTO `report` VALUES (38, 11, '老师', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:35:13', '发热', '无需隔离');
INSERT INTO `report` VALUES (39, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:45:05', '正常', '无需隔离');
INSERT INTO `report` VALUES (40, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:45:24', '发热', '无需隔离');
INSERT INTO `report` VALUES (41, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:45:24', '发热', '无需隔离');
INSERT INTO `report` VALUES (42, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:49:32', '正常', '无需隔离');
INSERT INTO `report` VALUES (43, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:51:51', '发热', '无需隔离');
INSERT INTO `report` VALUES (44, 12, '刘鸿宇', '福建省福州市晋安区福新中路109-19号', '2022-06-15 10:53:00', '正常', '无需隔离');
-- ----------------------------
-- Table structure for setting
-- ----------------------------
DROP TABLE IF EXISTS `setting`;
CREATE TABLE `setting` (
`key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间或失效时间具体根据key来判断',
UNIQUE INDEX `key`(`key`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of setting
-- ----------------------------
-- ----------------------------
-- Table structure for user
@ -191,7 +203,7 @@ CREATE TABLE `user` (
`permission` int(11) NOT NULL DEFAULT 0 COMMENT '进出权限 (0-无 1-继承(普通居民) 2-永久 3-限时)',
`permission_time` datetime NULL DEFAULT NULL COMMENT '进出权限失效时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of user
@ -219,10 +231,10 @@ INSERT INTO `user` VALUES (20, 'undefined', 'undefined', '信息2121', NULL, NUL
INSERT INTO `user` VALUES (21, '2', '2', '', NULL, NULL, 2, NULL, NULL, 0, NULL);
-- ----------------------------
-- Table structure for visitor
-- Table structure for visitor1
-- ----------------------------
DROP TABLE IF EXISTS `visitor`;
CREATE TABLE `visitor` (
DROP TABLE IF EXISTS `visitor1`;
CREATE TABLE `visitor1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime NULL DEFAULT NULL COMMENT '预约时间',
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预约用户id',
@ -231,24 +243,24 @@ CREATE TABLE `visitor` (
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`state` int(11) NULL DEFAULT 0 COMMENT '状态0审批中1成功2驳回',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of visitor
-- Records of visitor1
-- ----------------------------
INSERT INTO `visitor` VALUES (1, '2022-03-09 09:46:50', '136', NULL, NULL, NULL, 1);
INSERT INTO `visitor` VALUES (2, '2022-03-09 00:00:00', '1', '2', '王老师', NULL, 1);
INSERT INTO `visitor` VALUES (3, '2022-03-13 00:00:00', '123', '123', '123', NULL, 1);
INSERT INTO `visitor` VALUES (4, '2022-03-17 00:00:00', '183', '11', '1111', NULL, 1);
INSERT INTO `visitor` VALUES (5, '2022-03-20 07:00:00', '15555150781', '测试', '王德发', NULL, 1);
INSERT INTO `visitor` VALUES (6, '2022-03-20 07:00:00', '15555150782', '测试', '王德发', NULL, 1);
INSERT INTO `visitor` VALUES (7, '2022-03-20 00:00:00', '12345', '返校', '自己', NULL, 1);
INSERT INTO `visitor` VALUES (8, '2022-03-21 00:00:00', '1', '1', '1', NULL, 1);
INSERT INTO `visitor` VALUES (9, '2022-03-22 00:00:00', '11', '11', '1', NULL, 1);
INSERT INTO `visitor` VALUES (10, '2022-03-22 00:00:00', '183', '1', '123', NULL, 1);
INSERT INTO `visitor` VALUES (11, '2022-04-20 00:00:00', '19851691582', '看吧', '哈哈', NULL, 0);
INSERT INTO `visitor` VALUES (12, '2022-04-26 00:00:00', '18835381168', 'jin', 'zhang ', NULL, 0);
INSERT INTO `visitor` VALUES (13, '2022-06-15 00:00:00', '18250314786', '1', '1', NULL, 1);
INSERT INTO `visitor` VALUES (14, '2022-10-08 00:00:00', '151000', '入校', '王龙', NULL, 0);
INSERT INTO `visitor1` VALUES (1, '2022-03-09 09:46:50', '136', NULL, NULL, NULL, 1);
INSERT INTO `visitor1` VALUES (2, '2022-03-09 00:00:00', '1', '2', '王老师', NULL, 1);
INSERT INTO `visitor1` VALUES (3, '2022-03-13 00:00:00', '123', '123', '123', NULL, 1);
INSERT INTO `visitor1` VALUES (4, '2022-03-17 00:00:00', '183', '11', '1111', NULL, 1);
INSERT INTO `visitor1` VALUES (5, '2022-03-20 07:00:00', '15555150781', '测试', '王德发', NULL, 1);
INSERT INTO `visitor1` VALUES (6, '2022-03-20 07:00:00', '15555150782', '测试', '王德发', NULL, 1);
INSERT INTO `visitor1` VALUES (7, '2022-03-20 00:00:00', '12345', '返校', '自己', NULL, 1);
INSERT INTO `visitor1` VALUES (8, '2022-03-21 00:00:00', '1', '1', '1', NULL, 1);
INSERT INTO `visitor1` VALUES (9, '2022-03-22 00:00:00', '11', '11', '1', NULL, 1);
INSERT INTO `visitor1` VALUES (10, '2022-03-22 00:00:00', '183', '1', '123', NULL, 1);
INSERT INTO `visitor1` VALUES (11, '2022-04-20 00:00:00', '19851691582', '看吧', '哈哈', NULL, 0);
INSERT INTO `visitor1` VALUES (12, '2022-04-26 00:00:00', '18835381168', 'jin', 'zhang ', NULL, 0);
INSERT INTO `visitor1` VALUES (13, '2022-06-15 00:00:00', '18250314786', '1', '1', NULL, 1);
INSERT INTO `visitor1` VALUES (14, '2022-10-08 00:00:00', '151000', '入校', '王龙', NULL, 0);
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -6,89 +6,120 @@
},
"item": [
{
"name": "用户登录 微服务域名",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://localhost:8001/user/login?username=root&password=63a9f0ea7bb98050796b649e85481845",
"protocol": "http",
"host": [
"localhost"
],
"port": "8001",
"path": [
"user",
"login"
],
"query": [
{
"key": "username",
"value": "root"
},
{
"key": "password",
"value": "63a9f0ea7bb98050796b649e85481845"
"name": "UserProvider",
"item": [
{
"name": "[微服务] 用户登录",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://localhost:8001/user/login?username=root&password=63a9f0ea7bb98050796b649e85481845",
"protocol": "http",
"host": [
"localhost"
],
"port": "8001",
"path": [
"user",
"login"
],
"query": [
{
"key": "username",
"value": "root"
},
{
"key": "password",
"value": "63a9f0ea7bb98050796b649e85481845"
}
]
}
]
},
"response": []
}
},
"response": []
]
},
{
"name": "获取用户进出码信息 微服务域名",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://localhost:8002/access/code/getCodeInfo?id=1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8002",
"path": [
"access",
"code",
"getCodeInfo"
],
"query": [
{
"key": "id",
"value": "1"
"name": "AccessProvider",
"item": [
{
"name": "[微服务] 获取用户进出码信息",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://localhost:8002/access/code/getCodeInfo?id=1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8002",
"path": [
"access",
"code",
"getCodeInfo"
],
"query": [
{
"key": "id",
"value": "1"
}
]
}
]
}
},
"response": []
},
{
"name": "获取用户进出码信息 线上域名",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://epp.only4.work/access/code/getCodeInfo?id=1",
"protocol": "http",
"host": [
"epp",
"only4",
"work"
],
"path": [
"access",
"code",
"getCodeInfo"
],
"query": [
{
"key": "id",
"value": "1"
},
"response": []
},
{
"name": "[线上] 获取用户进出码信息",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "https://epp.only4.work/access/code/getCodeInfo?id=1",
"protocol": "https",
"host": [
"epp",
"only4",
"work"
],
"path": [
"access",
"code",
"getCodeInfo"
],
"query": [
{
"key": "id",
"value": "1"
}
]
}
]
},
"response": []
},
{
"name": "[微服务] 获取微信小程序AccessToken",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:8002/access/wechat/getAccessToken",
"protocol": "http",
"host": [
"localhost"
],
"port": "8002",
"path": [
"access",
"wechat",
"getAccessToken"
]
}
},
"response": []
}
},
"response": []
]
}
]
}