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

相关文章

一文详解Python如何开发游戏

《一文详解Python如何开发游戏》Python是一种非常流行的编程语言,也可以用来开发游戏模组,:本文主要介绍Python如何开发游戏的相关资料,文中通过代码介绍的非常详细,需要的朋友可以参考下... 目录一、python简介二、Python 开发 2D 游戏的优劣势优势缺点三、Python 开发 3D

基于Python开发Windows自动更新控制工具

《基于Python开发Windows自动更新控制工具》在当今数字化时代,操作系统更新已成为计算机维护的重要组成部分,本文介绍一款基于Python和PyQt5的Windows自动更新控制工具,有需要的可... 目录设计原理与技术实现系统架构概述数学建模工具界面完整代码实现技术深度分析多层级控制理论服务层控制注

java程序远程debug原理与配置全过程

《java程序远程debug原理与配置全过程》文章介绍了Java远程调试的JPDA体系,包含JVMTI监控JVM、JDWP传输调试命令、JDI提供调试接口,通过-Xdebug、-Xrunjdwp参数配... 目录背景组成模块间联系IBM对三个模块的详细介绍编程使用总结背景日常工作中,每个程序员都会遇到bu

uni-app小程序项目中实现前端图片压缩实现方式(附详细代码)

《uni-app小程序项目中实现前端图片压缩实现方式(附详细代码)》在uni-app开发中,文件上传和图片处理是很常见的需求,但也经常会遇到各种问题,下面:本文主要介绍uni-app小程序项目中实... 目录方式一:使用<canvas>实现图片压缩(推荐,兼容性好)示例代码(小程序平台):方式二:使用uni

Java中的分布式系统开发基于 Zookeeper 与 Dubbo 的应用案例解析

《Java中的分布式系统开发基于Zookeeper与Dubbo的应用案例解析》本文将通过实际案例,带你走进基于Zookeeper与Dubbo的分布式系统开发,本文通过实例代码给大家介绍的非常详... 目录Java 中的分布式系统开发基于 Zookeeper 与 Dubbo 的应用案例一、分布式系统中的挑战二

基于Go语言开发一个 IP 归属地查询接口工具

《基于Go语言开发一个IP归属地查询接口工具》在日常开发中,IP地址归属地查询是一个常见需求,本文将带大家使用Go语言快速开发一个IP归属地查询接口服务,有需要的小伙伴可以了解下... 目录功能目标技术栈项目结构核心代码(main.go)使用方法扩展功能总结在日常开发中,IP 地址归属地查询是一个常见需求:

基于 Cursor 开发 Spring Boot 项目详细攻略

《基于Cursor开发SpringBoot项目详细攻略》Cursor是集成GPT4、Claude3.5等LLM的VSCode类AI编程工具,支持SpringBoot项目开发全流程,涵盖环境配... 目录cursor是什么?基于 Cursor 开发 Spring Boot 项目完整指南1. 环境准备2. 创建

python获取指定名字的程序的文件路径的两种方法

《python获取指定名字的程序的文件路径的两种方法》本文主要介绍了python获取指定名字的程序的文件路径的两种方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要... 最近在做项目,需要用到给定一个程序名字就可以自动获取到这个程序在Windows系统下的绝对路径,以下

SpringBoot 多环境开发实战(从配置、管理与控制)

《SpringBoot多环境开发实战(从配置、管理与控制)》本文详解SpringBoot多环境配置,涵盖单文件YAML、多文件模式、MavenProfile分组及激活策略,通过优先级控制灵活切换环境... 目录一、多环境开发基础(单文件 YAML 版)(一)配置原理与优势(二)实操示例二、多环境开发多文件版

使用docker搭建嵌入式Linux开发环境

《使用docker搭建嵌入式Linux开发环境》本文主要介绍了使用docker搭建嵌入式Linux开发环境,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录1、前言2、安装docker3、编写容器管理脚本4、创建容器1、前言在日常开发全志、rk等不同