# scan-server **Repository Path**: bufengyi/scan-server ## Basic Information - **Project Name**: scan-server - **Description**: 配合安卓扫描的服务器,也是腾讯位置上报的服务器 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-11-07 - **Last Updated**: 2022-12-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 扫一扫的服务器端 === ## 技术栈 框架 | 用途 | 官网 --- | --- | --- SpringBoot | 核心框架-程序基石。程序的容器,web的容器 | https://gitee.com/dromara/sureness Myabtis-plus |操作数据库 | https://gitee.com/dromara/sureness sureness | 鉴权 | https://gitee.com/dromara/sureness ### Mybatis-plus ORM 框架的一种 Object Relative Mapping 对象关系映射。 实现程序对数据库的增删改查。 Mybatis-plus把java的逻辑,转成sql语句,执行到mysql(数据库)中。 本来数据库的操作是需要sql语句的。 ### Maven 项目构建工具(了解如何使用即可) 管理依赖(别人写的java程序) 主要靠pom.xml文件来管理项目的依赖 ### RabbitMQ http://cupb.top:15672/ 账号 admin 密码 Jian,Yin.2019 ## Android端地址 ### 扫一扫 https://gitee.com/bufengyi/NewShopManagerAndroid > 可以管理记录有二维码的东西,如商品,书籍等 ### 你的位置 https://gitee.com/bufengyi/location-record > 可以记录位置,关爱家人。了解家人动态。 ## 打包 ``` mvnd clean package -Dmaven.test.skip=true ``` 打包的时候不需要将lombok放到jar中。 https://www.cnblogs.com/tomcatandjerry/p/10342345.html ### 运行 ``` mvn spring-boot:run ``` ### 服务器运行 先生服务器 123.57.180.216 #### 上传lib和jar 上传lib ``` scp -r lib/ root@scan.cupb.top:/home/eric/app/scan-server ``` 上传jar ``` scp target/lib/ root@scan.cupb.top:/home/eric/app/scan-server scp target/scan-server-0.0.1-SNAPSHOT.jar.original root@scan.cupb.top:/home/eric/app/scan-server ``` 结束原有进程 ```shell ps -ef|grep 'java'|grep 'scan'|grep 'scan-server'|grep -v 'grep'|awk '{print $2}'|xargs -tI {} kill -9 {} ``` 启动运行 ``` nohup java -jar scan-server-0.0.1-SNAPSHOT.jar.original -Xmx512M -Xms512M -server -XX:+UseG1GC >>/home/eric/app/scan-server/scan-server.log 2>&1 & ``` ![](./asset/img/sever-deploy.png) ## 证书https(弃用) ``` keytool -genkey -alias tomcathttps -keypass newpass -keyalg RSA -keysize 2048 -validity 365 -keystore tomcathttps.p12 ``` ![](./asset/img/证书生成.png) ## nginx证书配置 ```shell server { listen 443 ssl; listen [::]:443; server_name scan.cupb.top; location / { if ($request_method = 'OPTIONS') { # 对于OPTIONS,不保存请求日志到日志文件 access_log off; # 这里配置允许跨域的域名,* 代表所有,也可以写域名:http://www.xxx.com 或者IP+端口 http://192.168.1.10 add_header 'Access-Control-Allow-Origin' '*'; # 允许的请求类型 add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; add_header 'Access-Control-Allow-Credentials' true; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; # 允许跨域的最大时间,超过这个时间又会重发一次OPTIONS请求获取新的认证 add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; # 直接在这里返回204响应,不转发到后台服务程序 return 204; } proxy_pass http://127.0.0.1:7070; # proxy_pass http://api.inspector.ltd/; proxy_redirect off; # proxy_set_header Host $host; # 这个参数慎用 proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } ssl_certificate "/etc/nginx/scan.cupb.top_chain.crt"; ssl_certificate_key "/etc/nginx/scan.cupb.top_key.key"; } ``` ## 计划 - [ ] 加入用户,按照用于存储信息。但是不想一个个加入,想直接搭建一个用户中心,使用ZUUL - [ ] 加入定时器,每天检测商品是否过期。 ``` INSERT INTO book_model ( name, author, press ) VALUES ( '张三' ,'里斯', '人民邮电出版社' ) ```