Skip to content

Commit

Permalink
merge origin master
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGaoRobot committed Nov 3, 2021
2 parents 58ce721 + ec02053 commit c85caab
Show file tree
Hide file tree
Showing 38 changed files with 349 additions and 299 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ https://docs.pickmall.cn

### 💧 开源商城项目地址(gitee)

**Java后台(商城所有API)**https://gitee.com/beijing_hongye_huicheng/lilishop.git
**API(商城所有API)**https://gitee.com/beijing_hongye_huicheng/lilishop.git

**UI(商城管理端/商家端/买家PC端)**https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git

**Uni-app(商城移动端,支持小程序/APP/H5)**https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
**uniapp(商城移动端,支持小程序/APP/H5)**https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git

**docker一键部署(商城部署脚本)**https://gitee.com/beijing_hongye_huicheng/docker.git

### 💧 开源商城项目地址(github)

**Java后台(商城所有API)**https://github.com/hongyehuicheng/lilishop.git
**API(商城所有API)**https://github.com/hongyehuicheng/lilishop.git

**UI(商城管理端/商家端/买家PC端)**https://github.com/hongyehuicheng/lilishop-ui.git

**Uni-app(商城移动端,支持小程序/APP/H5)**https://github.com/hongyehuicheng/lilishop-uniapp.git
**uniapp(商城移动端,支持小程序/APP/H5)**https://github.com/hongyehuicheng/lilishop-uniapp.git

**docker一键部署(商城部署脚本)**https://github.com/hongyehuicheng/docker.git

Expand Down
41 changes: 41 additions & 0 deletions admin/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<!--应用名称-->
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
<!--日志文件保存路径-->
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
<contextName>${APP_NAME}</contextName>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_PATH}/${APP_NAME}-%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
</encoder>
</appender>

<!--输出到elk的LOGSTASH-->
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
<destination>127.0.0.1:4560</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
<providers>
<timestamp>
<timeZone>UTC</timeZone>
</timestamp>
</providers>
<!--自定义字段 区分项目-->
<customFields>{"appName":"${APP_NAME}"}</customFields>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
<appender-ref ref="LOGSTASH"/>
</root>
</configuration>
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cn.lili.controller.passport;

import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.dto.MemberEditDTO;
Expand Down Expand Up @@ -47,11 +45,8 @@ public class MemberBuyerController {
public ResultMessage<Object> userLogin(@NotNull(message = "用户名不能为空") @RequestParam String username,
@NotNull(message = "密码不能为空") @RequestParam String password,
@RequestHeader String uuid) {
if (verificationService.check(uuid, VerificationEnums.LOGIN)) {
return ResultUtil.data(this.memberService.usernameLogin(username, password));
} else {
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
}
verificationService.check(uuid, VerificationEnums.LOGIN);
return ResultUtil.data(this.memberService.usernameLogin(username, password));
}

@ApiOperation(value = "短信登录接口")
Expand All @@ -63,11 +58,8 @@ public ResultMessage<Object> userLogin(@NotNull(message = "用户名不能为空
public ResultMessage<Object> smsLogin(@NotNull(message = "手机号为空") @RequestParam String mobile,
@NotNull(message = "验证码为空") @RequestParam String code,
@RequestHeader String uuid) {
if (smsUtil.verifyCode(mobile, VerificationEnums.LOGIN, uuid, code)) {
return ResultUtil.data(memberService.mobilePhoneLogin(mobile));
} else {
throw new ServiceException(ResultCode.VERIFICATION_SMS_ERROR);
}
smsUtil.verifyCode(mobile, VerificationEnums.LOGIN, uuid, code);
return ResultUtil.data(memberService.mobilePhoneLogin(mobile));
}

@ApiOperation(value = "注册用户")
Expand All @@ -84,12 +76,9 @@ public ResultMessage<Object> register(@NotNull(message = "用户名不能为空"
@RequestHeader String uuid,
@NotNull(message = "验证码不能为空") @RequestParam String code) {

boolean result = smsUtil.verifyCode(mobilePhone, VerificationEnums.REGISTER, uuid, code);
if (result) {
return ResultUtil.data(memberService.register(username, password, mobilePhone));
} else {
throw new ServiceException(ResultCode.VERIFICATION_SMS_ERROR);
}
smsUtil.verifyCode(mobilePhone, VerificationEnums.REGISTER, uuid, code);
return ResultUtil.data(memberService.register(username, password, mobilePhone));

}

@ApiOperation(value = "获取当前登录用户接口")
Expand All @@ -109,13 +98,11 @@ public ResultMessage<Member> resetByMobile(@NotNull(message = "手机号为空")
@NotNull(message = "验证码为空") @RequestParam String code,
@RequestHeader String uuid) {
//校验短信验证码是否正确
if (smsUtil.verifyCode(mobile, VerificationEnums.FIND_USER, uuid, code)) {
//校验是否通过手机号可获取会员,存在则将会员信息存入缓存,有效时间3分钟
if (memberService.findByMobile(uuid, mobile)) {
return ResultUtil.success();
}
}
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
smsUtil.verifyCode(mobile, VerificationEnums.FIND_USER, uuid, code);
//校验是否通过手机号可获取会员,存在则将会员信息存入缓存,有效时间3分钟
memberService.findByMobile(uuid, mobile);

return ResultUtil.success();
}

@ApiOperation(value = "修改密码")
Expand Down
2 changes: 1 addition & 1 deletion buyer-api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ spring:
props:
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
sql:
show: false
show: true

# 忽略TOKEN 鉴权 的url
ignored:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package cn.lili.controller.common;

import cn.lili.cache.limit.annotation.LimitPoint;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.verification.enums.VerificationEnums;
import cn.lili.modules.verification.service.VerificationService;
import cn.lili.common.vo.ResultMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -32,14 +30,8 @@ public class SliderImageController {
@GetMapping("/{verificationEnums}")
@ApiOperation(value = "获取校验接口,一分钟同一个ip请求10次")
public ResultMessage getSliderImage(@RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
try {
return ResultUtil.data(verificationService.createVerification(verificationEnums, uuid));
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
log.error("获取校验接口错误", e);
throw new ServiceException(ResultCode.VERIFICATION_EXIST);
}
return ResultUtil.data(verificationService.createVerification(verificationEnums, uuid));

}

@LimitPoint(name = "slider_image", key = "verification_pre_check", limit = 600)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import cn.lili.cache.limit.annotation.LimitPoint;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.modules.system.sms.SmsUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.system.sms.SmsUtil;
import cn.lili.modules.verification.enums.VerificationEnums;
import cn.lili.modules.verification.service.VerificationService;
import cn.lili.common.vo.ResultMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
Expand Down Expand Up @@ -42,11 +41,8 @@ public ResultMessage getSmsCode(
@RequestHeader String uuid,
@PathVariable String mobile,
@PathVariable VerificationEnums verificationEnums) {
if (verificationService.check(uuid, verificationEnums)) {
smsUtil.sendSmsCode(mobile, verificationEnums, uuid);
return ResultUtil.success(ResultCode.VERIFICATION_SEND_SUCCESS);
} else {
throw new ServiceException(ResultCode.VERIFICATION_SMS_EXPIRED_ERROR);
}
verificationService.check(uuid, verificationEnums);
smsUtil.sendSmsCode(mobile, verificationEnums, uuid);
return ResultUtil.success(ResultCode.VERIFICATION_SEND_SUCCESS);
}
}
2 changes: 1 addition & 1 deletion common-api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ spring:
props:
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
sql:
show: false
show: true

# 忽略鉴权url
ignored:
Expand Down
11 changes: 5 additions & 6 deletions config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ mybatis-plus:

# 日志
logging:
config: classpath:logback-spring.xml
# 输出级别
level:
cn.lili: info
Expand Down Expand Up @@ -230,11 +229,11 @@ lili:
system:
isDemoSite: false
isTestModel: true
# 脱敏级别:
# 0:不做脱敏处理
# 1:管理端用户手机号等信息脱敏
# 2:商家端信息脱敏(为2时,表示管理端,商家端同时脱敏)
# sensitiveLevel: 2
# 脱敏级别:
# 0:不做脱敏处理
# 1:管理端用户手机号等信息脱敏
# 2:商家端信息脱敏(为2时,表示管理端,商家端同时脱敏)
# sensitiveLevel: 2

statistics:
# 在线人数统计 X 小时。这里设置48,即统计过去48小时每小时在线人数
Expand Down
2 changes: 1 addition & 1 deletion consumer/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ spring:
props:
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
sql:
show: false
show: true

# 忽略鉴权url
ignored:
Expand Down
2 changes: 1 addition & 1 deletion framework/src/main/java/cn/lili/cache/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public interface Cache<T> {
*
* @param key 缓存key
*/
void remove(Object key);
Boolean remove(Object key);

/**
* 删除
Expand Down
4 changes: 2 additions & 2 deletions framework/src/main/java/cn/lili/cache/impl/RedisCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ public void put(Object key, Object value, Long exp, TimeUnit timeUnit) {
}

@Override
public void remove(Object key) {
public Boolean remove(Object key) {

redisTemplate.delete(key);
return redisTemplate.delete(key);
}

/**
Expand Down
16 changes: 8 additions & 8 deletions framework/src/main/java/cn/lili/common/enums/ResultCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public enum ResultCode {
BRAND_DISABLE_ERROR(14003, "品牌禁用失败"),
BRAND_DELETE_ERROR(14004, "品牌删除失败"),
BRAND_NAME_EXIST_ERROR(20002, "品牌名称重复!"),
BRAND_USE_DISABLE_ERROR(20003, "分类已经绑定此品牌,请先解除关联"),
BRAND_USE_DISABLE_ERROR(20003, "分类已经绑定品牌,请先解除关联"),
BRAND_BIND_GOODS_ERROR(20005, "品牌已经绑定商品,请先解除关联"),
BRAND_NOT_EXIST(20004, "品牌不存在"),

/**
Expand Down Expand Up @@ -154,7 +155,7 @@ public enum ResultCode {
* 购物车
*/
CART_ERROR(30001, "读取结算页的购物车异常"),
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动不存在错误"),
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动已关闭,请稍后重试"),
CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"),
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),

Expand Down Expand Up @@ -240,7 +241,7 @@ public enum ResultCode {
* 活动
*/
PROMOTION_GOODS_NOT_EXIT(40000, "当前促销商品不存在!"),
PROMOTION_SAME_ACTIVE_EXIST(40001, "当前时间内已存在同类活动"),
PROMOTION_SAME_ACTIVE_EXIST(40001, "活动时间内已存在同类活动,请选择关闭、删除当前时段的活动"),
PROMOTION_START_TIME_ERROR(40002, "活动起始时间不能小于当前时间"),
PROMOTION_END_TIME_ERROR(40003, "活动结束时间不能小于当前时间"),
PROMOTION_TIME_ERROR(40004, "活动起始时间必须大于结束时间"),
Expand Down Expand Up @@ -425,8 +426,8 @@ public enum ResultCode {
*/
VERIFICATION_SEND_SUCCESS(80201, "短信验证码,发送成功"),
VERIFICATION_ERROR(80202, "验证失败"),
VERIFICATION_SMS_ERROR(80203, "短信验证码错误,请重新校验"),
VERIFICATION_SMS_EXPIRED_ERROR(80204, "验证码已失效,请重新校验"),
VERIFICATION_CODE_INVALID(80204, "验证码已失效,请重新校验"),
VERIFICATION_SMS_CHECKED_ERROR(80210, "短信验证码错误,请重新校验"),

/**
* 微信相关异常
Expand All @@ -449,9 +450,8 @@ public enum ResultCode {
CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"),
CONNECT_NOT_EXIST(90000, "登录方式不存在!"),
ELASTICSEARCH_INDEX_INIT_ERROR(90003, "索引初始化失败!"),
PURCHASE_ORDER_DEADLINE_ERROR(90004,"供求单,已超过报名截止时间")

;
PURCHASE_ORDER_DEADLINE_ERROR(90004, "供求单,已超过报名截止时间"),
INDEX_BUILDING(90005, "索引正在生成");

private final Integer code;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@

import cn.lili.common.enums.ResultCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* 全局业务异常类
*
* @author Chopper
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ServiceException extends RuntimeException {

public static String DEFAULT_MESSAGE = "网络错误,请稍后重试!";
private static final long serialVersionUID = 3447728300174142127L;

public static final String DEFAULT_MESSAGE = "网络错误,请稍后重试!";

/**
* 异常消息
Expand Down
19 changes: 10 additions & 9 deletions framework/src/main/java/cn/lili/common/utils/ThreadPoolUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public class ThreadPoolUtil {
*/
private static final BlockingQueue<Runnable> BQUEUE = new ArrayBlockingQueue<Runnable>(100);
private static final ThreadPoolExecutor POOL = new ThreadPoolExecutor(SIZE_CORE_POOL, SIZE_MAX_POOL, ALIVE_TIME, TimeUnit.MILLISECONDS, BQUEUE, new ThreadPoolExecutor.CallerRunsPolicy());
public static ThreadPoolExecutor threadPool;
/**
* volatile禁止指令重排
*/
public static volatile ThreadPoolExecutor threadPool;

static {
POOL.prestartAllCoreThreads();
Expand All @@ -49,22 +52,20 @@ public static <T> Future<T> submit(Callable<T> callable) {
}

/**
* dcs获取线程池
* DCL获取线程池
*
* @return 线程池对象
*/
public static ThreadPoolExecutor getThreadPool() {
if (threadPool != null) {
return threadPool;
} else {
synchronized (ThreadPoolUtil.class) {
if (threadPool == null) {
threadPool = (ThreadPoolExecutor) Executors.newCachedThreadPool();
return threadPool;
}
return threadPool;
}
synchronized (ThreadPoolUtil.class) {
if (threadPool == null) {
threadPool = (ThreadPoolExecutor) Executors.newCachedThreadPool();
}
}
return threadPool;
}

public static ThreadPoolExecutor getPool() {
Expand Down
Loading

0 comments on commit c85caab

Please sign in to comment.