main
tamguo 7 years ago
parent 6af49f0ec2
commit 148702f736

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tamguo-mobile</name>
<name>tamguo-mms</name>
<comment></comment>
<projects>
</projects>

@ -1,14 +1,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tamguo</groupId>
<artifactId>tamguo-mobile</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tamguo</groupId>
<artifactId>tamguo-mms</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<version>2.0.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
@ -62,6 +61,11 @@
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
@ -77,11 +81,6 @@
<artifactId>shiro-ehcache</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>cn.songxinqiang</groupId>
<artifactId>com.baidu.ueditor</artifactId>
@ -100,17 +99,6 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>2.3.2</version>
<exclusions>
<exclusion>
<artifactId>javax.servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
@ -123,7 +111,6 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
@ -140,6 +127,18 @@
<artifactId>commons-email</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>com.bladejava</groupId>
<artifactId>blade-patchca</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.tamguo</groupId>
<artifactId>tamguo-modules-core</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<dependencyManagement>
@ -155,7 +154,7 @@
</dependencyManagement>
<build>
<finalName>tamguo-mobile</finalName>
<finalName>mms</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>

@ -1,11 +1,10 @@
package com.tamguo;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.converter.HttpMessageConverter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
@ -13,12 +12,12 @@ import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
@SpringBootApplication
@ComponentScan("com.tamguo")
public class TamguoMobileApplication {
public class Application {
public static void main(String[] args) {
new SpringApplicationBuilder(TamguoMobileApplication.class).web(true).run(args);
new SpringApplicationBuilder(Application.class).run(args);
}
/**
* FastJsonJackson
* @return
@ -30,7 +29,8 @@ public class TamguoMobileApplication {
fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
fastConverter.setFastJsonConfig(fastJsonConfig);
HttpMessageConverter<?> converter = fastConverter;
FastJsonHttpMessageConverter converter = fastConverter;
return new HttpMessageConverters(converter);
}
}

@ -1,8 +1,6 @@
package com.tamguo.config.dao;
import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
import com.tamguo.TamguoMobileApplication;
import org.apache.ibatis.reflection.MetaObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -13,15 +11,13 @@ import org.slf4j.LoggerFactory;
//@Component
public class MyMetaObjectHandler extends MetaObjectHandler {
protected final static Logger logger = LoggerFactory.getLogger(TamguoMobileApplication.class);
protected final static Logger logger = LoggerFactory.getLogger(MyMetaObjectHandler.class);
@Override
public void insertFill(MetaObject metaObject) {
logger.info("新增的时候干点不可描述的事情");
}
@Override
public void updateFill(MetaObject metaObject) {
logger.info("更新的时候干点不可描述的事情");
}
}

@ -20,7 +20,7 @@ import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
@Configuration
@MapperScan("com.tamguo.dao*")
@MapperScan("com.tamguo.modules.*.dao*")
public class MybatisPlusConfig {
@Bean
@ -45,12 +45,12 @@ public class MybatisPlusConfig {
tenantSqlParser.setTenantHandler(new TenantHandler() {
@Override
public Expression getTenantId() {
return new LongValue("");
return new LongValue(1L);
}
@Override
public String getTenantIdColumn() {
return "company_id";
return "course_id";
}
@Override

@ -0,0 +1,72 @@
package com.tamguo.config.shiro;
import java.util.Set;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.springframework.beans.factory.annotation.Autowired;
import com.tamguo.modules.member.model.MemberEntity;
import com.tamguo.modules.member.service.IMemberService;
/**
*
*
*/
public class MemberRealm extends AuthorizingRealm {
@Autowired
private IMemberService iMemberService;
/**
* ()
*/
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
Set<String > permsSet = null;
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
info.setStringPermissions(permsSet);
return info;
}
/**
* ()
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(
AuthenticationToken token) throws AuthenticationException {
String username = (String) token.getPrincipal();
String password = new String((char[]) token.getCredentials());
MemberEntity member = iMemberService.findByUsername(username);
if(member == null) {
throw new UnknownAccountException("用户名或密码有误,请重新输入或找回密码");
}
Integer loginFailureCount = iMemberService.getLoginFailureCount(member);
if(loginFailureCount > 10) {
throw new LockedAccountException("账号被锁定");
}
if(!new Sha256Hash(password).toHex().equals(member.getPassword())){
loginFailureCount++;
iMemberService.updateLoginFailureCount(member , loginFailureCount);
throw new IncorrectCredentialsException("用户名或密码有误,请重新输入或找回密码");
}
// 更新登录时间
iMemberService.updateLastLoginTime(member.getId());
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(member, password, getName());
return info;
}
}

@ -0,0 +1,69 @@
package com.tamguo.config.shiro;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.shiro.cache.ehcache.EhCacheManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ShiroConfiguration {
private static Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
@Bean(name = "shiroRealm")
public MemberRealm getShiroRealm() {
return new MemberRealm();
}
@Bean(name = "shiroEhcacheManager")
public EhCacheManager getEhCacheManager() {
EhCacheManager em = new EhCacheManager();
em.setCacheManagerConfigFile("classpath:ehcache-shiro.xml");
return em;
}
@Bean(name = "lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator daap = new DefaultAdvisorAutoProxyCreator();
daap.setProxyTargetClass(true);
return daap;
}
@Bean(name = "securityManager")
public DefaultWebSecurityManager getDefaultWebSecurityManager() {
DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
dwsm.setRealm(getShiroRealm());
dwsm.setCacheManager(getEhCacheManager());
return dwsm;
}
@Bean
public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor() {
AuthorizationAttributeSourceAdvisor aasa = new AuthorizationAttributeSourceAdvisor();
aasa.setSecurityManager(getDefaultWebSecurityManager());
return new AuthorizationAttributeSourceAdvisor();
}
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean getShiroFilterFactoryBean() {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(getDefaultWebSecurityManager());
shiroFilterFactoryBean.setLoginUrl("/login");
shiroFilterFactoryBean.setSuccessUrl("/index");
filterChainDefinitionMap.put("/member/**", "authc");
filterChainDefinitionMap.put("/**", "anon");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
}

@ -0,0 +1,21 @@
package com.tamguo.config.web;
import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
@Component
public class ErrorConfigurar implements ErrorPageRegistrar {
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
ErrorPage[] errorPages=new ErrorPage[2];
errorPages[0]=new ErrorPage(HttpStatus.NOT_FOUND,"/error404");
errorPages[1]=new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/error500");
registry.addErrorPages(errorPages);
}
}

@ -0,0 +1,37 @@
package com.tamguo.config.web;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
@Component
public class ThymeleafConfig implements EnvironmentAware{
@Resource
private Environment env;
@Resource
private void configureThymeleafStaticVars(ThymeleafViewResolver viewResolver) {
if(viewResolver != null) {
Map<String, Object> vars = new HashMap<>();
vars.put("domainName", env.getProperty("domain.name"));
vars.put("adminDomain", env.getProperty("admin.domain.name"));
vars.put("PAPER_TYPE_ZHENTI", "1");
vars.put("PAPER_TYPE_MONI", "2");
vars.put("PAPER_TYPE_YATI", "3");
vars.put("PAPER_TYPE_MINGXIAO", "4");
viewResolver.setStaticVariables(vars);
}
}
@Override
public void setEnvironment(Environment environment) {
env = environment;
}
}

@ -0,0 +1,18 @@
package com.tamguo.config.web;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Value("${file.storage.path}")
private String fileStoragePath;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/files/**").addResourceLocations("file:"+fileStoragePath);
}
}

@ -0,0 +1,151 @@
package com.tamguo.utils;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.plugins.Page;
public class PageUtils {
// 是否下一页按钮
private Boolean isShowNextBtn = false;
// 是否上一页按钮
private Boolean isShowPreBtn = false;
// 当前页
private String currPageNum;
// 页码列表
private List<String> pageNums;
// 总页数
private String totalPage;
// 总数量
private String total;
// 数据
private List<?> list;
public static PageUtils getPage(Page<?> page){
PageUtils pg = new PageUtils();
if(page.getCurrent() > 1){
pg.setIsShowPreBtn(true);
}
if(page.getCurrent() < page.getPages()){
pg.setIsShowNextBtn(true);
}
List<String> pgNums = new ArrayList<>();
if(page.getPages() > 1){
if(page.getPages() > 10){
pgNums.add("1");
pgNums.add("2");
pgNums.add("3");
pgNums.add("...");
if(page.getCurrent() == page.getPages()){
pgNums.add(((Integer)(page.getCurrent() - 2)).toString());
pgNums.add(((Integer)(page.getCurrent() - 1)).toString());
pgNums.add(((Integer)page.getCurrent()).toString());
}else{
pgNums.add(((Integer)(page.getCurrent() - 1)).toString());
pgNums.add(((Integer)page.getCurrent()).toString());
pgNums.add(((Integer)(page.getCurrent() + 1)).toString());
}
}else{
Integer n = 1;
if(page.getTotal() > 0){
while(true){
pgNums.add(n.toString());
if(n >= page.getPages()){
break;
}
n ++;
}
}
}
} else {
Integer n = 1;
if(page.getTotal() > 0){
while(true){
pgNums.add(n.toString());
if(n >= page.getPages()){
break;
}
n ++;
}
}
}
pg.setPageNums(pgNums);
pg.setList(page.getRecords());
pg.setCurrPageNum(((Integer)page.getCurrent()).toString());
pg.setTotal(((Integer)page.getTotal()).toString());
pg.setTotalPage(((Integer)page.getPages()).toString());
return pg;
}
public Boolean getIsShowNextBtn() {
return isShowNextBtn;
}
public void setIsShowNextBtn(Boolean isShowNextBtn) {
this.isShowNextBtn = isShowNextBtn;
}
public List<String> getPageNums() {
return pageNums;
}
public void setPageNums(List<String> pageNums) {
this.pageNums = pageNums;
}
public List<?> getList() {
return list;
}
public void setList(List<?> list) {
this.list = list;
}
public Boolean getIsShowPreBtn() {
return isShowPreBtn;
}
public void setIsShowPreBtn(Boolean isShowPreBtn) {
this.isShowPreBtn = isShowPreBtn;
}
public String getCurrPageNum() {
return currPageNum;
}
public void setCurrPageNum(String currPageNum) {
this.currPageNum = currPageNum;
}
public String getTotalPage() {
return totalPage;
}
public void setTotalPage(String totalPage) {
this.totalPage = totalPage;
}
public String getTotal() {
return total;
}
public void setTotal(String total) {
this.total = total;
}
}

@ -0,0 +1,49 @@
package com.tamguo.utils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import com.tamguo.modules.member.model.MemberEntity;
public class ShiroUtils {
public static Session getSession() {
return SecurityUtils.getSubject().getSession();
}
public static Subject getSubject() {
return SecurityUtils.getSubject();
}
public static MemberEntity getMember() {
return (MemberEntity)SecurityUtils.getSubject().getPrincipal();
}
public static String getMemberId() {
return getMember().getId();
}
public static void setSessionAttribute(Object key, Object value) {
getSession().setAttribute(key, value);
}
public static Object getSessionAttribute(Object key) {
return getSession().getAttribute(key);
}
public static boolean isLogin() {
return SecurityUtils.getSubject().getPrincipal() != null;
}
public static void logout() {
SecurityUtils.getSubject().logout();
}
public static String getKaptcha(String key) {
String kaptcha = getSessionAttribute(key).toString();
// getSession().removeAttribute(key);
return kaptcha;
}
}

@ -0,0 +1,37 @@
package com.tamguo.web;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.modules.tiku.model.ChapterEntity;
import com.tamguo.modules.tiku.model.QuestionEntity;
import com.tamguo.modules.tiku.service.IChapterService;
import com.tamguo.modules.tiku.service.IQuestionService;
@Controller
public class ChapterController {
@Autowired
private IChapterService iChapterService;
@Autowired
private IQuestionService iQuestionService;
@SuppressWarnings("unchecked")
@RequestMapping(path="chapter/{chapterId}-{current}-{size}.html")
public ModelAndView list(@PathVariable String chapterId , @PathVariable Integer current
, @PathVariable Integer size, ModelAndView model) {
ChapterEntity chapter = iChapterService.selectById(chapterId);
Page<QuestionEntity> page = iQuestionService.selectPage(new Page<>(current, size) , Condition.create().eq("chapter_id", chapterId).orderDesc(Arrays.asList("id")));
model.addObject("chapter", chapter);
model.addObject("page", page);
model.addObject("nextPage", current == page.getPages() ? page.getPages() : current+1);
model.addObject("prePage", current == 1 ? 1 : current - 1);
model.setViewName("question");
return model;
}
}

@ -0,0 +1,53 @@
package com.tamguo.web;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.mapper.Condition;
import com.tamguo.modules.tiku.model.BookEntity;
import com.tamguo.modules.tiku.model.ChapterEntity;
import com.tamguo.modules.tiku.model.CourseEntity;
import com.tamguo.modules.tiku.service.IBookService;
import com.tamguo.modules.tiku.service.IChapterService;
import com.tamguo.modules.tiku.service.ICourseService;
@Controller
public class CourseController {
@Autowired
private ICourseService iCourseService;
@Autowired
private IBookService iBookService;
@Autowired
private IChapterService iChapterService;
@SuppressWarnings("unchecked")
@RequestMapping(path= {"course/{courseId}.html"})
public ModelAndView list(@PathVariable String courseId , ModelAndView model) {
CourseEntity course = iCourseService.selectById(courseId);
List<BookEntity> bookList = iBookService.selectList(Condition.create().eq("course_id", courseId));
List<ChapterEntity> chapterList = null;
if(bookList.size() > 0) {
chapterList = iChapterService.selectList(Condition.create().eq("book_id", bookList.get(0).getId()));
}
model.addObject("course", course);
model.addObject("chapterList", chapterList);
model.addObject("subjectId", course.getSubjectId());
model.addObject("courseId", course.getId());
model.setViewName("course");
return model;
}
public ICourseService getiCourseService() {
return iCourseService;
}
public void setiCourseService(ICourseService iCourseService) {
this.iCourseService = iCourseService;
}
}

@ -0,0 +1,25 @@
package com.tamguo.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.mapper.Condition;
import com.tamguo.modules.tiku.service.ISubjectService;
@Controller
public class IndexController {
@Autowired
private ISubjectService iSubjectService;
@SuppressWarnings("unchecked")
@RequestMapping(path= {"index","/"})
public ModelAndView index(ModelAndView model) {
model.setViewName("index");
model.addObject("subjectList", iSubjectService.selectList(Condition.EMPTY));
return model;
}
}

@ -0,0 +1,32 @@
package com.tamguo.web;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.mapper.Condition;
import com.tamguo.modules.tiku.service.ICourseService;
import com.tamguo.modules.tiku.service.ISubjectService;
@Controller
public class SubjectController {
@Autowired
private ICourseService iCourseService;
@Autowired
private ISubjectService iSubjectService;
@SuppressWarnings("unchecked")
@RequestMapping(path= {"subject/{subjectId}.html"})
public ModelAndView list(@PathVariable String subjectId , ModelAndView model) {
model.setViewName("subject");
model.addObject("subject", iSubjectService.selectById(subjectId));
model.addObject("courseList", iCourseService.selectList(Condition.create().eq("subject_id", subjectId).orderAsc(Arrays.asList("sort"))));
return model;
}
}

@ -1,5 +1,4 @@
sitenum=3
domain.name=http://m.tamguo.com/
domain.name=http://localhost:8084/
server.port=8084
jasypt.encryptor.password=tamguo
@ -12,19 +11,20 @@ spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
spring.datasource.maxWait=60000
spring.datasource.minEvictableIdleTimeMillis=300000
spring.datasource.minIdle=5
spring.datasource.password=
spring.datasource.password=Tanguo
spring.datasource.poolPreparedStatements=true
spring.datasource.testOnBorrow=false
spring.datasource.testOnReturn=false
spring.datasource.testWhileIdle=true
spring.datasource.timeBetweenEvictionRunsMillis=60000
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tiku?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.url=jdbc:mysql://47.100.175.14:3306/tamguo?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.username=root
spring.datasource.validationQuery=SELECT 1 FROM DUAL
mybatis-plus.mapper-locations=classpath:/mappers/*Mapper.xml
mybatis-plus.typeAliasesPackage=com.tamguo.model
mybatis-plus.typeAliasesPackage=com.tamguo.modules.*.model
mybatis-plus.typeEnumsPackage=com.tamguo.modules.*.model.enums
mybatis-plus.global-config.id-type=5
mybatis-plus.global-config.field-strategy=2
mybatis-plus.global-config.db-column-underline=true

@ -0,0 +1,19 @@
var vm = new Vue({
el:'#app',
data : {
docked: false,
open: false,
position: 'left',
panel: '',
total:0,
question:{},
topUrl:"",
nextUrl:null,
warnOpen:false,
warnMessage:'',
courseList:[]
},
methods:{
}
});

@ -0,0 +1,19 @@
var vm = new Vue({
el:'#app',
data : {
docked: false,
open: false,
position: 'left',
panel: '',
total:0,
question:{},
topUrl:"",
nextUrl:null,
warnOpen:false,
warnMessage:'',
courseList:[]
},
methods:{
}
});

@ -0,0 +1,19 @@
var vm = new Vue({
el:'#app',
data : {
docked: false,
open: false,
position: 'left',
panel: '',
total:0,
question:{},
topUrl:"",
nextUrl:null,
warnOpen:false,
warnMessage:'',
courseList:[]
},
methods:{
}
});

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="Zh-hans" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
<title>探果题库_聪明的学生都在这里</title>
<meta name="keyword" content="探果题库携手高校名师为考生提供高效的智能备考服务,涵括领域有高考、财会类、建筑工程、职业资格、医卫类、计算机类和学历类等热门考试题库。拥有高校名师丰富的经验,优质的学习资料和备考全阶段的高效服务!"/>
<meta name="description" content="探果题库,高考试题,高考试卷,高校试题,名校,名校试题,名校试卷,高校名师,名师专访,名师教案,名师课堂试题库,试卷库,智能题库,历年真题,模拟试题,押题,预测试题,高考,会计证,会计从业,会计师,经济师,施工员,建造师,建筑师,造价师,职业资格,证券资格,考研,计算机考试,建筑考试,财会类,医卫类,护士资格,公务员,知识点,试题,试卷"/>
<meta name="author" content="Tamguo Team" />
<meta name="copyright" content="Tamguo" />
<!-- 引入 FrozenUI -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
<link rel="stylesheet" href="https://cdn.bootcss.com/material-design-icons/3.0.1/iconfont/material-icons.css">
<style type="text/css">
.mu-appbar-header {
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 101;
overflow: hidden
}
</style>
</head>
<body>
<div id="app">
<mu-appbar style="width: 100%;" color="primary" class="mu-appbar-header">
<mu-button icon slot="left" @click="open = true">
<mu-icon value="menu"></mu-icon>
</mu-button>
探果题库
<mu-button flat slot="right">登录</mu-button>
<mu-button flat slot="right">注册</mu-button>
</mu-appbar>
<mu-container style="margin-top:80px;">
<mu-container>
<mu-paper :z-depth="1" class="demo-list-wrap">
<mu-list toggle-nested>
<mu-list-item button nested :open="open === 'send'" th:if="${chapter.treeLevel == 1}" th:each="chapter,status:${chapterList}">
<mu-list-item-title th:text="${chapter.name}">Sent mail</mu-list-item-title>
<mu-list-item-action>
<mu-icon class="toggle-icon" size="24" value="keyboard_arrow_down"></mu-icon>
</mu-list-item-action>
<mu-list-item button nested :open="open === 'send'" slot="nested" th:if="${ch.parentCode == chapter.id}" th:each="ch,status:${chapterList}">
<mu-list-item-title th:text="${ch.name}">List Item 1</mu-list-item-title>
<mu-list-item-action>
<mu-icon class="toggle-icon" size="24" value="keyboard_arrow_down"></mu-icon>
</mu-list-item-action>
<mu-list-item button th:href="${domainName + 'chapter/' + c.id+'-1-5.html'}" :ripple="false" slot="nested" th:if="${c.parentCode == ch.id}" th:each="c,status:${chapterList}">
<mu-list-item-title th:text="${c.name}">List Item 2.1</mu-list-item-title>
</mu-list-item>
</mu-list-item>
</mu-list-item>
</mu-list>
</mu-paper>
<mu-container>
</div>
</body>
<!-- 引入 Vue -->
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${domainName}]];
var subjectId = [[${subjectId}]];
var courseId = [[${courseId}]];
</script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script th:src="${domainName + 'js/chapter/main.js'}"></script>
</html>

@ -4,7 +4,11 @@
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
<title>探果题库为老师创造价值-探果题库</title>
<title>探果题库_聪明的学生都在这里</title>
<meta name="keyword" content="探果题库携手高校名师为考生提供高效的智能备考服务,涵括领域有高考、财会类、建筑工程、职业资格、医卫类、计算机类和学历类等热门考试题库。拥有高校名师丰富的经验,优质的学习资料和备考全阶段的高效服务!"/>
<meta name="description" content="探果题库,高考试题,高考试卷,高校试题,名校,名校试题,名校试卷,高校名师,名师专访,名师教案,名师课堂试题库,试卷库,智能题库,历年真题,模拟试题,押题,预测试题,高考,会计证,会计从业,会计师,经济师,施工员,建造师,建筑师,造价师,职业资格,证券资格,考研,计算机考试,建筑考试,财会类,医卫类,护士资格,公务员,知识点,试题,试卷"/>
<meta name="author" content="Tamguo Team" />
<meta name="copyright" content="Tamguo" />
<!-- 引入 FrozenUI -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
@ -31,10 +35,10 @@
<mu-button flat slot="right">注册</mu-button>
</mu-appbar>
<mu-paper :z-depth="1" class="demo-list-wrap" style="margin-top:70px;">
<mu-list :item="item" v-for="item in menus">
<mu-sub-header>{{item.name}}</mu-sub-header>
<mu-list-item avatar button :ripple="true" :href="it.url" :item="it" v-for="it in item.childSubjects">
<mu-list-item-title>{{it.name}}</mu-list-item-title>
<mu-list th:each="subject,status:${subjectList}">
<!-- <mu-sub-header>{{item.name}}</mu-sub-header> -->
<mu-list-item avatar button :ripple="true" th:href="${domainName + 'subject/'+subject.id + '.html'}">
<mu-list-item-title th:text="${subject.name}">{{it.name}}</mu-list-item-title>
<mu-list-item-action>
<mu-icon value="keyboard_arrow_right"></mu-icon>
</mu-list-item-action>
@ -47,10 +51,10 @@
</body>
<!-- 引入 Vue -->
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${setting.domain}]];
var mainHttp = [[${domainName}]];
</script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script th:src="${setting.domain + 'js/index/main.js'}"></script>
<script th:src="${domainName + 'js/index/main.js'}"></script>
</html>

@ -42,24 +42,22 @@
<mu-container>
<mu-card style="width: 100%;margin-top: 80px;margin-bottom:80px;" raised="true">
<mu-card-text v-html="question.content">
<p> <span> 如图圆O </span> <span class="ext_valign_sub"> 1 </span> <span> 与圆O </span> <span class="ext_valign_sub"> 2 </span> <span> 内切于点A其半径分别为r </span> <span class="ext_valign_sub"> 1 </span> <span> 与r </span> <span class="ext_valign_sub"> 2 </span> <span> (r </span> <span class="ext_valign_sub"> 1 </span> <span> &gt;r </span> <span class="ext_valign_sub"> 2 </span> <span> ).圆O </span> <span class="ext_valign_sub"> 1 </span> <span> 的弦AB交圆O </span> <span class="ext_valign_sub"> 2 </span> <span> 于点C(O </span> <span class="ext_valign_sub"> 1 </span> <span> 不在AB上)。 </span> </p>
<p> <img src="http://www.tamguo.com//files/20180706/FP161217.jpg" width="189px" height="171px" class="scale-img"> </p>
<p class="ext_text-align_left"> 求证ABAC为定值。 </p>
<mu-card style="width: 100%;margin-top: 80px;margin-bottom:80px;" raised="true" th:each="question,status:${page.records}">
<mu-card-text th:utext="${question.content}">
</mu-card-text>
<mu-card-title sub-title="答案"></mu-card-title>
<mu-card-text v-html="question.answer">
<mu-card-text th:utext="${question.answer}">
<span> B </span>
</mu-card-text>
<mu-card-title sub-title="解析"></mu-card-title>
<mu-card-text v-html="question.analysis">
<mu-card-text th:utext="${question.analysis}">
<p> 苯巴比妥属于巴比妥类镇静催眠药;佐匹克隆属于环吡咯酮类镇静催眠药;阿普唑仑属于苯二氮䓬类镇静催眠药,同类药物还有地西泮等,苯妥英钠属于乙内酰脲类抗癫痫药。 </p>
</mu-card-text>
</mu-card>
<mu-drawer :open.sync="open" :docked="docked" :right="position === 'right'">
<mu-drawer :open.sync="open" :docked="true" :right="position === 'right'">
<mu-list>
<mu-list-item :href="mainHttp" button>
@ -78,22 +76,18 @@
<mu-container>
<mu-bottom-nav class="mu-appbar-footer">
<mu-bottom-nav-item title="上一题" icon="keyboard_arrow_left" :href="topUrl"></mu-bottom-nav-item>
<mu-bottom-nav-item :title="current+'/'+total+'题'"></mu-bottom-nav-item>
<mu-bottom-nav-item title="下一题" icon="keyboard_arrow_right" :href="nextUrl" :disabled="true"></mu-bottom-nav-item>
<mu-bottom-nav-item title="上一页" icon="keyboard_arrow_left" th:href="${domainName + 'chapter/' + chapter.id + '-'+prePage+'-5.html'}"></mu-bottom-nav-item>
<mu-bottom-nav-item th:title="${page.current + '/' + page.pages + '页'}"></mu-bottom-nav-item>
<mu-bottom-nav-item title="下一页" icon="keyboard_arrow_right" th:href="${domainName + 'chapter/' + chapter.id + '-'+nextPage+'-5.html'}" :disabled="true"></mu-bottom-nav-item>
</mu-bottom-nav>
</div>
</body>
<!-- 引入 Vue -->
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${setting.domain}]];
var subjectId = [[${subjectId}]];
var chapterId = [[${chapterId}]];
var current = [[${current}]];
var size = [[${size}]];
var mainHttp = [[${domainName}]];
</script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script th:src="${setting.domain + 'js/question/main.js'}"></script>
<script th:src="${domainName + 'js/question/main.js'}"></script>
</html>

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="Zh-hans" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
<title>探果题库_聪明的学生都在这里</title>
<meta name="keyword" content="探果题库携手高校名师为考生提供高效的智能备考服务,涵括领域有高考、财会类、建筑工程、职业资格、医卫类、计算机类和学历类等热门考试题库。拥有高校名师丰富的经验,优质的学习资料和备考全阶段的高效服务!"/>
<meta name="description" content="探果题库,高考试题,高考试卷,高校试题,名校,名校试题,名校试卷,高校名师,名师专访,名师教案,名师课堂试题库,试卷库,智能题库,历年真题,模拟试题,押题,预测试题,高考,会计证,会计从业,会计师,经济师,施工员,建造师,建筑师,造价师,职业资格,证券资格,考研,计算机考试,建筑考试,财会类,医卫类,护士资格,公务员,知识点,试题,试卷"/>
<meta name="author" content="Tamguo Team" />
<meta name="copyright" content="Tamguo" />
<!-- 引入 FrozenUI -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
<link rel="stylesheet" href="https://cdn.bootcss.com/material-design-icons/3.0.1/iconfont/material-icons.css">
<style type="text/css">
.mu-appbar-header {
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 101;
overflow: hidden
}
</style>
</head>
<body>
<div id="app">
<mu-appbar style="width: 100%;" color="primary" class="mu-appbar-header">
<mu-button icon slot="left">
<mu-icon value="menu"></mu-icon>
</mu-button>
探果题库
<mu-button flat slot="right">登录</mu-button>
<mu-button flat slot="right">注册</mu-button>
</mu-appbar>
<mu-paper :z-depth="1" class="demo-list-wrap" style="margin-top:70px;">
<mu-list>
<mu-sub-header th:text="${subject.name}">高考</mu-sub-header>
<mu-list-item avatar button :ripple="true" th:href="${domainName + 'course/' + course.id + '.html'}" th:each="course,courseStatus:${courseList}">
<mu-list-item-title th:text="${course.name}">{{it.name}}</mu-list-item-title>
<mu-list-item-action>
<mu-icon value="keyboard_arrow_right"></mu-icon>
</mu-list-item-action>
</mu-list-item>
</mu-list-item>
<mu-divider></mu-divider>
</mu-list>
</mu-paper>
</div>
</body>
<!-- 引入 Vue -->
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${domainName}]];
</script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script th:src="${domainName + 'js/index/main.js'}"></script>
</html>

@ -1,51 +0,0 @@
package com.tamguo.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.tamguo.interceptor.SettingInterptor;
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Value("${file.storage.path}")
private String fileStoragePath;
@Autowired
private SettingInterptor settingInterptor;
/**
*
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(settingInterptor).addPathPatterns("/**");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/files/**").addResourceLocations("file:"+fileStoragePath);
super.addResourceHandlers(registry);
}
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer(){
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"));
container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html"));
}
};
}
}

@ -1,29 +0,0 @@
package com.tamguo.config.dao;
import java.io.Serializable;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
/**
*
*/
public class SuperEntity<T extends Model<?>> extends Model<T> {
private static final long serialVersionUID = 1L;
@TableId("uid")
private String uid;
@Override
protected Serializable pkVal() {
return this.getUid();
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
}

@ -1,11 +0,0 @@
package com.tamguo.config.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* mapper mp
*/
public interface SuperMapper<T> extends BaseMapper<T> {
// 这里可以放一些公共的方法
}

@ -1,27 +0,0 @@
package com.tamguo.config.redis;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
//这个类用配置redis服务器的连接
@EnableRedisHttpSession(maxInactiveIntervalInSeconds= 1800)
public class SessionConfig {
@Value("${redis.hostname}")
String HostName;
@Value("${redis.port}")
int Port;
@Value("${redis.password}")
String password;
@Bean
public JedisConnectionFactory connectionFactory() {
JedisConnectionFactory connection = new JedisConnectionFactory();
connection.setPort(Port);
connection.setHostName(HostName);
connection.setPassword(password);
return connection;
}
}

@ -1,10 +0,0 @@
package com.tamguo.config.redis;
import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer;
//初始化Session配置
public class SessionInitializer extends AbstractHttpSessionApplicationInitializer{
public SessionInitializer() {
super(SessionConfig.class);
}
}

@ -1,17 +0,0 @@
package com.tamguo.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.tamguo.config.dao.SuperMapper;
import com.tamguo.model.ChapterEntity;
import com.tamguo.model.CourseEntity;
public interface CourseMapper extends SuperMapper<CourseEntity>{
List<CourseEntity> findBySubjectId(String uid);
List<ChapterEntity> findByCourseId(@Param(value="courseId") String courseId);
}

@ -1,14 +0,0 @@
package com.tamguo.dao;
import java.util.List;
import com.tamguo.config.dao.SuperMapper;
import com.tamguo.model.MenuEntity;
public interface MenuMapper extends SuperMapper<MenuEntity>{
public List<MenuEntity> findMenuByParentId(String parentId);
public List<MenuEntity> findAllFatherMenus();
}

@ -1,14 +0,0 @@
package com.tamguo.dao;
import java.util.List;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.tamguo.config.dao.SuperMapper;
import com.tamguo.model.QuestionEntity;
public interface QuestionMapper extends SuperMapper<QuestionEntity>{
List<QuestionEntity> findPage(String chapterId, Pagination page);
}

@ -1,491 +0,0 @@
package com.tamguo.dao.redis;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tamguo.util.ObjectUtil;
import com.tamguo.util.SerializeTranscoder;
import redis.clients.jedis.ShardedJedis;
/**
*
*
*/
@Service("cacheService")
public class CacheService {
private final static String REDIS_PRE_KEY = "TAMGUO:";
private SerializeTranscoder objectSerialize = new ObjectUtil();
@Autowired
private RedisXMLConfigure redisXMLConfigure;
/**
*
* @Title: get @Description: @param @return String @throws
*/
public String get(String key) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.get(key);
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
*
* @Title: set @Description: @param @return void @throws
*/
public void set(String key, String value) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
conn.set(key, value);
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
*
* set
*
* @param key
* @param value
* @param time
*
* @description
* @exception @since
* 1.0.0
*/
public void set(String key, String value, int time) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
conn.set(key, value);
conn.expire(key, time);
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* redis
*
* @param key key
* @param value
*/
public void setObject(String key, Object value) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
conn.set(key.getBytes(), objectSerialize.serialize(value));
} catch (Exception ex) {
ex.printStackTrace();
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
*
*
* @param key key
* @param value
* @param time
*/
public void setObject(String key, Object value, int time) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
conn.setex(key.getBytes(), time, objectSerialize.serialize(value));
} catch (Exception ex) {
ex.printStackTrace();
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
*
*
* @param key key
* @return
*/
public Object getObject(String key) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
byte[] obj = conn.get(key.getBytes());
if (null == obj)
return null;
return objectSerialize.deserialize(obj);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
redisXMLConfigure.closeConnection(conn);
}
return null;
}
/**
*
*
* @param key key
* @return
*/
public boolean deleteObject(String key) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.del(key.getBytes()) == 1L;
} catch (Exception ex) {
ex.printStackTrace();
} finally {
redisXMLConfigure.closeConnection(conn);
}
return false;
}
/**
*
* @Title: isExist @Description: key @param @return boolean
* @throws
*/
public boolean isExist(String key) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.exists(key);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
redisXMLConfigure.closeConnection(conn);
}
return false;
}
public boolean notExist(String key) {
return !isExist(key);
}
public boolean delete(String key) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.del(key) == 1;
} catch (Exception ex) {
ex.printStackTrace();
} finally {
redisXMLConfigure.closeConnection(conn);
}
return false;
}
/**
* redis list value key ()
*
* @param key
* @param value
* @return
*/
public long putToListEnd(String key, String value) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
long length = conn.rpush(key, value);
return length;
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* valuekey,
*
* @author zhangxin
* @param key
* @param value
* @param seconds
* @param score
* @return long
*/
public long addToSortedSetAndExpire(String key, String value, int seconds, double score) {
return addToSortedSet(key, value, seconds, true, score);
}
/**
* valuekey valuescore
*
* @author zhangxin
* @param key
* @param value
* @param score
* @return long
*/
public double addToSortedSetScore(String key, String value, double score) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
Double zincrby = conn.zincrby(key, score, value);
return zincrby;
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* memberScore
* @param key
* @param value
* @return
*/
public Double getMemberScore(String key, String member) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
Double zscore = conn.zscore(key, member);
return zscore == null ? 0 : zscore;
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* valuekey,
*
* @author zhangxin
* @param key
* @param value
* @param score
* @return long
*/
public long addToSortedSet(String key, String value, double score) {
return addToSortedSet(key, value, -1, false, score);
}
/**
* member
*
* @return isExist true
*/
public boolean isExistSortedSet(String key, String member) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
Long zrank = conn.zrank(key, member);
return zrank != null;
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* member
*
* @return isExist true
*/
public boolean delSortedSetMember(String key, String[] member) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
Long zrem = conn.zrem(key, member);
return zrem >= 1;
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* valuekey, setExpirefalse, seconds
*
* @return
*/
private long addToSortedSet(String key, String value, int seconds, boolean setExpire, double score) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
long addNum = conn.zadd(key, score, value);
if (setExpire) {
conn.expire(key, seconds);
}
return addNum;
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* score
*
* @author zhangxin
* @param key
* @param pageNo
* 1
* @param pageSize
* @return Set<String>
*/
public Set<String> getSortedSetByPage(String key, int pageNo, int pageSize) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
if (pageNo < 1) {
pageNo = 1;
}
if (pageSize < 1) {
pageSize = 1;
}
int start = (pageNo - 1) * pageSize;
conn = redisXMLConfigure.getConnection();
return conn.zrevrange(key, start, start + pageSize - 1);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
redisXMLConfigure.closeConnection(conn);
}
return null;
}
public List<String> getListHead(String key) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
List<String> result = conn.blpop(1000, key);
if (null == result || result.size() == 0)
return null;
return result;
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* map
*
* @param key
* @param field map field
* @param value map value
* @return if filed exist return 0 else return 1
*/
public Long hset(String key, String field, String value) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.hset(key, field, value);
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
public String hset(String key, Map<String, String> values) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.hmset(key, values);
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
public String hset(String key, Map<String, String> values, int time) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
String hmset = conn.hmset(key, values);
conn.expire(key, time);
return hmset;
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* mapfield
*
* @param key
* @param field map field
* @return
*/
public String hget(String key, String field) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.hget(key, field);
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* keystring1
*
* @param key
* @return
*/
public Long decr(String key) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.decr(key);
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
/**
* keystring1
*
* @param key
* @return
*/
public Long incr(String key) {
key = getPreKey(key);
ShardedJedis conn = null;
try {
conn = redisXMLConfigure.getConnection();
return conn.incr(key);
} finally {
redisXMLConfigure.closeConnection(conn);
}
}
private String getPreKey(String key) {
String temp_pre = redisXMLConfigure.getPreKey();
if (null == temp_pre) {
return REDIS_PRE_KEY + key;
}
return temp_pre + key;
}
}

@ -1,47 +0,0 @@
package com.tamguo.dao.redis;
public class PoolConfigBean {
private int max_active;
private int max_idle;
private long max_wait;
public PoolConfigBean() {
}
public PoolConfigBean(int max_active, int max_idle, long max_wait) {
super();
this.max_active = max_active;
this.max_idle = max_idle;
this.max_wait = max_wait;
}
public int getMax_active() {
return max_active;
}
public void setMax_active(int max_active) {
this.max_active = max_active;
}
public int getMax_idle() {
return max_idle;
}
public void setMax_idle(int max_idle) {
this.max_idle = max_idle;
}
public long getMax_wait() {
return max_wait;
}
public void setMax_wait(long max_wait) {
this.max_wait = max_wait;
}
@Override
public String toString() {
return "PoolConfig [max_active=" + max_active + ", max_idle=" + max_idle + ", max_wait=" + max_wait + "]";
}
}

@ -1,53 +0,0 @@
package com.tamguo.dao.redis;
public class RedisServerNodeBean {
private String ip;
private int port;
private boolean needAuth;
private String auth;
public RedisServerNodeBean(String ip, int port, boolean needAuth, String auth) {
this.ip = ip;
this.port = port;
this.needAuth = needAuth;
this.auth = auth;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public boolean isNeedAuth() {
return needAuth;
}
public void setNeedAuth(boolean needAuth) {
this.needAuth = needAuth;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
@Override
public String toString() {
return "RedisServer [ip=" + ip + ", port=" + port + ", needAuth=" + needAuth + ", auth=" + auth + "]";
}
}

@ -1,175 +0,0 @@
package com.tamguo.dao.redis;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import com.tamguo.util.XMLConfiguration;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;
@Component("redisConfigure")
public class RedisXMLConfigure implements InitializingBean {
private static final Logger logger = Logger.getLogger(RedisXMLConfigure.class);
private static String preKey;
private static Document document = null;
private ShardedJedisPool shardedJedisPool;
@Override
public void afterPropertiesSet() throws Exception {
XMLConfiguration xmlConfiguration = new XMLConfiguration();
String REDIS_PATH = "redis.xml";
InputStream stream = null;
try {
stream = this.getClass().getClassLoader().getResourceAsStream(REDIS_PATH);
if (stream == null) {
logger.error("load redis.xml failed!!!" + REDIS_PATH);
throw new RuntimeException("load redis.xml failed");
}
logger.info("Redis XML config path:" + REDIS_PATH);
if (xmlConfiguration.readConfigFile(stream)) {
document = xmlConfiguration.getDocument();
} else {
logger.error("load redis.xml failed!!!");
}
} finally {
if (null != stream)
stream.close();
}
//初始化参数
initPreKey();
PoolConfigBean pcb = initPoolConfigBean();
List<RedisServerNodeBean> rsnbs = initRedisServerNodeBeans();
//实现shardedJedisPool
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
//no maxActive config
jedisPoolConfig.setMaxIdle(pcb.getMax_idle());
jedisPoolConfig.setMaxWaitMillis(pcb.getMax_wait());
shardedJedisPool = new ShardedJedisPool(jedisPoolConfig,getJedisShardInfo(rsnbs));
if(shardedJedisPool == null){
throw new RuntimeException("config redis.xml error");
}
}
/**
* jedis
*/
private PoolConfigBean initPoolConfigBean() {
PoolConfigBean poolConfigBean = new PoolConfigBean();
Element poolElement = (Element) document.getElementsByTagName("pool").item(0);
int max_active = poolElement.hasAttribute("maxActive") ? Integer.parseInt(poolElement.getAttribute("maxActive")) : -1;
int max_idle = poolElement.hasAttribute("maxIdle") ? Integer.parseInt(poolElement.getAttribute("maxIdle")) : -1;
long max_wait = poolElement.hasAttribute("maxWait") ? Long.parseLong(poolElement.getAttribute("maxWait")) : -1;
poolConfigBean.setMax_active(max_active);
poolConfigBean.setMax_idle(max_idle);
poolConfigBean.setMax_wait(max_wait);
return poolConfigBean;
}
/**
* redisserver
*/
private List<RedisServerNodeBean> initRedisServerNodeBeans() {
List<RedisServerNodeBean> redisServers = new ArrayList<RedisServerNodeBean>();
NodeList serverElements = document.getElementsByTagName("server");
int serverLen = serverElements.getLength();
if (serverLen < 1) {
logger.error("redis.servers.server must have one !");
return null;
}
for (int i = 0; i < serverLen; i++) {
Element serverElement = (Element) serverElements.item(i);
String temp_ip = serverElement.hasAttribute("ip") ? serverElement.getAttribute("ip") : null;
if (temp_ip == null) {
logger.error("redis.servers.server.ip must be supplied!");
return null;
}
String temp_port = serverElement.hasAttribute("port") ? serverElement.getAttribute("port") : "6379";
String temp_needAuth = serverElement.hasAttribute("needAuth") ? serverElement.getAttribute("needAuth") : "false";
String temp_auth = null;
// need auth
if ("true".equals(temp_needAuth)) {
temp_auth = serverElement.hasAttribute("auth") ? serverElement.getAttribute("auth") : null;
if (null == temp_auth) {
logger.error("since needAuth is true,auth must be supplied!");
return null;
}
}
RedisServerNodeBean rs = null;
try {
rs = new RedisServerNodeBean(temp_ip, Integer.parseInt(temp_port), Boolean.parseBoolean(temp_needAuth), temp_auth);
} catch (NumberFormatException e) {
logger.error("port must be a number!\n" + e.getMessage());
return null;
}
redisServers.add(rs);
}
return redisServers;
}
/**
* JedisShardInfo
* @param redisServers
* @return
*/
private List<JedisShardInfo> getJedisShardInfo(List<RedisServerNodeBean> redisServers) {
if(redisServers == null){
logger.error("redisServers must not be empty null");
return null;
}
int serverLen = redisServers.size();
if (serverLen < 1) {
logger.error("redisServers must not be empty ");
return null;
}
List<JedisShardInfo> servers = new ArrayList<JedisShardInfo>(serverLen);
for (int i = 0; i < serverLen; i++) {
RedisServerNodeBean redisServer = redisServers.get(i);
JedisShardInfo jedisShardInfo = new JedisShardInfo(redisServer.getIp(), redisServer.getPort());
if (redisServer.isNeedAuth()) {
jedisShardInfo.setPassword(redisServer.getAuth());
}
servers.add(jedisShardInfo);
}
return servers;
}
/*
* rediskey
*/
private void initPreKey() {
Element preKeyElement = (Element) document.getElementsByTagName("preKey").item(0);
preKey = preKeyElement.hasAttribute("value") ? preKeyElement.getAttribute("value") : "";
}
public String getPreKey() {
return preKey;
}
/**
* jedis
* @return
*/
public ShardedJedis getConnection() {
return shardedJedisPool.getResource();
}
/**
* jedis
* @param resource
*/
public void closeConnection(ShardedJedis resource) {
resource.close();
}
}

@ -1,39 +0,0 @@
package com.tamguo.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.util.Setting;
@Component
public class SettingInterptor implements HandlerInterceptor{
@Autowired
Setting setting;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
// 设置系统变量
request.setAttribute("setting", setting);
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {
}
}

@ -1,103 +0,0 @@
package com.tamguo.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.config.dao.SuperEntity;
import java.util.List;
/**
* The persistent class for the tiku_chapter database table.
*
*/
@TableName(value="tiku_chapter")
public class ChapterEntity extends SuperEntity<ChapterEntity> implements Serializable {
private static final long serialVersionUID = 1L;
private String subjectId;
private String courseId;
private String name;
private String parentId;
private Integer questionNum;
private Integer pointNum;
private Integer orders;
@TableField(exist=false)
private List<ChapterEntity> childChapterList;
public ChapterEntity() {
}
public String getCourseId() {
return this.courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public List<ChapterEntity> getChildChapterList() {
return childChapterList;
}
public void setChildChapterList(List<ChapterEntity> childChapterList) {
this.childChapterList = childChapterList;
}
public Integer getQuestionNum() {
return questionNum;
}
public void setQuestionNum(Integer questionNum) {
this.questionNum = questionNum;
}
public Integer getPointNum() {
return pointNum;
}
public void setPointNum(Integer pointNum) {
this.pointNum = pointNum;
}
public Integer getOrders() {
return orders;
}
public void setOrders(Integer orders) {
this.orders = orders;
}
public String getSubjectId() {
return subjectId;
}
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
}
}

@ -1,128 +0,0 @@
package com.tamguo.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.config.dao.SuperEntity;
import java.util.List;
/**
* The persistent class for the tiku_course database table.
*
*/
@TableName(value="tiku_course")
public class CourseEntity extends SuperEntity<CourseEntity> implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
private String subjectId;
private Integer pointNum;
private Integer questionNum;
private Integer orders;
private String seoTitle;
private String seoKeywords;
private String seoDescription;
@TableField(exist=false)
private String subjectName;
@TableField(exist=false)
private List<ChapterEntity> chapterList;
public CourseEntity() {
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getSubjectId() {
return this.subjectId;
}
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
}
public Integer getQuestionNum() {
return questionNum;
}
public void setQuestionNum(Integer questionNum) {
this.questionNum = questionNum;
}
public Integer getPointNum() {
return pointNum;
}
public void setPointNum(Integer pointNum) {
this.pointNum = pointNum;
}
public Integer getOrders() {
return orders;
}
public void setOrders(Integer orders) {
this.orders = orders;
}
public List<ChapterEntity> getChapterList() {
return chapterList;
}
public void setChapterList(List<ChapterEntity> chapterList) {
this.chapterList = chapterList;
}
public String getSeoTitle() {
return seoTitle;
}
public void setSeoTitle(String seoTitle) {
this.seoTitle = seoTitle;
}
public String getSeoKeywords() {
return seoKeywords;
}
public void setSeoKeywords(String seoKeywords) {
this.seoKeywords = seoKeywords;
}
public String getSeoDescription() {
return seoDescription;
}
public void setSeoDescription(String seoDescription) {
this.seoDescription = seoDescription;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getSubjectName() {
return subjectName;
}
public void setSubjectName(String subjectName) {
this.subjectName = subjectName;
}
}

@ -1,104 +0,0 @@
package com.tamguo.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.config.dao.SuperEntity;
import java.util.List;
/**
* The persistent class for the tiku_subject database table.
*
*/
@TableName(value="tiku_menu")
public class MenuEntity extends SuperEntity<MenuEntity> implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
private String pinyin;
private String parentId;
private String isShow;
private Integer orders;
private String url;
private String reserve1;
// 子类型
@TableField(exist=false)
private List<MenuEntity> childSubjects;
public MenuEntity() {
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public List<MenuEntity> getChildSubjects() {
return childSubjects;
}
public void setChildSubjects(List<MenuEntity> childSubjects) {
this.childSubjects = childSubjects;
}
public String getPinyin() {
return pinyin;
}
public void setPinyin(String pinyin) {
this.pinyin = pinyin;
}
public String getIsShow() {
return isShow;
}
public void setIsShow(String isShow) {
this.isShow = isShow;
}
public Integer getOrders() {
return orders;
}
public void setOrders(Integer orders) {
this.orders = orders;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getReserve1() {
return reserve1;
}
public void setReserve1(String reserve1) {
this.reserve1 = reserve1;
}
}

@ -1,172 +0,0 @@
package com.tamguo.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.config.dao.SuperEntity;
/**
* The persistent class for the tiku_question database table.
*
*/
@TableName(value="tiku_question")
public class QuestionEntity extends SuperEntity<QuestionEntity> implements Serializable {
private static final long serialVersionUID = 1L;
private String analysis;
private String paperId;
private String answer;
private String chapterId;
private String questionType;
private String content;
private String subjectId;
private String courseId;
private String reviewPoint;
private String year;
private Integer score;
private String auditStatus;
@TableField(exist=false)
private String courseName;
@TableField(exist=false)
private String chapterName;
@TableField(exist=false)
private String subjectName;
public QuestionEntity() {
}
public String getAnalysis() {
return this.analysis;
}
public void setAnalysis(String analysis) {
this.analysis = analysis;
}
public String getAnswer() {
return this.answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public String getChapterId() {
return this.chapterId;
}
public void setChapterId(String chapterId) {
this.chapterId = chapterId;
}
public String getQuestionType() {
return this.questionType;
}
public void setQuestionType(String questionType) {
this.questionType = questionType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getReviewPoint() {
return reviewPoint;
}
public void setReviewPoint(String reviewPoint) {
this.reviewPoint = reviewPoint;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public Integer getScore() {
return score;
}
public void setScore(Integer score) {
this.score = score;
}
public String getPaperId() {
return paperId;
}
public void setPaperId(String paperId) {
this.paperId = paperId;
}
public String getCourseId() {
return courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public String getChapterName() {
return chapterName;
}
public void setChapterName(String chapterName) {
this.chapterName = chapterName;
}
public String getSubjectId() {
return subjectId;
}
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
}
public String getSubjectName() {
return subjectName;
}
public void setSubjectName(String subjectName) {
this.subjectName = subjectName;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
}

@ -1,55 +0,0 @@
package com.tamguo.model;
import java.io.Serializable;
import java.util.List;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.config.dao.SuperEntity;
@TableName(value="tiku_subject")
public class SubjectEntity extends SuperEntity<SubjectEntity> implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
private String courseId;
private String courseName;
@TableField(exist=false)
private List<CourseEntity> courseList;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCourseId() {
return courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public List<CourseEntity> getCourseList() {
return courseList;
}
public void setCourseList(List<CourseEntity> courseList) {
this.courseList = courseList;
}
}

@ -1,11 +0,0 @@
package com.tamguo.service;
import java.util.List;
import com.tamguo.model.ChapterEntity;
public interface ICourseService {
// 获取科目章节
public List<ChapterEntity> findCourseChapter(String courseId);
}

@ -1,17 +0,0 @@
package com.tamguo.service;
import java.util.List;
import com.tamguo.model.MenuEntity;
/**
* Service -
*
* @author candy.tam
*
*/
public interface IMenuService {
/** 获取所有头部菜单 */
public List<MenuEntity> findAllMenus();
}

@ -1,9 +0,0 @@
package com.tamguo.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.model.QuestionEntity;
public interface IQuestionService {
Page<QuestionEntity> findPage(String chapterId , Page<QuestionEntity> page);
}

@ -1,10 +0,0 @@
package com.tamguo.service;
import java.util.List;
import com.tamguo.model.CourseEntity;
public interface ISubjectService {
public List<CourseEntity> findCourseList(String subjectId);
}

@ -1,67 +0,0 @@
package com.tamguo.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tamguo.dao.CourseMapper;
import com.tamguo.model.ChapterEntity;
import com.tamguo.service.ICourseService;
@Service
public class CourseService implements ICourseService{
@Autowired
private CourseMapper courseMapper;
@Override
public List<ChapterEntity> findCourseChapter(String courseId) {
List<ChapterEntity> chapterList = courseMapper.findByCourseId(courseId);
// 获取根chapter UID
String rootUid = StringUtils.EMPTY;
for(int i=0 ; i<chapterList.size() ; i++){
ChapterEntity chapter = chapterList.get(i);
if(chapter.getParentId().equals("-1")){
rootUid = chapter.getUid();
}
}
// 获取第一层结构
List<ChapterEntity> entitys = new ArrayList<>();
for(int i=0 ; i<chapterList.size() ; i++){
ChapterEntity chapter = chapterList.get(i);
if(rootUid.equals(chapter.getParentId())){
entitys.add(chapter);
}
}
for(int i=0 ; i<entitys.size() ; i++){
ChapterEntity entity = entitys.get(i);
List<ChapterEntity> childs = new ArrayList<>();
for(int k=0 ; k<chapterList.size() ; k++){
ChapterEntity chapter = chapterList.get(k);
if(entity.getUid().equals(chapter.getParentId())){
childs.add(chapter);
}
}
entity.setChildChapterList(childs);
}
for(int i=0 ; i<entitys.size() ; i++){
List<ChapterEntity> childs = entitys.get(i).getChildChapterList();
for(int k=0 ; k<childs.size() ; k++){
ChapterEntity child = childs.get(k);
List<ChapterEntity> tmpChilds = new ArrayList<>();
for(int n=0 ; n<chapterList.size() ; n++){
ChapterEntity chapter = chapterList.get(n);
if(child.getUid().equals(chapter.getParentId())){
tmpChilds.add(chapter);
}
}
child.setChildChapterList(tmpChilds);
}
}
return entitys;
}
}

@ -1,38 +0,0 @@
package com.tamguo.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.dao.MenuMapper;
import com.tamguo.dao.redis.CacheService;
import com.tamguo.model.MenuEntity;
import com.tamguo.service.IMenuService;
@Service
public class MenuService extends ServiceImpl<MenuMapper, MenuEntity> implements IMenuService{
@Autowired
private MenuMapper menuMapper;
@Autowired
private CacheService cacheService;
@SuppressWarnings("unchecked")
@Override
public List<MenuEntity> findAllMenus() {
List<MenuEntity> allMenuList = ((List<MenuEntity>) cacheService.getObject("all_index_menu"));
if(allMenuList == null || allMenuList.isEmpty()){
allMenuList = menuMapper.findAllFatherMenus();
for(MenuEntity menu : allMenuList){
List<MenuEntity> childSubjects = menuMapper.findMenuByParentId(menu.getUid());
menu.setChildSubjects(childSubjects);
}
cacheService.setObject("all_index_menu", allMenuList , 2 * 60 * 60);
}
return allMenuList;
}
}

@ -1,22 +0,0 @@
package com.tamguo.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.dao.QuestionMapper;
import com.tamguo.model.QuestionEntity;
import com.tamguo.service.IQuestionService;
@Service
public class QuestionService implements IQuestionService{
@Autowired
QuestionMapper questionMapper;
@Override
public Page<QuestionEntity> findPage(String chapterId, Page<QuestionEntity> page) {
return page.setRecords(questionMapper.findPage(chapterId , page));
}
}

@ -1,23 +0,0 @@
package com.tamguo.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tamguo.dao.CourseMapper;
import com.tamguo.model.CourseEntity;
import com.tamguo.service.ISubjectService;
@Service
public class SubjectService implements ISubjectService{
@Autowired
CourseMapper courseMapper;
@Override
public List<CourseEntity> findCourseList(String subjectId) {
return courseMapper.findBySubjectId(subjectId);
}
}

@ -1,114 +0,0 @@
package com.tamguo.util;
import java.io.InterruptedIOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public abstract class AbstractRunningLogHandler implements LogHandler {
private static Method getStackTraceMethod;
private static Method getClassNameMethod;
private static Method getMethodNameMethod;
private static Method getFileNameMethod;
private static Method getLineNumberMethod;
static {
try {
Class<?>[] noArgs = null;
getStackTraceMethod = Throwable.class.getMethod("getStackTrace", noArgs);
Class<?> stackTraceElementClass = Class.forName("java.lang.StackTraceElement");
getClassNameMethod = stackTraceElementClass.getMethod("getClassName", noArgs);
getMethodNameMethod = stackTraceElementClass.getMethod("getMethodName", noArgs);
getFileNameMethod = stackTraceElementClass.getMethod("getFileName", noArgs);
getLineNumberMethod = stackTraceElementClass.getMethod("getLineNumber", noArgs);
} catch (ClassNotFoundException ex) {
LogDebug.debug("will use pre-JDK 1.4 methods to determine location.");
} catch (NoSuchMethodException ex) {
LogDebug.debug("will use pre-JDK 1.4 methods to determine location.");
}
}
/**
* classStackTraceElement
*
* @param t
* @param fqnOfCallingClass
*
* @return
*/
protected StackTraceElement getRunningStackTrace(Throwable t, String fqnOfCallingClass) {
if (getLineNumberMethod != null) {
try {
Object[] noArgs = null;
Object[] elements = (Object[]) getStackTraceMethod.invoke(t, noArgs);
for (int i = elements.length - 1; i >= 0; i--) {
String thisClass = (String) getClassNameMethod.invoke(elements[i], noArgs);
if (fqnOfCallingClass.equals(thisClass)) {
// 执行class名称
String className = fqnOfCallingClass;
// 执行方法名称
String methodName = (String) getMethodNameMethod.invoke(elements[i], noArgs);
// 执行class文件名称
String fileName = (String) getFileNameMethod.invoke(elements[i], noArgs);
// 执行到行号
int lineNumber = ((Integer) getLineNumberMethod.invoke(elements[i], noArgs)).intValue();
return new StackTraceElement(className, methodName, fileName, lineNumber);
}
}
} catch (IllegalAccessException ex) {
LogDebug.debug("failed using JDK 1.4 methods", ex);
} catch (InvocationTargetException ex) {
if (ex.getTargetException() instanceof InterruptedException
|| ex.getTargetException() instanceof InterruptedIOException) {
Thread.currentThread().interrupt();
}
LogDebug.debug("failed using JDK 1.4 methods", ex);
} catch (RuntimeException ex) {
LogDebug.debug("failed using JDK 1.4 methods", ex);
}
}
return this.createDefaultStackTrace();
}
/**
* StackTraceElement
*
* @return
*/
private StackTraceElement createDefaultStackTrace() {
return new StackTraceElement(this.getClass().getName(), "log", this.getClass().getName(), 0);
}
@Override
public void info(String msg, String fqnOfCallingClass) {
}
@Override
public void info(String msg, Throwable t, String fqnOfCallingClass) {
}
@Override
public void error(String msg, String fqnOfCallingClass) {
}
@Override
public void error(String msg, Throwable t, String fqnOfCallingClass) {
}
@Override
public void debug(String msg, String fqnOfCallingClass) {
}
@Override
public void debug(String msg, Throwable t, String fqnOfCallingClass) {
}
@Override
public void warning(String msg, String fqnOfCallingClass) {
}
@Override
public void warning(String msg, Throwable t, String fqnOfCallingClass) {
}
}

@ -1,23 +0,0 @@
package com.tamguo.util;
public class CException extends RuntimeException {
private static final long serialVersionUID = 6401592364022805815L;
public CException() {
super();
}
public CException(String message, Throwable cause) {
super(message, cause);
}
public CException(String message) {
super(message);
}
public CException(Throwable cause) {
super(cause);
}
}

@ -1,32 +0,0 @@
package com.tamguo.util;
/**
*
*
*/
public class ExceptionSupport {
private final static Result failResult = Result.failResult("500");
private static LogHandler handler = new Log4jHandler();
private final static String LOG_INFO_PREFIX = "--info>> ";
private final static String LOG_ERROR_PREFIX = "--error>> ";
public static Result resolverResult(String methodInfo, Class<?> clazz, Exception e) {
if(e instanceof CException) {
handler.info(formatInfoLevelMsg(methodInfo, e.getMessage()), clazz.getName());
return Result.failResult(e.getMessage());
}
handler.error(formatErrorLevelMsg(methodInfo), e, clazz.getName());
return failResult;
}
private static String formatInfoLevelMsg(String methodInfo, String infoMsg) {
return LOG_INFO_PREFIX + methodInfo + ": " + infoMsg;
}
private static String formatErrorLevelMsg(String methodInfo) {
return LOG_ERROR_PREFIX + methodInfo;
}
}

@ -1,30 +0,0 @@
package com.tamguo.util;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
public class Log4jHandler extends AbstractRunningLogHandler {
private static final Logger logger = Logger.getLogger(Log4jHandler.class);
@Override
public void info(String msg, String fqnOfCallingClass) {
logger.log(fqnOfCallingClass, Level.INFO, msg, null);
}
@Override
public void info(String msg, Throwable t, String fqnOfCallingClass) {
logger.log(fqnOfCallingClass, Level.INFO, msg, t);
}
@Override
public void error(String msg, String fqnOfCallingClass) {
logger.log(fqnOfCallingClass, Level.ERROR, msg, null);
}
@Override
public void error(String msg, Throwable t, String fqnOfCallingClass) {
logger.log(fqnOfCallingClass, Level.ERROR, msg, t);
}
}

@ -1,17 +0,0 @@
package com.tamguo.util;
public class LogDebug {
private final static String DEBUG_LOG_KEY = "-- LogHandler: ";
public static void debug(String msg) {
System.err.println(DEBUG_LOG_KEY + msg);
}
public static void debug(String msg, Throwable t) {
System.err.println(DEBUG_LOG_KEY + msg);
if (t != null)
t.printStackTrace(System.err);
}
}

@ -1,21 +0,0 @@
package com.tamguo.util;
public interface LogHandler {
public void info(String msg, String fqnOfCallingClass);
public void info(String msg, Throwable t, String fqnOfCallingClass);
public void error(String msg, String fqnOfCallingClass);
public void error(String msg, Throwable t, String fqnOfCallingClass);
public void debug(String msg, String fqnOfCallingClass);
public void debug(String msg, Throwable t, String fqnOfCallingClass);
public void warning(String msg, String fqnOfCallingClass);
public void warning(String msg, Throwable t, String fqnOfCallingClass);
}

@ -1,69 +0,0 @@
package com.tamguo.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class ObjectUtil extends SerializeTranscoder {
@Override
public byte[] serialize(Object value) {
if (value == null) {
throw new NullPointerException("Can't serialize null");
}
byte[] result = null;
ByteArrayOutputStream bos = null;
ObjectOutputStream os = null;
try {
bos = new ByteArrayOutputStream();
os = new ObjectOutputStream(bos);
os.writeObject(value);
os.close();
bos.close();
result = bos.toByteArray();
} catch (IOException e) {
throw new IllegalArgumentException("Non-serializable object", e);
} finally {
close(os);
close(bos);
}
return result;
}
@Override
public Object deserialize(byte[] in) {
Object result = null;
ByteArrayInputStream bis = null;
ObjectInputStream is = null;
try {
if (in != null) {
bis = new ByteArrayInputStream(in);
is = new ObjectInputStream(bis);
result = is.readObject();
is.close();
bis.close();
}
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} finally {
close(is);
close(bis);
}
return result;
}
public static boolean equals(Object o1, Object o2) {
if (o1 == o2) {
return true;
} else if (o1 == null || o2 == null) {
return false;
} else {
return o1.equals(o2);
}
}
}

@ -1,105 +0,0 @@
package com.tamguo.util;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Result implements Serializable {
private static final long serialVersionUID = -1651614836984397356L;
private int code;
private Object result;
private String message;
public static final int SUCCESS_CODE = 0;
public static final int FAIL_CODE = 1;
private Result() {
}
private Result(int code, Object result, String message) {
this.code = code;
this.result = result;
this.message = message;
}
/**
*
*
* @param result
* @return
*/
public static Result successResult(Object result) {
return result(SUCCESS_CODE, result, "");
}
public static Result successResult(Object records, Long recordSum, Long rowsOfPage) {
return successResult(records, recordSum, rowsOfPage, null);
}
public static Result successResult(Object records, Long recordSum, Long rowsOfPage, Object userData) {
Map<String, Object> result = resultOfList(records, recordSum, rowsOfPage, userData);
return successResult(result);
}
public static Map<String, Object> resultOfList(Object records, Long recordSum, Long rowsOfPage) {
return resultOfList(records, recordSum, rowsOfPage, null);
}
public static Map<String, Object> resultOfList(Object Obj, Long records, Long rowsOfPage, Object userData) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("rows", Obj);
result.put("records", records);
result.put("total", rowsOfPage);
if (null != userData) {
result.put("userdata", userData);
}
;
return result;
}
public static Map<String, Object> jqGridResult(List<?> list, long totalCount, int pageSize, int currPage,
int totalPage) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("list", list);
result.put("totalCount", totalCount);
result.put("pageSize", pageSize);
result.put("currPage", currPage);
result.put("totalPage", totalPage);
return result;
}
/**
*
*
* @param errorMsg
* @return
*/
public static Result failResult(String errorMsg) {
return result(FAIL_CODE, "", errorMsg);
}
public static Result result(int code, Object result, String message) {
Result res = new Result(code, result, message);
return res;
}
public int getCode() {
return code;
}
public Object getResult() {
return result;
}
public String getMessage() {
return message;
}
}

@ -1,20 +0,0 @@
package com.tamguo.util;
import java.io.Closeable;
public abstract class SerializeTranscoder {
public abstract byte[] serialize(Object value);
public abstract Object deserialize(byte[] in);
public void close(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

@ -1,30 +0,0 @@
package com.tamguo.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* Setting -
*
* @author candy.tam
*
*/
@Component
public final class Setting {
/** 域名 */
@Value(value="${domain.name}")
public String domain;
/**站点编号 **/
@Value(value="${sitenum}")
private String sitenum;
public String getSitenum() {
return sitenum;
}
public void setSitenum(String sitenum) {
this.sitenum = sitenum;
}
}

@ -1,53 +0,0 @@
package com.tamguo.util;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
public class XMLConfiguration {
private Document document = null;
public boolean readConfigFile(String configFilename) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
document = db.parse(configFilename);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
if (document == null) {
return false;
}
return true;
}
public boolean readConfigFile(InputStream stream) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
document = db.parse(stream);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
if (document == null) {
return false;
}
return true;
}
public Document getDocument() {
return document;
}
protected void setDocument(Document document) {
this.document = document;
}
}

@ -1,58 +0,0 @@
package com.tamguo.web;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.model.ChapterEntity;
import com.tamguo.model.CourseEntity;
import com.tamguo.service.ICourseService;
import com.tamguo.service.ISubjectService;
import com.tamguo.util.ExceptionSupport;
import com.tamguo.util.Result;
@Controller
public class ChapterController {
@Autowired
private ISubjectService iSubjectService;
@Autowired
private ICourseService iCourseService;
@RequestMapping(path= {"chapter/{subjectId}/{courseId}"})
public String chapter(@PathVariable String subjectId , @PathVariable String courseId , ModelAndView model) {
model.addObject("subjectId", subjectId);
model.addObject("courseId", courseId);
return "chapter";
}
@RequestMapping(path="chapter/findCourseList",method=RequestMethod.POST)
@ResponseBody
public Result findAllMenus(String subjectId) {
try {
List<CourseEntity> courseList = iSubjectService.findCourseList(subjectId);
return Result.successResult(courseList);
} catch (Exception e) {
return ExceptionSupport.resolverResult("查询科目", this.getClass(), e);
}
}
@RequestMapping(path="chapter/findChapterList",method=RequestMethod.POST)
@ResponseBody
public Result findChapterList(String courseId) {
try {
List<ChapterEntity> chapterList = iCourseService.findCourseChapter(courseId);
return Result.successResult(chapterList);
} catch (Exception e) {
return ExceptionSupport.resolverResult("查询章节", this.getClass(), e);
}
}
}

@ -1,14 +0,0 @@
package com.tamguo.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class IndexController {
@RequestMapping(path= {"index","/"})
public String index() {
return "index";
}
}

@ -1,36 +0,0 @@
package com.tamguo.web;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tamguo.model.MenuEntity;
import com.tamguo.service.IMenuService;
import com.tamguo.util.ExceptionSupport;
import com.tamguo.util.Result;
@Controller
public class MenuController {
@Resource
private IMenuService iMenuService;
@RequestMapping(path="menu/findAllMenus",method=RequestMethod.POST)
@ResponseBody
public Result findAllMenus() {
// 获取全部菜单
try {
List<MenuEntity> allMenuList = iMenuService.findAllMenus();
return Result.successResult(allMenuList);
} catch (Exception e) {
return ExceptionSupport.resolverResult("查询所有菜单", this.getClass(), e);
}
}
}

@ -1,41 +0,0 @@
package com.tamguo.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.model.QuestionEntity;
import com.tamguo.service.IQuestionService;
import com.tamguo.util.Result;
@Controller
public class QuestionController {
@Autowired
IQuestionService iQuestionService;
@RequestMapping(path= {"question/{subjectId}/{chapterId}-{current}-{size}"})
public String index(@PathVariable String subjectId , @PathVariable String chapterId ,
@PathVariable String current ,@PathVariable String size ,
ModelAndView model) {
model.addObject("chapterId", chapterId);
model.addObject("current" , current);
model.addObject("size", size);
return "question";
}
@RequestMapping(path= {"question/{subjectId}/{chapterId}-{current}-{size}"} , method=RequestMethod.POST)
@ResponseBody
public Result getQuestion(@PathVariable String chapterId ,
@PathVariable Integer current ,@PathVariable Integer size ,
ModelAndView model) {
Page<QuestionEntity> page = new Page<QuestionEntity>(current, size);
return Result.successResult(iQuestionService.findPage(chapterId, page));
}
}

@ -1,53 +0,0 @@
var vm = new Vue({
el:'#app',
data : {
courseList:[],
chapterList:[],
secondLevelChapterList:[],
thirdLevelChapterList:[],
docked: false,
open: true,
position: 'left',
panel: '',
index:1,
secondLevelName:null,
thirdLevelName:null,
mainHttp:mainHttp
},
methods:{
findCourseList(subjectId){
axios({method: 'post',url: mainHttp + 'chapter/findCourseList.html?subjectId='+subjectId}).then(function(response){
if(response.data.code == 0){
vm.courseList = response.data.result;
for(var i=0 ; i<vm.courseList.length ; i++){
vm.courseList[i].url = mainHttp + "chapter/" + vm.courseList[i].subjectId+"/"+vm.courseList[i].uid+".html";
}
}
});
},
findChapterList(courseId){
axios({method: 'post',url: mainHttp + 'chapter/findChapterList.html?courseId='+courseId}).then(function(response){
if(response.data.code == 0){
vm.chapterList = response.data.result;
}
});
},
toSecondLevelChapterList(chapter){
vm.index = 2;
vm.secondLevelChapterList = chapter.childChapterList;
vm.secondLevelName = chapter.name
},
toThirdLevelChapterList(chapter){
vm.index = 3;
vm.thirdLevelChapterList = chapter.childChapterList;
vm.thirdLevelName = chapter.name;
for(var i=0 ; i<vm.thirdLevelChapterList.length ; i++){
vm.thirdLevelChapterList[i].url = mainHttp + 'question/'+subjectId+'/'+vm.thirdLevelChapterList[i].uid+'-1-1.html';
}
}
}
});
vm.findCourseList(subjectId);
vm.findChapterList(courseId);

@ -1,17 +0,0 @@
var vm = new Vue({
el:'#app',
data : {
menus:[]
},
methods:{
findAllMenus(){
axios({method: 'post',url: mainHttp + 'menu/findAllMenus.html'}).then(function(response){
if(response.data.code == 0){
vm.menus = response.data.result;
}
});
}
}
});
vm.findAllMenus();

@ -1,54 +0,0 @@
var vm = new Vue({
el:'#app',
data : {
docked: false,
open: false,
position: 'left',
panel: '',
total:0,
question:{},
topUrl:"",
nextUrl:null,
warnOpen:false,
warnMessage:'',
courseList:[]
},
methods:{
findCourseList(subjectId){
axios({method: 'post',url: mainHttp + 'chapter/findCourseList.html?subjectId='+subjectId}).then(function(response){
if(response.data.code == 0){
vm.courseList = response.data.result;
for(var i=0 ; i<vm.courseList.length ; i++){
vm.courseList[i].url = mainHttp + "chapter/" + vm.courseList[i].subjectId+"/"+vm.courseList[i].uid+".html";
}
}
});
},
getQuestion(chapterId , current , size){
axios({method: 'post',url: mainHttp + 'question/'+subjectId+'/'+chapterId+'-'+current+'-'+size+'.html'}).then(function(response){
if(response.data.code == 0){
if(response.data.result.records.length > 0){
vm.question = response.data.result.records[0];
}
vm.total = response.data.result.total;
// 处理上一页下一页
var previous = parseInt(current)-1;
var next = parseInt(current)+1;
if(previous <= 0){
previous = 1;
}
if(next >= vm.total){
next = vm.total;
}
vm.topUrl = mainHttp + 'question/'+subjectId+'/'+chapterId+'-'+previous+'-'+size+'.html';
vm.nextUrl = mainHttp + 'question/'+subjectId+'/'+chapterId+'-'+next+'-'+size+'.html';
}
});
}
}
});
vm.findCourseList(subjectId);
vm.getQuestion(chapterId , current , size);

@ -1,111 +0,0 @@
<!DOCTYPE html>
<html lang="Zh-hans" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
<title>探果题库为老师创造价值-探果题库</title>
<!-- 引入 FrozenUI -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
<link rel="stylesheet" href="https://cdn.bootcss.com/material-design-icons/3.0.1/iconfont/material-icons.css">
<style type="text/css">
.mu-appbar-header {
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 101;
overflow: hidden
}
</style>
</head>
<body>
<div id="app">
<mu-appbar style="width: 100%;" color="primary" class="mu-appbar-header">
<mu-button icon slot="left" @click="open = true">
<mu-icon value="menu"></mu-icon>
</mu-button>
探果题库
<mu-button flat slot="right">登录</mu-button>
<mu-button flat slot="right">注册</mu-button>
</mu-appbar>
<mu-container style="margin-top:80px;">
<mu-container>
<mu-breadcrumbs divider="—" v-show="index == 1">
<mu-breadcrumbs-item>理科数学</mu-breadcrumbs-item>
</mu-breadcrumbs>
<mu-breadcrumbs divider="—" v-show="index == 2">
<mu-breadcrumbs-item>理科数学</mu-breadcrumbs-item>
<mu-breadcrumbs-item>{{secondLevelName}}</mu-breadcrumbs-item>
</mu-breadcrumbs>
<mu-breadcrumbs divider="—" v-show="index == 3">
<mu-breadcrumbs-item>理科数学</mu-breadcrumbs-item>
<mu-breadcrumbs-item>{{secondLevelName}}</mu-breadcrumbs-item>
<mu-breadcrumbs-item>{{thirdLevelName}}</mu-breadcrumbs-item>
</mu-breadcrumbs>
</mu-container>
<mu-list v-show="index == 1">
<mu-list-item button :ripple="true" v-for="chapter in chapterList" @click="toSecondLevelChapterList(chapter)">
<mu-list-item-title>{{chapter.name}}</mu-list-item-title>
<mu-list-item-action>
<mu-icon value="keyboard_arrow_right"></mu-icon>
</mu-list-item-action>
</mu-list-item>
</mu-list>
<mu-list v-show="index == 2">
<mu-list-item button :ripple="true" v-for="chapter in secondLevelChapterList" @click="toThirdLevelChapterList(chapter)">
<mu-list-item-title>{{chapter.name}}</mu-list-item-title>
<mu-list-item-action>
<mu-icon value="keyboard_arrow_right"></mu-icon>
</mu-list-item-action>
</mu-list-item>
</mu-list>
<mu-list v-show="index == 3">
<mu-list-item button :href="chapter.url" @click="toQuestion(chapter)" :ripple="true" v-for="chapter in thirdLevelChapterList" >
<mu-list-item-title>{{chapter.name}} 题目数:{{chapter.questionNum}}</mu-list-item-title>
<mu-list-item-action>
<mu-icon value="keyboard_arrow_right"></mu-icon>
</mu-list-item-action>
</mu-list-item>
</mu-list>
<mu-drawer :open.sync="open" :docked="docked" :right="position === 'right'">
<mu-list>
<mu-list-item :href="mainHttp" button>
<mu-list-item-title>首页</mu-list-item-title>
</mu-list-item>
<mu-list-item button v-for="course in courseList" :href="course.url" @click="open = false">
<mu-list-item-title>{{course.name}}</mu-list-item-title>
</mu-list-item>
<mu-list-item @click="open = false" button>
<mu-list-item-title>关闭</mu-list-item-title>
</mu-list-item>
</mu-list>
</mu-drawer>
<mu-container>
</div>
</body>
<!-- 引入 Vue -->
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${setting.domain}]];
var subjectId = [[${subjectId}]];
var courseId = [[${courseId}]];
</script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/muse-ui@3.0.0-rc.5/dist/muse-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script th:src="${setting.domain + 'js/chapter/main.js'}"></script>
</html>
Loading…
Cancel
Save