diff --git a/README.md b/README.md index 56645c4ce50720e702498bd86d8b64a97a5524f9..57379ea827953cbf72f7fc7024c91e98fa718a10 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,25 @@ -# 领课在线教育开源系统 +# 领课在线教育系统 ### 项目介绍 -领课在线教育开源系统是基于领课团队多年的在线教育开发和运营经验的产品 +领课在线教育系统是基于领课团队多年的在线教育开发和运营经验的产品,打造一个全行业都适用的在线教育系统。 ### 功能介绍 -* 具有录播功能,直播功能即将上线 -* 讲师入驻功能,讲师自主管理课程 -* 课程管理功能,讲师上传的课程后台有审核功能 -* 单用户登录功能,同一时间只允许同一个账号在同一个地方登录,防止账号共享 -* 支付功能,系统无缝集成了龙果支付面 - -### 技术选 -* 核心技术框架:Spring Cloud +* 权限管理功能,多角色多用户自定义配置 +* 系统配置功能,自定义进行站点配置及第三方参数配置 +* 讲师管理功能,讲师申请入驻,后台具有审核功能 +* 课程管理功能,讲师管理自有课程,后台具有审核功能 +* 用户登录功能,同一时间只允许同一个账号在同一个地方登录,防止账号共享 +* 广告管理功能,后台自定义广告设置,增加营销效果 +* 支付功能,系统无缝集成了龙果支付 + +### 技术选型 +| 核心技术框架 | 注册中心 | 服务网关 | 负载均衡 | +| ----------------- | ----------------- | ----------------- | ------------------ | +| Spring Cloud | Eureka | Zuul | Feign + Ribbon | +| 断路器 | 持久层 | 连接池 | 缓存 | +| Hystrix | Mybatis | Druid | Redis | +| 模板引擎 | 日志框架 | 常用工具 | 版本维护 | +| Freemarker | Logback | Hutool | Spring IO Platform | ### 加速maven构建 在maven的settings.xml 文件里配置mirrors的子节点,添加如下mirror @@ -40,5 +48,5 @@ Lombok是一个可以通过简单的注解形式来帮助我们简化消除一 ![流程图](/doc/images/lombok1.png) ## 项目推荐 -### roncoo-recharge:[码云地址](https://gitee.com/roncoocom/roncoo-recharge) | [Github地址](https://github.com/roncoo/roncoo-recharge) -### roncoo-jui-springboot:[码云地址](https://gitee.com/roncoocom/roncoo-jui-springboot) | [Github地址](https://github.com/roncoo/roncoo-jui-springboot) \ No newline at end of file +##### roncoo-recharge:[码云地址](https://gitee.com/roncoocom/roncoo-recharge) | [Github地址](https://github.com/roncoo/roncoo-recharge) +##### roncoo-jui-springboot:[码云地址](https://gitee.com/roncoocom/roncoo-jui-springboot) | [Github地址](https://github.com/roncoo/roncoo-jui-springboot) \ No newline at end of file diff --git a/roncoo-education-course/roncoo-education-course-common/src/main/java/com/roncoo/education/course/common/bean/bo/ZoneBO.java b/roncoo-education-course/roncoo-education-course-common/src/main/java/com/roncoo/education/course/common/bean/bo/ZoneBO.java index 51356871a4da2bed079e4caaabc2aff7ac0d8dcf..b586621172e1edc3a692e9e9eefc3cc4193ca601 100644 --- a/roncoo-education-course/roncoo-education-course-common/src/main/java/com/roncoo/education/course/common/bean/bo/ZoneBO.java +++ b/roncoo-education-course/roncoo-education-course-common/src/main/java/com/roncoo/education/course/common/bean/bo/ZoneBO.java @@ -26,7 +26,7 @@ public class ZoneBO implements Serializable { /** * 位置(1电脑端,2微信端) */ - @ApiModelProperty(value = "展示平台") + @ApiModelProperty(value = "展示平台", required = true) private Integer zoneLocation; /** diff --git a/roncoo-education-server-eureka/src/main/resources/application.properties b/roncoo-education-server-eureka/src/main/resources/application.properties index 57e1534d5f56788eb1827fd135c167c894513349..401310695610bc534bf6a0a2f2b3f40ed596eead 100644 --- a/roncoo-education-server-eureka/src/main/resources/application.properties +++ b/roncoo-education-server-eureka/src/main/resources/application.properties @@ -2,7 +2,7 @@ spring.profiles.active=dev # eureka -eureka.client.serviceUrl.defaultZone=http://${info.eureka.host01}:${info.eureka.port01}/eureka/,http://${info.eureka.host02}:${info.eureka.port02}/eureka/ +eureka.client.serviceUrl.defaultZone=http://${info.eureka.host}:${info.eureka.port}/eureka/ eureka.environment=${spring.profiles.active} eureka.datacenter=roncoo diff --git a/roncoo-education-util/src/main/java/com/roncoo/education/util/enums/StatusIdEnum.java b/roncoo-education-util/src/main/java/com/roncoo/education/util/enums/StatusIdEnum.java index 432190734f278461d29c425a3457ab3e58e2508e..e8a6ee9e4503990dad6b6b14a40c949578db6ed4 100644 --- a/roncoo-education-util/src/main/java/com/roncoo/education/util/enums/StatusIdEnum.java +++ b/roncoo-education-util/src/main/java/com/roncoo/education/util/enums/StatusIdEnum.java @@ -13,7 +13,7 @@ import lombok.Getter; @AllArgsConstructor public enum StatusIdEnum { - NO(0, "禁用", "red"), YES(1, "正常", ""); + YES(1, "正常", ""), NO(0, "禁用", "red"); private Integer code; diff --git a/roncoo-education-util/src/main/resources/config.properties.demo b/roncoo-education-util/src/main/resources/config.properties.demo new file mode 100644 index 0000000000000000000000000000000000000000..3e5c5385e4b84d0cfce495b16d4bdfebff72d2db --- /dev/null +++ b/roncoo-education-util/src/main/resources/config.properties.demo @@ -0,0 +1,42 @@ +# 使用方法:把config.properties.demo重命名为config.properties即可 +# 本地环境配置文件 + +# 视频存放路径 +period_video_path=/home/roncoo/file/video/ +# 图片存放路径 +pic_path=/home/roncoo/file/pic/ + +# 阿里云配置 +aliyun_accessKeyId= +aliyun_accessKeySecret= + +# 阿里云OSS配置 +aliyun_oss_url= #配置的域名 +aliyun_oss_bucket= #bucket +aliyun_oss_endpoint=http://oss-cn-shanghai.aliyuncs.com/ + +# 阿里云OAS配置 +aliyun_oas_url=http://cn-shenzhen.oas.aliyuncs.com +aliyun_oas_vault= #vault + +# 龙果支付回调配置 +roncoo_pay_notify= #通知回调地址 +pay_url= #请求地址 +pay_key= #key +pay_secret= #secret + +# 保利威视 +polyv_getCataUrl=http://v.polyv.net/uc/services/rest?method=getCata&readtoken={READ_TOKEN} +polyv_uploadVideo=http://v.polyv.net/uc/services/rest?method=uploadfile +polyv_changeCataUrl=http://api.polyv.net/v2/video/{userid}/changeCata?vids={VIDS}&cataid={CATAID}&ptime={PTIME}&sign={SIGN} +polyv_delVideoById=http://v.polyv.net/uc/services/rest?method=delVideoById&writetoken={WRITE_TOKEN}&vid={VID} +polyv_deleteVideo=http://api.polyv.net/v2/video/{userid}/del-video +polyv_getToken=https://hls.videocc.net/service/v1/token +polyv_question=http://v.polyv.net/uc/services/rest +polyv_useId= #userId +polyv_writetoken= #writetoken +polyv_readtoken= #readtoken +polyv_secretkey= #secretkey + +# 讲师默认分成 +lecturer_default_proportion=0.7000 diff --git a/roncoo-education-web-boss/src/main/java/com/roncoo/education/web/boss/common/ConfigurationWebMvc.java b/roncoo-education-web-boss/src/main/java/com/roncoo/education/web/boss/common/ConfigurationWebMvc.java index 542d4b3561a6ae0c69272fafd8d86029f06c5057..25a5e875759aa69db33d0b44f8dd7fdae4832f39 100644 --- a/roncoo-education-web-boss/src/main/java/com/roncoo/education/web/boss/common/ConfigurationWebMvc.java +++ b/roncoo-education-web-boss/src/main/java/com/roncoo/education/web/boss/common/ConfigurationWebMvc.java @@ -3,23 +3,37 @@ */ package com.roncoo.education.web.boss.common; +import java.io.PrintWriter; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.shiro.SecurityUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.util.StringUtils; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import com.roncoo.education.util.base.Base; +import com.roncoo.education.util.base.Bjui; +import com.roncoo.education.util.tools.Constants; +import com.roncoo.education.util.tools.JSONUtil; +import com.roncoo.education.web.boss.common.bean.vo.SysMenuVO; +import com.xiaoleilu.hutool.util.CollectionUtil; /** * 拦截器 */ @Configuration -public class ConfigurationWebMvc implements WebMvcConfigurer{ +public class ConfigurationWebMvc implements WebMvcConfigurer { + + private static final String[] PATH = new String[] { "/admin/**", "/course/**", "/system/**", "/user/**" }; @Bean ShiroInterceptor shiroInterceptor() { @@ -28,7 +42,7 @@ public class ConfigurationWebMvc implements WebMvcConfigurer{ @Override public void addInterceptors(InterceptorRegistry registry) { - // registry.addInterceptor(shiroInterceptor()).addPathPatterns("/admin/**"); + registry.addInterceptor(shiroInterceptor()).addPathPatterns(PATH); } } @@ -39,7 +53,51 @@ class ShiroInterceptor extends Base implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - return true; + String uri = request.getServletPath(); + if (checkUri(uri)) { + return true; + } + + logger.error("没此权限,当前访问路径为:{}", uri); + response.setCharacterEncoding("utf-8"); + PrintWriter out = response.getWriter(); + Bjui bj = new Bjui(); + bj.setStatusCode(300); + bj.setMessage("没此权限,请联系管理员!"); + out.print(JSONUtil.toJSONString(bj)); + out.flush(); + out.close(); + return false; + } + + private static Boolean checkUri(String uri) { + List menuVOList = JSONUtil.parseArray(SecurityUtils.getSubject().getSession().getAttribute(Constants.Session.BOSS_MENU).toString(), SysMenuVO.class); + Set menuSet = new HashSet<>(); + listMenu(menuSet, menuVOList); + if (StringUtils.hasText(uri) && uri.endsWith("/")) { + uri = uri.substring(0, uri.length() - 1); + } + for (String s : menuSet) { + if (s.contains(uri)) { + return true; + } + } + return false; + } + + /** + * @param list + * @return + */ + private static void listMenu(Set menuSet, List menuVOList) { + if (CollectionUtil.isNotEmpty(menuVOList)) { + for (SysMenuVO sm : menuVOList) { + if (StringUtils.hasText(sm.getMenuUrl())) { + menuSet.add(sm.getMenuUrl()); + } + listMenu(menuSet, sm.getList()); + } + } } @Override