GithubHelp home page GithubHelp logo

qhongtao / miniprogram-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 2020ncov/miniprogram-server-java

0.0 0.0 0.0 144 KB

健康上报小程序后端服务程序(Java版)

License: Apache License 2.0

Java 100.00%

miniprogram-server's Introduction

MiniProgram-server-JAVA

这里是NCOV 2020疫情防控-人员健康管理平台开源项目的小程序后端--Java版本。

主项目入口 >> https://github.com/2020NCOV/ncov-report

数据库表结构与主项目保持一致

数据库文件位置 >> https://github.com/2020NCOV/ncov-report/tree/master/database

commit前如何与上游仓库同步?>> 本地及远程仓库如何与上游仓库保持一致

项目导航

MiniProgram-server-JAVA

项目结构

(1)代码层的结构

  根目录:src/main/java/miniprogram/server

    1.工程启动类(ServerApplication.java)置于miniprogram.server

    2.实体类(Beans)置于miniprogram.server.beans

    3.数据访问层(Mapper)置于miniprogram.server.mapper

    4.数据服务层(Service)置于miniprogram.server.service

    5.前端控制器(Controller)置于miniprogram.server.controller

    6.工具类(utils)置于miniprogram.server.utils

    7.常量接口类(constant)置于miniprogram.server.constant

    8.配置信息类(config)置于miniprogram.server.config

    9.数据传输类(vo)置于miniprogram.server.vo

(2)资源文件的结构

  根目录:src/main/resources

    1.配置文件(.yaml/.json等)置于config文件夹下

    2.国际化(i18n))置于i18n文件夹下

    3.spring.xml置于META-INF/spring文件夹下

    4.页面以及js/css/image等置于static文件夹下的各自文件下

本地配置

1.导入IDEA

IDE根据pom.xml自动导入依赖

2.修改配置文件

src/main/resources/application.properties

# 根据项目情况修改

# 配置api端口号

server.port=8080

# 连接数据库

spring.datasource.url=jdbc:mysql://localhost:3306/数据库名?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
spring.datasource.username=数据库用户名名
spring.datasource.password=数据库密码

3.配置小程序参数

src/main/resources/application.properties

APPID  = 自己的小程序appid(注意没有双引号)
SECRET = 自己的小程序secret(注意没有双引号)

4.运行ServerApplication

浏览器中输入http://localhost:8080/index

可返回 MiniProgram-server-JAVA 即成功运行

5.小程序联调

打开小程序开发工具,导入项目

小程序项目地址:https://github.com/2020NCOV/ncov-report-mini-program-server

修改小程序端的baseURL,在/ncov-report-mini-program/util/config.js文件中

const baseURL = 'http://127.0.0.1:8080/index'; //这表示小程序访问的是本机的8080端口,正是后端程序监听的端口
  • 编译运行小程序
  • 打开调试器,点击network
  • 查看小程序发出的请求getcode,如果返回status code是200ok则表示前后端通信成功,并可查看response内容
  • 可正常进行注册登录,解绑信息等操作。

项目已经可以正常运行,但存在bug,且各接口仍需完善(如安全性问题),欢迎朋友们共同参与开发!

miniprogram-server's People

Contributors

bxzma avatar chenpengjiayou2009 avatar msq0313 avatar steinshead avatar zhangqixun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.