Giter Club home page Giter Club logo

shaofeizi / youlai-mall Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youlaitech/youlai-mall

0.0 1.0 0.0 241.05 MB

youlai-mall 是基于Spring Boot 2.5.0、Spring Cloud 2020 & Alibaba 2021、vue、element-ui、uni-app快速构建的一套全栈开源商城平台,包括后端微服务、前端管理、微信小程序和APP应用。开源项目期待你的加入~

Home Page: https://www.youlai.tech

License: Apache License 2.0

Java 97.87% Batchfile 0.76% Shell 1.03% Dockerfile 0.34%

youlai-mall's Introduction

项目信息

项目简介

youlai-mall 是基于Spring Boot 2.5.0、Spring Cloud 2020 & Alibaba 2021、vue、element-ui、uni-app快速构建的一套全栈开源商城项目。

项目采用微服务、前后端分离开发模式;汇集全栈主流的技术栈; 涉及 后端微服务前端管理微信小程序APP应用 等多端的开发。

项目特色

  • Spring Cloud + Vue + Docker全栈开发
  • 项目使用的都是当前主流的技术栈,无过度自定义封装,易学习理解和方便二次扩展
  • 基于Spring Boot 2.5.0、Spring Cloud 2020 & Alibaba 2021一站式微服务解决方案实现快速开发
  • 完整的Spring Security OAuth2 认证中心统一认证授权,网关统一鉴权逻辑
  • 特有一套微服务+前后端分离的RBAC权限设计,实现Spring Cloud Gateway网关下的RESTful接口细粒度的统一鉴权和vue页面按钮级别权限控制
  • 基于vue-element-admin的后台前端解决方案,实现动态路由
  • 移动端采用uni-app、实现跨多端移动应用开发,包括微信小程序、Android和IOS等
  • Docker快速构建项目环境和一键打包部署微服务项目

项目预览

  • 系统管理
image-20210621004954228 image-20210621005011310
image-20210621005123432
  • 微信小程序

项目架构流程图

技术栈

  • 后端技术栈: Spring Boot、Spring Cloud、Spring Cloud Alibaba、Spring Security OAuth2、JWT、Mybatis-Plus、Seata、Sentinel、ELK、Redis

  • 前端技术栈: vue、element-ui、uni-app、vue-element-admin

项目地址

线上预览地址: http://www.youlai.tech

项目名称 源码地址 项目名称 源码地址
微服务后台 youlai-mall 微信小程序 youlai-mall-weapp
管理前端 youlai-mall-admin APP应用 youlai-mall-app

项目结构

youlai-mall
├── docs
    ├── nacos -- Nacos配置文件
    ├── sql   -- mysql数据库脚本
├── mall-oms
    ├── oms-api -- 订单中心Feign接口客户端
    ├── oms-boot -- 订单中心
├── mall-pms
    ├── pms-api -- 商品中心Feign接口客户端
    ├── pms-boot -- 商品中心
├── mall-sms
    ├── sms-api -- 营销中心Feign接口客户端
    ├── sms-boot -- 营销中心
├── mall-ums
    ├── ums-api -- 会员中心Feign接口客户端
    ├── ums-boot -- 会员中心
├── middleware -- 中间件(Nacos、Sentinel)
├── youlai-admin 
    ├── admin-api -- 系统管理服务Feign接口客户端
    ├── admin-boot -- 系统管理服务
├── youlai-auth     -- 认证中心【OAuth2认证服务器】
├── youlai-common   -- 公共模块
└── youlai-gateway  -- Gateway网关【OAuth2资源服务器】

项目启动

后台微服务启动

  1. 安装环境

    安装MySQL8Redis

  2. 创建数据库

    • 新建平台数据库,执行项目docs/sql下的SQL脚本完成数据库创建,基础sql脚本为youlai.sql,商城业务的脚本为mall-*,商城数据库按需创建
    • 创建Nacos数据库,执行脚本middleware/nacos/conf/nacos-mysql.sql完成Nacos数据库的初始化
  3. Nacos配置和启动(非常重要)

    • 修改Nacos数据源,进入配置middleware/nacos/conf/application.properties将数据源修改为自己的环境连接

    • 启动Nacos, IDEA下方工具栏点击Terminal终端命令行,执行cd middleware/nacos/bin命令切换到Nacos的启动脚本文件夹下,然后执行startup -m standalone命令启动Nacos服务;

    • 启动Nacos成功之后,访问Nacos控制台,在浏览器输入 http://localhost:8848/nacos ,输入用户名/密码:nacos/nacos进入管理页面;

    • 导入Nacos配置,在启动Nacos服务进入控制台导入docs/nacos/DEFAULT_GROUP.zip配置,然后分别进入各个项目配置文件中修改MySQL、Redis连接信息即可。

      image-20210623013306256

  4. Nacos启动完成和MySQL、Redis连接信息修改完成后,分别启动youlai-gatewayyoulai-authyoulai-admin模块, 启动类分别对应的是GatewayApplication、AuthApplication以及youlai-admin的子模块admin-boot的AdminApplication类,至此完成整个项目基础服务的启动;

管理前端启动

  1. 本机安装Node环境
  2. npm install
  3. npm run dev
  4. 访问 http://localhost:9527

微信小程序启动

  1. 下载HBuilder X微信开发者工具
  2. 微信公众平台申请小程序,获得小程序的AppID
  3. 微信开发者工具微信扫码登录,开启服务端口,点击工具栏设置->安全设置->安全->服务端口选择打开
  4. Hbuilder X替换项目AppID成自己的,点击manifest.json文件->微信小程序配置
  5. Nacos控制台修改youlai-auth配置中的微信小程序AppID和AppSecret为自己申请的小程序
  6. Hbuilder X工具栏点击 运行->运行到小程序模拟器->微信开发者工具

接口测试

Spring Security OAuth2认证授权接口

  • Postman

    1. 请求参数类型为Query Param或者form-data,出现很多错误的情况是将参数是JSON格式放在请求Body中
    2. Spring Security OAuth2新版本不再支持将客户端信息client_id和client_secret放在请求路径的这种方式,否者会出现401的错误(已验证)
    3. OAuth2客户端信息在Authorization标签选择Basic Auth然后填写client_id和client_secret
    Query Params参数 Authorization
    image-20210621075517108
  • Knife4j接口文档(推荐)

    1. 接口文档地址,启动网关访问 http://localhost:9999/doc.html (默认)
    2. 请求接口之前,先执行对应模块下的第一个接口Authorize完成认证,通过后再打开其他接口请求头会自动填充token
    3. client/123456 是有来项目预留用于测试的客户端信息,因为Knife4j完成自动填充不能包装返回值,和大多数实际项目需包装返回值添加状态码不符
认证授权 认证成功自动填充Header
image-20210622000304570 image-20210622000046029

项目文档

项目文档地址

Star趋势

  • Github Github
  • Gitee Gitee

contributors

contributors

联系信息

因为微信交流群满200人只能通过邀请进入,如果想进入交流群学习可添加以下开发人员,备注“有来“由其拉进群。

image-20210701232803265

youlai-mall's People

Contributors

haoxianrui avatar xbcmz avatar dongtiandexue avatar momeaking avatar panpanda avatar

Watchers

James Cloos 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.