寺庙小程序-H5网页开发

2024-06-01 08:12
文章标签 网页 程序 开发 h5 寺庙

本文主要是介绍寺庙小程序-H5网页开发,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

大家好,我是程序员小孟。

现在有很多的产品或者工具都开始信息话了,寺庙或者佛教也需要小程序吗?

当然了!

前面我们还开发了很多寺庙相关的小程序。

今天要介绍的是一款寺庙系统,该系统可以作为小程序、H5网页、安卓端。

根据目录快速阅读

    • 一,系统的用途
    • 二,系统的功能需求
    • 三,系统的技术栈
    • 四,系统演示
    • 五,系统的核心代码

一,系统的用途

该系统用于寺庙,在该系统中可以查询寺庙的信息,可以在线查看主持,在线看经,在线听经,在线预约,在线联系师傅等。

通过本系统实现了寺庙的宣传、用户线上听经、视经,信息的管理,提高了管理的效率。

二,系统的功能需求

用户:登录、注册、寺庙信息查看、在线听经、在线视经、在线预约祈福、在线留言、在线纪念馆查看

管理员:用户管理、寺庙信息管理、听经管理、视经管理、预约祈福审核、留言管理、纪念馆信息管理、数据统计等等。

三,系统的技术栈

因为客户没有技术方面的要求,那就按照我习惯用的技术开发的,无所谓什么最新不最新技术了。

小程序:uniapp

后台框架:SpringBoot,

数据库采用的Mysql,

后端的页面采用的Vue进行开发,

缓存用的Redis,

搜索引擎采用的是elasticsearch,

ORM层框架:MyBatis,

连接池:Druid,

分库分表:MyCat,

权限:SpringSecurity,

代码质量检查:sonar。

图片

看下系统的功能框架图应该更加清楚:

在这里插入图片描述

四,系统演示

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

五,系统的核心代码

package com.example.controller;import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.example.common.Result;
import com.example.common.ResultCode;
import com.example.entity.ShifuInfo;
import com.example.entity.UserInfo;
import com.example.entity.Account;
import com.example.exception.CustomException;
import com.example.service.ShifuInfoService;
import com.example.service.UserInfoService;
import cn.hutool.json.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.apache.poi.util.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;import java.io.IOException;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;@RestController
public class AccountController {@Resourceprivate UserInfoService userInfoService;@Value("${appId}")private String appId;@Value("${appSecret}")private String appSecret;@Resourceprivate ShifuInfoService shifuInfoService;@GetMapping("/logout")public Result logout(HttpServletRequest request) {request.getSession().setAttribute("user", null);return Result.success();}@GetMapping("/auth")public Result getAuth(HttpServletRequest request) {Object user = request.getSession().getAttribute("user");if(user == null) {return Result.error("401", "未登录");}return Result.success((UserInfo)user);}/*** 注册*/@PostMapping("/register")public Result<UserInfo> register(@RequestBody UserInfo userInfo, HttpServletRequest request) {UserInfo register = userInfoService.add(userInfo);return Result.success(register);}@PostMapping("/findUserByUserName")public Result<List<UserInfo>> findUserByUserName(@RequestBody UserInfo userInfo, HttpServletRequest request) {if (StrUtil.isBlank(userInfo.getName()) || StrUtil.isBlank(userInfo.getPassword())) {throw new CustomException(ResultCode.PARAM_ERROR);}List<UserInfo> register = userInfoService.findByUserName(userInfo);return Result.success(register);}@PostMapping("/wxFindUserByOpenId")public Result<UserInfo> wxFindUserByOpenId(@RequestBody UserInfo userInfo) {if (StrUtil.isBlank(userInfo.getOpenId())) {throw new CustomException(ResultCode.USER_OPENID_ERROR);}UserInfo login = userInfoService.wxFindUserByOpenId(userInfo.getOpenId());return Result.success(login);}@PostMapping("/wxFindUserByUserName")public Result<List<UserInfo>> wxFindUserByUserName(@RequestBody UserInfo userInfo, HttpServletRequest request) {if (StrUtil.isBlank(userInfo.getName()) || StrUtil.isBlank(userInfo.getPassword())) {throw new CustomException(ResultCode.PARAM_ERROR);}List<UserInfo> register = userInfoService.findByUserName2(userInfo);return Result.success(register);}/*** 登录*/@PostMapping("/endLogin")public Result<UserInfo> login(@RequestBody UserInfo userInfo, HttpServletRequest request) {if (StrUtil.isBlank(userInfo.getName()) || StrUtil.isBlank(userInfo.getPassword())) {throw new CustomException(ResultCode.USER_ACCOUNT_ERROR);}UserInfo login = userInfoService.login(userInfo.getName(), userInfo.getPassword());HttpSession session = request.getSession();session.setAttribute("user", login);session.setMaxInactiveInterval(120 * 60);return Result.success(login);}@PostMapping("/wxlogin")public Result<UserInfo> wxlogin(@RequestBody UserInfo userInfo, HttpServletRequest request) {if (StrUtil.isBlank(userInfo.getName()) || StrUtil.isBlank(userInfo.getPassword())) {throw new CustomException(ResultCode.USER_ACCOUNT_ERROR);}UserInfo login = userInfoService.wxlogin(userInfo.getName(), userInfo.getPassword());HttpSession session = request.getSession();session.setAttribute("user", login);session.setMaxInactiveInterval(120 * 60);return Result.success(login);}@PostMapping("/login2")public Result<ShifuInfo> login2(@RequestBody UserInfo userInfo, HttpServletRequest request) {if (StrUtil.isBlank(userInfo.getName()) || StrUtil.isBlank(userInfo.getPassword())) {throw new CustomException(ResultCode.USER_ACCOUNT_ERROR);}ShifuInfo login = shifuInfoService.login(userInfo.getName(), userInfo.getPassword());HttpSession session = request.getSession();session.setAttribute("user", login);session.setMaxInactiveInterval(120 * 60);return Result.success(login);}/*** 重置密码为123456*/@PutMapping("/resetPassword")public Result<UserInfo> resetPassword(@RequestParam String username) {return Result.success(userInfoService.resetPassword(username));}@PutMapping("/resetPassword2")public Result<ShifuInfo> resetPassword2(@RequestParam String username) {return Result.success(shifuInfoService.resetPassword(username));}@PutMapping("/updatePassword")public Result updatePassword(@RequestBody UserInfo info, HttpServletRequest request) {UserInfo account = (UserInfo) request.getSession().getAttribute("user");if (account == null) {return Result.error(ResultCode.USER_NOT_EXIST_ERROR.code, ResultCode.USER_NOT_EXIST_ERROR.msg);}String oldPassword = SecureUtil.md5(info.getPassword());if (!oldPassword.equals(account.getPassword())) {return Result.error(ResultCode.PARAM_PASSWORD_ERROR.code, ResultCode.PARAM_PASSWORD_ERROR.msg);}account.setPassword(SecureUtil.md5(info.getNewPassword()));userInfoService.update(account);// 清空session,让用户重新登录request.getSession().setAttribute("user", null);return Result.success();}@PutMapping("/updatePassword2")public Result updatePassword2(@RequestBody ShifuInfo info, HttpServletRequest request) {ShifuInfo account = (ShifuInfo) request.getSession().getAttribute("user");if (account == null) {return Result.error(ResultCode.USER_NOT_EXIST_ERROR.code, ResultCode.USER_NOT_EXIST_ERROR.msg);}String oldPassword = SecureUtil.md5(info.getPassword());if (!oldPassword.equals(account.getPassword())) {return Result.error(ResultCode.PARAM_PASSWORD_ERROR.code, ResultCode.PARAM_PASSWORD_ERROR.msg);}account.setPassword(SecureUtil.md5(info.getNewPassword()));shifuInfoService.update(account);// 清空session,让用户重新登录request.getSession().setAttribute("user", null);return Result.success();}@GetMapping("/mini/userInfo/{id}/{level}")public Result<Account> miniLogin(@PathVariable Long id, @PathVariable Integer level) {Account account = userInfoService.findByIdAndLevel(id, level);return Result.success(account);}/*** 修改密码*/@PutMapping("/changePassword")public Result<Boolean> changePassword(@RequestParam Long id,@RequestParam String newPassword) {return Result.success(userInfoService.changePassword(id, newPassword));}@GetMapping("/getSession")public Result<Map<String, String>> getSession(HttpServletRequest request) {UserInfo account = (UserInfo) request.getSession().getAttribute("user");if (account == null) {return Result.success(new HashMap<>(1));}Map<String, String> map = new HashMap<>(1);map.put("username", account.getName());return Result.success(map);}@GetMapping("/wxAuthorization/{code}")public Result wxAuthorization(@PathVariable String code) throws IOException, IOException {System.out.println("code" + code);String url = "https://api.weixin.qq.com/sns/jscode2session";url += "?appid="+appId;//自己的appidurl += "&secret="+appSecret;//自己的appSecreturl += "&js_code=" + code;url += "&grant_type=authorization_code";url += "&connect_redirect=1";String res = null;CloseableHttpClient httpClient = HttpClientBuilder.create().build();// DefaultHttpClient();HttpGet httpget = new HttpGet(url);    //GET方式CloseableHttpResponse response = null;// 配置信息RequestConfig requestConfig = RequestConfig.custom()          // 设置连接超时时间(单位毫秒).setConnectTimeout(5000)                    // 设置请求超时时间(单位毫秒).setConnectionRequestTimeout(5000)             // socket读写超时时间(单位毫秒).setSocketTimeout(5000)                    // 设置是否允许重定向(默认为true).setRedirectsEnabled(false).build();           // 将上面的配置信息 运用到这个Get请求里httpget.setConfig(requestConfig);                         // 由客户端执行(发送)Get请求response = httpClient.execute(httpget);                   // 从响应模型中获取响应实体HttpEntity responseEntity = response.getEntity();System.out.println("响应状态为:" + response.getStatusLine());if (responseEntity != null) {res = EntityUtils.toString(responseEntity);System.out.println("响应内容长度为:" + responseEntity.getContentLength());System.out.println("响应内容为:" + res);}// 释放资源if (httpClient != null) {httpClient.close();}if (response != null) {response.close();}JSONObject jo = new JSONObject(res);String openid = jo.getStr("openid");return Result.success(openid);}@GetMapping("/wxGetUserPhone/{code}")public Result wxGetUserPhone(@PathVariable String code) throws IOException {//获取access_tokenSystem.out.println("code" + code);String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";url += "&appid="+appId;//自己的appidurl += "&secret="+appSecret;//自己的appSecretString res = null;CloseableHttpClient httpClient = HttpClientBuilder.create().build();// DefaultHttpClient();HttpGet httpget = new HttpGet(url);    //GET方式CloseableHttpResponse response = null;// 配置信息RequestConfig requestConfig = RequestConfig.custom()          // 设置连接超时时间(单位毫秒).setConnectTimeout(5000)                    // 设置请求超时时间(单位毫秒).setConnectionRequestTimeout(5000)             // socket读写超时时间(单位毫秒).setSocketTimeout(5000)                    // 设置是否允许重定向(默认为true).setRedirectsEnabled(false).build();           // 将上面的配置信息 运用到这个Get请求里httpget.setConfig(requestConfig);                         // 由客户端执行(发送)Get请求response = httpClient.execute(httpget);                   // 从响应模型中获取响应实体HttpEntity responseEntity = response.getEntity();if (responseEntity != null) {res = EntityUtils.toString(responseEntity);}// 释放资源if (httpClient != null) {httpClient.close();}if (response != null) {response.close();}JSONObject jo = new JSONObject(res);String token = jo.getStr("access_token");//解析手机号url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token="+token;httpClient = HttpClientBuilder.create().build();// DefaultHttpClient();HttpPost httppost = new HttpPost(url);    //POST方式JSONObject jsonObject = new JSONObject();jsonObject.putOpt("code",code);String jsonString = jsonObject.toJSONString(0);StringEntity entity = new StringEntity(jsonString, ContentType.APPLICATION_JSON);httppost.setEntity(entity);// 配置信息requestConfig = RequestConfig.custom()          // 设置连接超时时间(单位毫秒).setConnectTimeout(5000)                    // 设置请求超时时间(单位毫秒).setConnectionRequestTimeout(5000)             // socket读写超时时间(单位毫秒).setSocketTimeout(5000)                    // 设置是否允许重定向(默认为true).setRedirectsEnabled(false).build();           // 将上面的配置信息 运用到这个Get请求里httppost.setConfig(requestConfig);                         // 由客户端执行(发送)Get请求response = httpClient.execute(httppost);                   // 从响应模型中获取响应实体responseEntity = response.getEntity();if (responseEntity != null) {res = EntityUtils.toString(responseEntity);}// 释放资源if (httpClient != null) {httpClient.close();}if (response != null) {response.close();}JSONObject result = new JSONObject(res);String strResult = result.getStr("phone_info");return Result.success(new JSONObject(strResult));}
}
package com.example.controller;import com.example.common.Result;
import com.example.entity.AddressInfo;
import com.example.service.AddressInfoService;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;@RestController
@RequestMapping("/addressInfo")
public class AddressInfoController {@Resourceprivate AddressInfoService addressInfoService;@PostMappingpublic Result<AddressInfo> add(@RequestBody AddressInfo info) {addressInfoService.add(info);return Result.success(info);}@DeleteMapping("/{id}")public Result delete(@PathVariable Long id) {addressInfoService.delete(id);return Result.success();}@PutMappingpublic Result update(@RequestBody AddressInfo info) {addressInfoService.update(info);return Result.success();}@GetMappingpublic Result<AddressInfo> all() {return Result.success(addressInfoService.findAll());}
}```java
package com.example.controller;import com.example.common.Result;
import com.example.entity.AdvertiserInfo;
import com.example.service.AdvertiserInfoService;
import com.example.vo.ChaobaInfoVo;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;@RestController
@RequestMapping(value = "/advertiserInfo")
public class AdvertiserInfoController {@Resourceprivate AdvertiserInfoService advertiserInfoService;@PostMappingpublic Result<AdvertiserInfo> add(@RequestBody AdvertiserInfo advertiserInfo) {advertiserInfoService.add(advertiserInfo);return Result.success(advertiserInfo);}@DeleteMapping("/{id}")public Result delete(@PathVariable Long id) {advertiserInfoService.delete(id);return Result.success();}@PutMappingpublic Result update(@RequestBody AdvertiserInfo advertiserInfo) {advertiserInfoService.update(advertiserInfo);return Result.success();}@GetMapping("/{id}")public Result<AdvertiserInfo> detail(@PathVariable Long id) {AdvertiserInfo advertiserInfo = advertiserInfoService.findById(id);return Result.success(advertiserInfo);}@GetMappingpublic Result<List<AdvertiserInfo>> all() {return Result.success(advertiserInfoService.findAll());}@GetMapping("/getNew")public Result<List<AdvertiserInfo>> getNew() {return Result.success(advertiserInfoService.getNew());}@PostMapping("/page")public Result<PageInfo<AdvertiserInfo>> page(  @RequestBody AdvertiserInfo advertiserInfo,@RequestParam(defaultValue = "1") Integer pageNum,@RequestParam(defaultValue = "10") Integer pageSize,HttpServletRequest request) {return Result.success(advertiserInfoService.findPage(advertiserInfo.getName(), pageNum, pageSize, request));}@PostMapping("/front/page")public Result<PageInfo<AdvertiserInfo>> page(@RequestParam(defaultValue = "1") Integer pageNum,@RequestParam(defaultValue = "4") Integer pageSize,HttpServletRequest request) {return Result.success(advertiserInfoService.findFrontPage(pageNum, pageSize, request));}
}

在这里插入图片描述

这篇关于寺庙小程序-H5网页开发的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1020460

相关文章

Android 悬浮窗开发示例((动态权限请求 | 前台服务和通知 | 悬浮窗创建 )

《Android悬浮窗开发示例((动态权限请求|前台服务和通知|悬浮窗创建)》本文介绍了Android悬浮窗的实现效果,包括动态权限请求、前台服务和通知的使用,悬浮窗权限需要动态申请并引导... 目录一、悬浮窗 动态权限请求1、动态请求权限2、悬浮窗权限说明3、检查动态权限4、申请动态权限5、权限设置完毕后

在不同系统间迁移Python程序的方法与教程

《在不同系统间迁移Python程序的方法与教程》本文介绍了几种将Windows上编写的Python程序迁移到Linux服务器上的方法,包括使用虚拟环境和依赖冻结、容器化技术(如Docker)、使用An... 目录使用虚拟环境和依赖冻结1. 创建虚拟环境2. 冻结依赖使用容器化技术(如 docker)1. 创

基于Python开发PPTX压缩工具

《基于Python开发PPTX压缩工具》在日常办公中,PPT文件往往因为图片过大而导致文件体积过大,不便于传输和存储,所以本文将使用Python开发一个PPTX压缩工具,需要的可以了解下... 目录引言全部代码环境准备代码结构代码实现运行结果引言在日常办公中,PPT文件往往因为图片过大而导致文件体积过大,

使用DeepSeek API 结合VSCode提升开发效率

《使用DeepSeekAPI结合VSCode提升开发效率》:本文主要介绍DeepSeekAPI与VisualStudioCode(VSCode)结合使用,以提升软件开发效率,具有一定的参考价值... 目录引言准备工作安装必要的 VSCode 扩展配置 DeepSeek API1. 创建 API 请求文件2.

基于Python开发电脑定时关机工具

《基于Python开发电脑定时关机工具》这篇文章主要为大家详细介绍了如何基于Python开发一个电脑定时关机工具,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1. 简介2. 运行效果3. 相关源码1. 简介这个程序就像一个“忠实的管家”,帮你按时关掉电脑,而且全程不需要你多做

Java中的Opencv简介与开发环境部署方法

《Java中的Opencv简介与开发环境部署方法》OpenCV是一个开源的计算机视觉和图像处理库,提供了丰富的图像处理算法和工具,它支持多种图像处理和计算机视觉算法,可以用于物体识别与跟踪、图像分割与... 目录1.Opencv简介Opencv的应用2.Java使用OpenCV进行图像操作opencv安装j

基于Qt开发一个简单的OFD阅读器

《基于Qt开发一个简单的OFD阅读器》这篇文章主要为大家详细介绍了如何使用Qt框架开发一个功能强大且性能优异的OFD阅读器,文中的示例代码讲解详细,有需要的小伙伴可以参考一下... 目录摘要引言一、OFD文件格式解析二、文档结构解析三、页面渲染四、用户交互五、性能优化六、示例代码七、未来发展方向八、结论摘要

在 VSCode 中配置 C++ 开发环境的详细教程

《在VSCode中配置C++开发环境的详细教程》本文详细介绍了如何在VisualStudioCode(VSCode)中配置C++开发环境,包括安装必要的工具、配置编译器、设置调试环境等步骤,通... 目录如何在 VSCode 中配置 C++ 开发环境:详细教程1. 什么是 VSCode?2. 安装 VSCo

C#图表开发之Chart详解

《C#图表开发之Chart详解》C#中的Chart控件用于开发图表功能,具有Series和ChartArea两个重要属性,Series属性是SeriesCollection类型,包含多个Series对... 目录OverviChina编程ewSeries类总结OverviewC#中,开发图表功能的控件是Char

鸿蒙开发搭建flutter适配的开发环境

《鸿蒙开发搭建flutter适配的开发环境》文章详细介绍了在Windows系统上如何创建和运行鸿蒙Flutter项目,包括使用flutterdoctor检测环境、创建项目、编译HAP包以及在真机上运... 目录环境搭建创建运行项目打包项目总结环境搭建1.安装 DevEco Studio NEXT IDE