From d96fd3d536f5291dad4050d3dbec9595cec152a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Wed, 26 Apr 2023 00:24:56 +0800 Subject: [PATCH 1/2] update --- 20230425-epp.md | 60 ++++++++++ JMeter测试-HTTP请求.jmx | 252 ++++++++++++++++++++++++++++++++++++++++ README.md | 5 +- 3 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 20230425-epp.md create mode 100644 JMeter测试-HTTP请求.jmx diff --git a/20230425-epp.md b/20230425-epp.md new file mode 100644 index 0000000..613c7ef --- /dev/null +++ b/20230425-epp.md @@ -0,0 +1,60 @@ +# 基于微服务的社区疫情防控系统 + +Epidemic prevention platform + +> 项目首页: +> +> https://epp.only4.work/ +> +> 代码仓库地址: +> +> https://git.only4.work/coder-xiaomo/epp + +本项目采用 monorepo 单仓库模式进行维护,项目完整代码均在此仓库中。 + + + +## 管理员后台 + +> 管理员后台地址: +> +> https://epp.only4.work/manage/index.html + +社区管理员 测试账号:admin admin + +系统管理员 测试账号:root root + + + +## 门禁端 + +>网页版地址: +> +>https://epp.only4.work/guard/index.html + +可以直接用 **微信扫一扫功能** 或 **小程序端“扫门禁码”功能** 扫描门禁码,**扫描**及**确认进门**操作门禁端会弹出成功提示 + +\* 跨端桌面应用界面和功能均与网页版一致 + + + +## 小程序 + +> 小程序已审核上线,可以搜索 **devprogram** 或者扫描下方小程序码 + +\* 由于生活物资、进出码无法审核通过,所以**提审时隐藏了部分功能入口**。 + +如果登录之后**下方只有体温上报功能**,可以**点击右上角三个点→重新进入小程序**即可展示全部功能。 + +![](https://epp.only4.work/assets/image/miniprogram.jpg) + + + +
+ + +----- + +
+张博凯 +
\ No newline at end of file diff --git a/JMeter测试-HTTP请求.jmx b/JMeter测试-HTTP请求.jmx new file mode 100644 index 0000000..ebf174d --- /dev/null +++ b/JMeter测试-HTTP请求.jmx @@ -0,0 +1,252 @@ + + + + + + false + true + false + + + + + + + + continue + + false + -1 + + 10 + 1 + false + + + true + + + + + + + epp.only4.work + 80 + https + + /user/manage/getUserList + GET + true + false + true + false + + + + + + + + + Assertion.response_data + false + 16 + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + continue + + false + -1 + + 800 + 1 + false + + + true + + + + + + + localhost + 80 + http + + /access/code/getCodeInfo?id=1 + POST + true + false + true + true + + HttpClient4 + 300000 + + + + + + + Assertion.response_data + false + 16 + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + + diff --git a/README.md b/README.md index 2f0fcfc..8542bfd 100644 --- a/README.md +++ b/README.md @@ -383,7 +383,10 @@ const envVersion = "【⚠此处修改为当前小程序环境】" // 正式版 ##### 打 jar 包 -IDEA 中右侧 Maven 双击 Lifestyle 的 package,打包完成后的 jar 包可在以下位置找到 +> 打包需要一起打包,每个项目单独打包可能会提示找不到 microservice-common 相关依赖 + +IDEA 中右侧 Maven 双击 Lifestyle 的 package(建议先 clean 一下,并点击选中 Maven 的跳过测试,再进行 package),打包完成后的 jar 包可在以下位置找到 + - backend/microservice-gateway/target/microservice-gateway-0.0.1-SNAPSHOT.jar - backend/microservice-provider-user-8001/target/microservice-provider-user-8001-0.0.1-SNAPSHOT.jar - backend/microservice-provider-access-8002/target/microservice-provider-access-8002-0.0.1-SNAPSHOT.jar From 2d145793b4278daafdd3496eeb0eee60f8850a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Wed, 26 Apr 2023 01:01:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=AB=AF?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=9A=90=E8=97=8F=E5=8A=9F=E8=83=BD=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E4=BC=A0=E5=8F=82=E6=8C=87=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._Gateway__epp_miniprogram_config_hide_.xml | 19 ++ .../epp/gateway/controller/Controller.java | 17 +- .../src/main/resources/application.yml | 6 + .../custom-tab-bar/toggleCustomTabBar.js | 194 +++++++++--------- 4 files changed, 138 insertions(+), 98 deletions(-) create mode 100644 backend/.idea/runConfigurations/Dev_Gateway__epp_miniprogram_config_hide_.xml diff --git a/backend/.idea/runConfigurations/Dev_Gateway__epp_miniprogram_config_hide_.xml b/backend/.idea/runConfigurations/Dev_Gateway__epp_miniprogram_config_hide_.xml new file mode 100644 index 0000000..736d9ea --- /dev/null +++ b/backend/.idea/runConfigurations/Dev_Gateway__epp_miniprogram_config_hide_.xml @@ -0,0 +1,19 @@ + + + + + + + + \ No newline at end of file diff --git a/backend/microservice-gateway/src/main/java/com/cxyxiaomo/epp/gateway/controller/Controller.java b/backend/microservice-gateway/src/main/java/com/cxyxiaomo/epp/gateway/controller/Controller.java index c2ef4ce..9840ba8 100644 --- a/backend/microservice-gateway/src/main/java/com/cxyxiaomo/epp/gateway/controller/Controller.java +++ b/backend/microservice-gateway/src/main/java/com/cxyxiaomo/epp/gateway/controller/Controller.java @@ -1,10 +1,13 @@ package com.cxyxiaomo.epp.gateway.controller; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.LinkedList; +import java.util.Objects; @RestController public class Controller { @@ -14,17 +17,29 @@ public class Controller { return "[ERROR] 500 Internal Server Error"; } + @Value("${epp.miniprogram.config}") + private String miniprogramConfig; + /** * 为了通过微信的小程序审核所特别处理的 * * @return */ @RequestMapping("/getConfig") - public HashMap WxMiniProgramAuditSpecialHandle() { + public HashMap WxMiniProgramAuditSpecialHandle(@RequestParam(value = "v", required = false) String version) { boolean showCode = true; boolean showShop = true; boolean showReport = true; + // 第一版提审,已通过,在线上 version == null + if (version.equals("2")) { + // 第一版提审,按照配置文件中的配置来 + if (Objects.equals(miniprogramConfig, "hide")) { + showCode = false; + showShop = false; + } + } + // 底部 tabbar LinkedList tabbarItem = new LinkedList<>(); tabbarItem.push("pages/index/index"); diff --git a/backend/microservice-gateway/src/main/resources/application.yml b/backend/microservice-gateway/src/main/resources/application.yml index 60c5f09..a4ea6b0 100644 --- a/backend/microservice-gateway/src/main/resources/application.yml +++ b/backend/microservice-gateway/src/main/resources/application.yml @@ -97,3 +97,9 @@ spring: args: status: 302 url: https://www.baidu.com/?wd= + +epp: + miniprogram: + # 为了通过微信的小程序审核所特别处理的 + # show / hide + config: show diff --git a/weixin-miniprogram/custom-tab-bar/toggleCustomTabBar.js b/weixin-miniprogram/custom-tab-bar/toggleCustomTabBar.js index e0b8370..9feaeca 100644 --- a/weixin-miniprogram/custom-tab-bar/toggleCustomTabBar.js +++ b/weixin-miniprogram/custom-tab-bar/toggleCustomTabBar.js @@ -1,97 +1,97 @@ -var defaultTabbarItem = [ - "pages/person/person", - "pages/residents/report", - "pages/index/index" -] - -export function toggle(that) { - let pages = getCurrentPages() - let route = pages[pages.length - 1].route - console.log("[CustomTabBar] route", route) - - if (!typeof that.getTabBar === 'function' || !that.getTabBar()) { - // wx.showModal({ - // title: '版本太旧', - // content: '您的微信版本太旧,无法使用本小程序', - // showCancel: false, - // complete: (res) => { - // wx.exitMiniProgram() - // } - // }) - return - } - - // 找出要选择哪一项 - let tabBar = that.getTabBar() - console.log("[CustomTabBar] tabBar", tabBar) - - let data = tabBar.data - console.log("[CustomTabBar] data", data) - - let showPagePathList = wx.getStorageSync('tabbarItem') || defaultTabbarItem - console.log("[CustomTabBar] showPagePathList", showPagePathList) - - let list = tabBar.data.rawList.filter((page) => showPagePathList.includes(page.pagePath)) - console.log("[CustomTabBar] tabBarList", list) - - let selected = list ? list.indexOf(list.find(p => p.pagePath == route)) : -1 - console.log("[CustomTabBar] selected", selected) - - console.log("更新tabbar") - - // 选中这一项 - tabBar.setData({ - selected: selected, - list: list - }) -} - -export function updateConfig(baseUrl) { - // 请求配置文件(用于审核时隐藏部分功能) - wx.request({ - url: baseUrl + '/getConfig', - success(result) { - let data = result.data - if (data.tabbarItem) { - console.log("[CustomTabBar] tabbar数据拉取完毕") - wx.setStorageSync('tabbarItem', data.tabbarItem) - wx.setStorageSync('indexItem', data.indexItem) - - const pages = getCurrentPages(); - const indexPage = pages[0] - const currentPage = pages[pages.length - 1] - console.log("[CustomTabBar] indexPage", indexPage) - console.log("[CustomTabBar] currentPage", currentPage) - - // // 更新tabbar - // toggle(currentPage) - // 刷新首页中包含了触发 toggle 的代码 此处不重复触发 - - // 刷新首页 - indexPage && indexPage.onLoad() - - // let tabBar = currentPage.getTabBar() - // tabBar.setData({ - // list: tabBar.data.rawList.filter((page) => itemList.includes(page.pagePath)) - // }) - } - }, - fail() { - wx.showModal({ - title: '小程序启动失败', - content: '点击确认重试,若多次失败请检查网络连接', - complete: (res) => { - if (res.cancel) { - wx.exitMiniProgram() - } - - if (res.confirm) { - wx.reLaunch({ - url: 'pages/index/index', - }) - } - } - }) - } - }) -} \ No newline at end of file +var defaultTabbarItem = [ + "pages/person/person", + "pages/residents/report", + "pages/index/index" +] + +export function toggle(that) { + let pages = getCurrentPages() + let route = pages[pages.length - 1].route + console.log("[CustomTabBar] route", route) + + if (!typeof that.getTabBar === 'function' || !that.getTabBar()) { + // wx.showModal({ + // title: '版本太旧', + // content: '您的微信版本太旧,无法使用本小程序', + // showCancel: false, + // complete: (res) => { + // wx.exitMiniProgram() + // } + // }) + return + } + + // 找出要选择哪一项 + let tabBar = that.getTabBar() + console.log("[CustomTabBar] tabBar", tabBar) + + let data = tabBar.data + console.log("[CustomTabBar] data", data) + + let showPagePathList = wx.getStorageSync('tabbarItem') || defaultTabbarItem + console.log("[CustomTabBar] showPagePathList", showPagePathList) + + let list = tabBar.data.rawList.filter((page) => showPagePathList.includes(page.pagePath)) + console.log("[CustomTabBar] tabBarList", list) + + let selected = list ? list.indexOf(list.find(p => p.pagePath == route)) : -1 + console.log("[CustomTabBar] selected", selected) + + console.log("更新tabbar") + + // 选中这一项 + tabBar.setData({ + selected: selected, + list: list + }) +} + +export function updateConfig(baseUrl) { + // 请求配置文件(用于审核时隐藏部分功能) + wx.request({ + url: baseUrl + '/getConfig?v=2', + success(result) { + let data = result.data + if (data.tabbarItem) { + console.log("[CustomTabBar] tabbar数据拉取完毕") + wx.setStorageSync('tabbarItem', data.tabbarItem) + wx.setStorageSync('indexItem', data.indexItem) + + const pages = getCurrentPages(); + const indexPage = pages[0] + const currentPage = pages[pages.length - 1] + console.log("[CustomTabBar] indexPage", indexPage) + console.log("[CustomTabBar] currentPage", currentPage) + + // // 更新tabbar + // toggle(currentPage) + // 刷新首页中包含了触发 toggle 的代码 此处不重复触发 + + // 刷新首页 + indexPage && indexPage.onLoad() + + // let tabBar = currentPage.getTabBar() + // tabBar.setData({ + // list: tabBar.data.rawList.filter((page) => itemList.includes(page.pagePath)) + // }) + } + }, + fail() { + wx.showModal({ + title: '小程序启动失败', + content: '点击确认重试,若多次失败请检查网络连接', + complete: (res) => { + if (res.cancel) { + wx.exitMiniProgram() + } + + if (res.confirm) { + wx.reLaunch({ + url: 'pages/index/index', + }) + } + } + }) + } + }) +}