寺庙小程序-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

相关文章

Python38个游戏开发库整理汇总

《Python38个游戏开发库整理汇总》文章介绍了多种Python游戏开发库,涵盖2D/3D游戏开发、多人游戏框架及视觉小说引擎,适合不同需求的开发者入门,强调跨平台支持与易用性,并鼓励读者交流反馈以... 目录PyGameCocos2dPySoyPyOgrepygletPanda3DBlenderFife

使用Python开发一个Ditto剪贴板数据导出工具

《使用Python开发一个Ditto剪贴板数据导出工具》在日常工作中,我们经常需要处理大量的剪贴板数据,下面将介绍如何使用Python的wxPython库开发一个图形化工具,实现从Ditto数据库中读... 目录前言运行结果项目需求分析技术选型核心功能实现1. Ditto数据库结构分析2. 数据库自动定位3

Django开发时如何避免频繁发送短信验证码(python图文代码)

《Django开发时如何避免频繁发送短信验证码(python图文代码)》Django开发时,为防止频繁发送验证码,后端需用Redis限制请求频率,结合管道技术提升效率,通过生产者消费者模式解耦业务逻辑... 目录避免频繁发送 验证码1. www.chinasem.cn避免频繁发送 验证码逻辑分析2. 避免频繁

Spring Boot集成/输出/日志级别控制/持久化开发实践

《SpringBoot集成/输出/日志级别控制/持久化开发实践》SpringBoot默认集成Logback,支持灵活日志级别配置(INFO/DEBUG等),输出包含时间戳、级别、类名等信息,并可通过... 目录一、日志概述1.1、Spring Boot日志简介1.2、日志框架与默认配置1.3、日志的核心作用

PyQt5 GUI 开发的基础知识

《PyQt5GUI开发的基础知识》Qt是一个跨平台的C++图形用户界面开发框架,支持GUI和非GUI程序开发,本文介绍了使用PyQt5进行界面开发的基础知识,包括创建简单窗口、常用控件、窗口属性设... 目录简介第一个PyQt程序最常用的三个功能模块控件QPushButton(按钮)控件QLable(纯文本

基于Python开发一个图像水印批量添加工具

《基于Python开发一个图像水印批量添加工具》在当今数字化内容爆炸式增长的时代,图像版权保护已成为创作者和企业的核心需求,本方案将详细介绍一个基于PythonPIL库的工业级图像水印解决方案,有需要... 目录一、系统架构设计1.1 整体处理流程1.2 类结构设计(扩展版本)二、核心算法深入解析2.1 自

golang程序打包成脚本部署到Linux系统方式

《golang程序打包成脚本部署到Linux系统方式》Golang程序通过本地编译(设置GOOS为linux生成无后缀二进制文件),上传至Linux服务器后赋权执行,使用nohup命令实现后台运行,完... 目录本地编译golang程序上传Golang二进制文件到linux服务器总结本地编译Golang程序

使用Docker构建Python Flask程序的详细教程

《使用Docker构建PythonFlask程序的详细教程》在当今的软件开发领域,容器化技术正变得越来越流行,而Docker无疑是其中的佼佼者,本文我们就来聊聊如何使用Docker构建一个简单的Py... 目录引言一、准备工作二、创建 Flask 应用程序三、创建 dockerfile四、构建 Docker

SpringBoot开发中十大常见陷阱深度解析与避坑指南

《SpringBoot开发中十大常见陷阱深度解析与避坑指南》在SpringBoot的开发过程中,即使是经验丰富的开发者也难免会遇到各种棘手的问题,本文将针对SpringBoot开发中十大常见的“坑... 目录引言一、配置总出错?是不是同时用了.properties和.yml?二、换个位置配置就失效?搞清楚加

Python中对FFmpeg封装开发库FFmpy详解

《Python中对FFmpeg封装开发库FFmpy详解》:本文主要介绍Python中对FFmpeg封装开发库FFmpy,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录一、FFmpy简介与安装1.1 FFmpy概述1.2 安装方法二、FFmpy核心类与方法2.1 FF