# TaoTao_System
**Repository Path**: huangri/TaoTao_System
## Basic Information
- **Project Name**: TaoTao_System
- **Description**: 淘淘商城系统,包括:淘淘后台系统、淘淘门户系统、淘淘Rest服务系统、淘淘单点登录系统、淘淘搜索系统、淘淘订单系统,目前仅完成部分功能,仅课程功能。
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: https://gitee.com/huangri/TaoTao_System
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2019-04-19
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# TaoTao_System
#### 介绍
淘淘商城系统,包括:淘淘后台系统、淘淘门户系统、淘淘Rest服务系统、淘淘单点登录系统、淘淘搜索系统、淘淘订单系统,目前仅完成部分功能,仅课程功能。
#### 课程功能介绍
- 第一天:电商行业的了解。分布式架构的理解。后台工程的搭建,使用maven管理工程,后台工程是一个聚合工程。Svn的使用。Ssm框架整合。
- 第二天:商品列表展示,分页插件的使用,EasyUIDataGrid的使用方法。商品添加功能中的商品类目选择,EasyUI异步tree的使用。
- 第三天:图片上传功能,需要独立的图片服务器。使用FastDFS实例。使用nginx+FastDFS插件实现图片访问。
Nginx:
1、http服务器
2、虚拟机
3、反向代理+负载均衡
需要掌握FastDFS的客户端的使用方法。
图片上传的实现。
- 第四天:富文本编辑器的使用KindEditor的使用方法、商品添加功能的实现。规格参数的实现。使用的模板的思想。
- 第五天:前台系统的搭建。前台系统分为表现层和服务层。服务层可以给pc、移动端提供服务。可以使用jsonp跨域请求服务的数据。
- 第六天:轮播图的展示。使用HttpClient调用后台的服务。Json数据的转换。Cms系统(后台)的搭建。
- 第七天:向业务逻辑中添加缓存。Memcache、ehcache、redis。Redis集群的搭建。搭建集群时需要把服务器的防火墙关闭。Jedis的单机版、集群版的使用方法。添加缓存不能影响正常的业务逻辑。
- 第八天:搜索系统的搭建。使用solr来实现搜索。搭建solr服务器。配置中文分析器,自定义域。数据库中的商品数据导入到索引库。
- 第九天:solr集群的搭建。Zookeeper+solr。Zookeeper功能是集群管理和配置文件的集中管理。使用solrJ连接集群,需要知道zookeeper的地址列表。
- 商品详情页面的展示。动态展示商品详情、纯静态化。使用freemarker实现网页静态化。访问静态网页可以使用nginx访问,可以提高访问效率。
- 第十天:sso系统。分布式环境下session共享的问题。使用redis模拟session。使用token确定用户身份,需要把token放到cookie中。
- 第十一天:购物车、订单系统的实现。购物车使用cookie来实现。订单系统,提交订单时要保证数据的完整性。
- 第十二天:系统的部署。
#### 系统架构
系统架构说明

#### 网络拓扑图

#### 运行需要:
- 1、FastDFS+Nginx:用于存储图片
- 2、Redis集群版或者单机版
- 3、Solr集群版(+Zookeeper)或者单机版
- 4、系统热部署(Nginx+Tomcat)
#### 服务器规划
- 1、图片服务器 1台 (2台)
- 2、Nginx 1台 (2台)
- 3、数据库 1台 (2台)
- 4、Taotao-manager 1台 (1台)
- 5、Taotao-rest 、search、order、sso 1台 (8台)
- 6、Taotao-portal 1台 (2台)
- 7、Redis 1台 (6台)
- 8、Solr 1台 (7台)
#### 域名规划
- Taotao-manager manager.toatao.com
- Taotao-rest rest.taotao.com
- Taotao-portal www.taotao.com
- Taotao-search Search.taotao.com
- Taotao-sso Sso.taotao.com
- Taotao-order order.taotao.com
#### Tomcat热部署
第一步:修改tomcat-users.xml配置文件,配置用户、密码和权限。
```
```
第二步:在pom文件中配置tomcat插件。

第三步:部署
初次部署可以使用 "tomcat7:deploy" 命令
如果已经部署过使用 "tomcat7:redeploy" 命令
#### 反向代理配置
需要修改host文件配置ip地址和域名的映射关系。把域名绑定到公网ip地址,公网ip地址绑定到反向代理服务器。
Host文件:
# 淘淘商城测试环境
```
192.168.25.141 www.taotao.com
192.168.25.141 taotao.com
192.168.25.141 rest.taotao.com
192.168.25.141 search.taotao.com
192.168.25.141 sso.taotao.com
192.168.25.141 order.taotao.com
192.168.25.141 manager.taotao.com
```
Nginx的配置:
```
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream manager.taotao.com {
server 192.168.25.135:8080;
}
upstream rest.taotao.com {
server 192.168.25.136:8080;
}
upstream search.taotao.com {
server 192.168.25.136:8081;
}
upstream sso.taotao.com {
server 192.168.25.136:8082;
}
upstream order.taotao.com {
server 192.168.25.136:8083;
}
upstream www.taotao.com {
server 192.168.25.137:8080;
}
server {
listen 80;
server_name manager.taotao.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://manager.taotao.com;
index index.html index.htm;
}
}
server {
listen 80;
server_name rest.taotao.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://rest.taotao.com;
index index.html index.htm;
}
}
server {
listen 80;
server_name search.taotao.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://search.taotao.com;
index index.html index.htm;
}
}
server {
listen 80;
server_name sso.taotao.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://sso.taotao.com;
index index.html index.htm;
}
}
server {
listen 80;
server_name order.taotao.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://order.taotao.com;
index index.html index.htm;
}
}
server {
listen 80;
server_name www.taotao.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://www.taotao.com;
index index.html index.htm;
}
}
}
```
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)