mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-01 07:16:39 +00:00
Compare commits
11 Commits
release_v1
...
v2.0.0
Author | SHA1 | Date | |
---|---|---|---|
b8b074d40a | |||
a662f42bcf | |||
0fa929f9de | |||
401d23871d | |||
4878f17de8 | |||
e9ab6d8bb0 | |||
c8d7a10d9f | |||
d30c6bfd6e | |||
334f3e17a6 | |||
a202100818 | |||
84814e0792 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,3 +11,5 @@
|
||||
/novel-crawl/novel-crawl.iml
|
||||
/novel-crawl/target
|
||||
/novel-admin/target
|
||||
/*.iml
|
||||
/novel-admin/*.iml
|
||||
|
20
README.md
20
README.md
@ -2,9 +2,13 @@
|
||||
|
||||
# 小说精品屋-plus
|
||||
|
||||
#### 演示地址
|
||||
|
||||
[点击前往](http://www.java2nb.com)(前台门户)
|
||||
|
||||
#### 前言
|
||||
|
||||
小说精品屋-plus致力于打造一个完整的商用小说门户平台。
|
||||
小说精品屋-plus致力于打造一个完整的商用小说门户平台,使用前建议先阅读此文档。
|
||||
|
||||
#### 项目介绍
|
||||
|
||||
@ -20,9 +24,9 @@
|
||||
- [x] 排行榜。
|
||||
- [x] 小说评论模块。
|
||||
- [x] 阅读主题模块。
|
||||
- [ ] 作家专区。
|
||||
- [ ] 充值。
|
||||
- [ ] 后台管理系统。
|
||||
- [x] 作家专区。
|
||||
- [x] 充值。
|
||||
- [x] 后台管理系统。
|
||||
- [x] 爬虫管理系统。
|
||||
|
||||
#### 项目结构
|
||||
@ -107,9 +111,13 @@ Springboot+Mybatis+Mysql+Ehcache+Thymeleaf+Layui
|
||||
|
||||
**喜欢此项目的可以给我的GitHub和Gitee加个Star支持一下 。**
|
||||
|
||||
#### 演示地址
|
||||
#### 其他安装教程
|
||||
|
||||
[点击前往](http://www.java2nb.com)(前台门户)
|
||||
包安装教程:[点击前往](https://my.oschina.net/java2nb/blog/4272630)
|
||||
|
||||
宝塔安装教程(非官方):[点击前往](https://www.daniao.org/9166.html)
|
||||
|
||||
docker安装教程:[点击前往](https://my.oschina.net/java2nb/blog/4271989)
|
||||
|
||||
#### 代码仓库
|
||||
|
||||
|
5
novel-admin/logs/debug.log
Normal file
5
novel-admin/logs/debug.log
Normal file
@ -0,0 +1,5 @@
|
||||
2020-05-13 21:52:00,972 INFO (StartupInfoLogger.java:50)- Starting TestDemo on USER-20180729KA with PID 3532 (started by Administrator in E:\baseprojectparent\novel-plus\novel-admin)
|
||||
2020-05-13 21:52:01,113 DEBUG (StartupInfoLogger.java:53)- Running with Spring Boot v2.0.1.RELEASE, Spring v5.0.5.RELEASE
|
||||
2020-05-13 21:52:01,131 INFO (SpringApplication.java:663)- The following profiles are active: dev
|
||||
2020-05-13 21:52:54,469 DEBUG (ApplicationContextRegister.java:29)- ApplicationContext registed-->org.springframework.web.context.support.GenericWebApplicationContext@5b529706: startup date [Wed May 13 21:52:01 CST 2020]; root of context hierarchy
|
||||
2020-05-13 21:53:49,622 INFO (StartupInfoLogger.java:59)- Started TestDemo in 114.268 seconds (JVM running for 124.957)
|
@ -1,165 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.9.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.15.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.7.11" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.7.11" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.29" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.29" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.29" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.9.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring5:3.0.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sourceforge.nekohtml:nekohtml:1.9.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
||||
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.11" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.google.protobuf:protobuf-java:2.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.7.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.0.28" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: com.alibaba:jconsole:1.8.0">
|
||||
<CLASSES>
|
||||
<root url="jar://C:/Program Files/Java/jdk1.8.0_181/lib/jconsole.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: com.alibaba:tools:1.8.0">
|
||||
<CLASSES>
|
||||
<root url="jar://C:/Program Files/Java/jdk1.8.0_181/lib/tools.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-web:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-ehcache:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.theborakompanioni:thymeleaf-extras-shiro:2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.31" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.0.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.0.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.0.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.0.3.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.23.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.23.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.23.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.23.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.23.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.23.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.20" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache:2.10.4" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -50,10 +50,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<!-- NekoHTML 是一个简单地HTML扫描器和标签补偿器(tag balancer) ,使得程序能解析HTML文档并用标准的XML接口来访问其中的信息。
|
||||
这个解析器能投扫描HTML文件并“修正”许多作者(人或机器)在编写HTML文档过程中常犯的错误。
|
||||
NekoHTML 能增补缺失的父元素、自动用结束标签关闭相应的元素,以及不匹配的内嵌元素标签。
|
||||
NekoHTML 的开发使用了Xerces Native Interface (XNI),后者是Xerces2的实现基础。-->
|
||||
<!-- NekoHTML 是一个简单地HTML扫描器和标签补偿器(tag balancer) ,使得程序能解析HTML文档并用标准的XML接口来访问其中的信息。
|
||||
这个解析器能投扫描HTML文件并“修正”许多作者(人或机器)在编写HTML文档过程中常犯的错误。
|
||||
NekoHTML 能增补缺失的父元素、自动用结束标签关闭相应的元素,以及不匹配的内嵌元素标签。
|
||||
NekoHTML 的开发使用了Xerces Native Interface (XNI),后者是Xerces2的实现基础。-->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.nekohtml</groupId>
|
||||
<artifactId>nekohtml</artifactId>
|
||||
@ -147,13 +147,13 @@
|
||||
<!--</dependency>-->
|
||||
<!-- quartz -->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.springframework.boot</groupId>-->
|
||||
<!--<artifactId>spring-boot-starter-cache</artifactId>-->
|
||||
<!--<groupId>org.springframework.boot</groupId>-->
|
||||
<!--<artifactId>spring-boot-starter-cache</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>net.sf.ehcache</groupId>-->
|
||||
<!--<artifactId>ehcache</artifactId>-->
|
||||
<!--<groupId>net.sf.ehcache</groupId>-->
|
||||
<!--<artifactId>ehcache</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
|
||||
@ -188,7 +188,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
@ -239,18 +238,22 @@
|
||||
</configuration>
|
||||
</plugin>-->
|
||||
<!--SpringBoot项目默认使用spring-boot-maven-plugin,要打成被其他项目引用的jar包,需要更换此插件-->
|
||||
<!-- <plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<!--<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus_release</id>
|
||||
<name>release</name>
|
||||
@ -261,5 +264,5 @@
|
||||
<name>snapshots</name>
|
||||
<url>http://47.106.243.172:8081/nexus/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</distributionManagement>-->
|
||||
</project>
|
||||
|
@ -0,0 +1,135 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
|
||||
import com.java2nb.novel.domain.AuthorCodeDO;
|
||||
import com.java2nb.novel.service.AuthorCodeService;
|
||||
import com.java2nb.common.utils.PageBean;
|
||||
import com.java2nb.common.utils.Query;
|
||||
import com.java2nb.common.utils.R;
|
||||
|
||||
/**
|
||||
* 作家邀请码表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-05-13 11:29:15
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/novel/authorCode")
|
||||
public class AuthorCodeController {
|
||||
@Autowired
|
||||
private AuthorCodeService authorCodeService;
|
||||
|
||||
@GetMapping()
|
||||
@RequiresPermissions("novel:authorCode:authorCode")
|
||||
String AuthorCode() {
|
||||
return "novel/authorCode/authorCode";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取作家邀请码表列表", notes = "获取作家邀请码表列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("novel:authorCode:authorCode")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
List<AuthorCodeDO> authorCodeList = authorCodeService.list(query);
|
||||
int total = authorCodeService.count(query);
|
||||
PageBean pageBean = new PageBean(authorCodeList, total);
|
||||
return R.ok().put("data", pageBean);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增作家邀请码表页面", notes = "新增作家邀请码表页面")
|
||||
@GetMapping("/add")
|
||||
@RequiresPermissions("novel:authorCode:add")
|
||||
String add() {
|
||||
return "novel/authorCode/add";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改作家邀请码表页面", notes = "修改作家邀请码表页面")
|
||||
@GetMapping("/edit/{id}")
|
||||
@RequiresPermissions("novel:authorCode:edit")
|
||||
String edit(@PathVariable("id") Long id, Model model) {
|
||||
AuthorCodeDO authorCode = authorCodeService.get(id);
|
||||
model.addAttribute("authorCode", authorCode);
|
||||
return "novel/authorCode/edit";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看作家邀请码表页面", notes = "查看作家邀请码表页面")
|
||||
@GetMapping("/detail/{id}")
|
||||
@RequiresPermissions("novel:authorCode:detail")
|
||||
String detail(@PathVariable("id") Long id, Model model) {
|
||||
AuthorCodeDO authorCode = authorCodeService.get(id);
|
||||
model.addAttribute("authorCode", authorCode);
|
||||
return "novel/authorCode/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation(value = "新增作家邀请码表", notes = "新增作家邀请码表")
|
||||
@ResponseBody
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("novel:authorCode:add")
|
||||
public R save( AuthorCodeDO authorCode) {
|
||||
if (authorCodeService.save(authorCode) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation(value = "修改作家邀请码表", notes = "修改作家邀请码表")
|
||||
@ResponseBody
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("novel:authorCode:edit")
|
||||
public R update( AuthorCodeDO authorCode) {
|
||||
authorCodeService.update(authorCode);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "删除作家邀请码表", notes = "删除作家邀请码表")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("novel:authorCode:remove")
|
||||
public R remove( Long id) {
|
||||
if (authorCodeService.remove(id) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "批量删除作家邀请码表", notes = "批量删除作家邀请码表")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("novel:authorCode:batchRemove")
|
||||
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||
authorCodeService.batchRemove(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
|
||||
import com.java2nb.novel.domain.AuthorDO;
|
||||
import com.java2nb.novel.service.AuthorService;
|
||||
import com.java2nb.common.utils.PageBean;
|
||||
import com.java2nb.common.utils.Query;
|
||||
import com.java2nb.common.utils.R;
|
||||
|
||||
/**
|
||||
* 作者表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-05-13 11:16:51
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/novel/author")
|
||||
public class AuthorController {
|
||||
@Autowired
|
||||
private AuthorService authorService;
|
||||
|
||||
@GetMapping()
|
||||
@RequiresPermissions("novel:author:author")
|
||||
String Author() {
|
||||
return "novel/author/author";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取作者表列表", notes = "获取作者表列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("novel:author:author")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
List<AuthorDO> authorList = authorService.list(query);
|
||||
int total = authorService.count(query);
|
||||
PageBean pageBean = new PageBean(authorList, total);
|
||||
return R.ok().put("data", pageBean);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增作者表页面", notes = "新增作者表页面")
|
||||
@GetMapping("/add")
|
||||
@RequiresPermissions("novel:author:add")
|
||||
String add() {
|
||||
return "novel/author/add";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改作者表页面", notes = "修改作者表页面")
|
||||
@GetMapping("/edit/{id}")
|
||||
@RequiresPermissions("novel:author:edit")
|
||||
String edit(@PathVariable("id") Long id, Model model) {
|
||||
AuthorDO author = authorService.get(id);
|
||||
model.addAttribute("author", author);
|
||||
return "novel/author/edit";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看作者表页面", notes = "查看作者表页面")
|
||||
@GetMapping("/detail/{id}")
|
||||
@RequiresPermissions("novel:author:detail")
|
||||
String detail(@PathVariable("id") Long id, Model model) {
|
||||
AuthorDO author = authorService.get(id);
|
||||
model.addAttribute("author", author);
|
||||
return "novel/author/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation(value = "新增作者表", notes = "新增作者表")
|
||||
@ResponseBody
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("novel:author:add")
|
||||
public R save( AuthorDO author) {
|
||||
if (authorService.save(author) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation(value = "修改作者表", notes = "修改作者表")
|
||||
@ResponseBody
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("novel:author:edit")
|
||||
public R update( AuthorDO author) {
|
||||
authorService.update(author);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "删除作者表", notes = "删除作者表")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("novel:author:remove")
|
||||
public R remove( Long id) {
|
||||
if (authorService.remove(id) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "批量删除作者表", notes = "批量删除作者表")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("novel:author:batchRemove")
|
||||
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||
authorService.batchRemove(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.java2nb.novel.dao;
|
||||
|
||||
import com.java2nb.novel.domain.AuthorCodeDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 作家邀请码表
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-05-13 11:29:15
|
||||
*/
|
||||
@Mapper
|
||||
public interface AuthorCodeDao {
|
||||
|
||||
AuthorCodeDO get(Long id);
|
||||
|
||||
List<AuthorCodeDO> list(Map<String,Object> map);
|
||||
|
||||
int count(Map<String,Object> map);
|
||||
|
||||
int save(AuthorCodeDO authorCode);
|
||||
|
||||
int update(AuthorCodeDO authorCode);
|
||||
|
||||
int remove(Long id);
|
||||
|
||||
int batchRemove(Long[] ids);
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.java2nb.novel.dao;
|
||||
|
||||
import com.java2nb.novel.domain.AuthorDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 作者表
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-05-13 11:16:51
|
||||
*/
|
||||
@Mapper
|
||||
public interface AuthorDao {
|
||||
|
||||
AuthorDO get(Long id);
|
||||
|
||||
List<AuthorDO> list(Map<String,Object> map);
|
||||
|
||||
int count(Map<String,Object> map);
|
||||
|
||||
int save(AuthorDO author);
|
||||
|
||||
int update(AuthorDO author);
|
||||
|
||||
int remove(Long id);
|
||||
|
||||
int batchRemove(Long[] ids);
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.java2nb.novel.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.java2nb.common.jsonserializer.LongToStringSerializer;
|
||||
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 作家邀请码表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-05-13 11:29:15
|
||||
*/
|
||||
public class AuthorCodeDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
//主键
|
||||
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
|
||||
//所以通过序列化成字符串来解决
|
||||
@JsonSerialize(using = LongToStringSerializer.class)
|
||||
private Long id;
|
||||
//邀请码
|
||||
private String inviteCode;
|
||||
//有效时间
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date validityTime;
|
||||
//是否使用过,0:未使用,1:使用过
|
||||
private Integer isUse;
|
||||
//创建时间
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//创建人ID
|
||||
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
|
||||
//所以通过序列化成字符串来解决
|
||||
@JsonSerialize(using = LongToStringSerializer.class)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 设置:主键
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 获取:主键
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* 设置:邀请码
|
||||
*/
|
||||
public void setInviteCode(String inviteCode) {
|
||||
this.inviteCode = inviteCode;
|
||||
}
|
||||
/**
|
||||
* 获取:邀请码
|
||||
*/
|
||||
public String getInviteCode() {
|
||||
return inviteCode;
|
||||
}
|
||||
/**
|
||||
* 设置:有效时间
|
||||
*/
|
||||
public void setValidityTime(Date validityTime) {
|
||||
this.validityTime = validityTime;
|
||||
}
|
||||
/**
|
||||
* 获取:有效时间
|
||||
*/
|
||||
public Date getValidityTime() {
|
||||
return validityTime;
|
||||
}
|
||||
/**
|
||||
* 设置:是否使用过,0:未使用,1:使用过
|
||||
*/
|
||||
public void setIsUse(Integer isUse) {
|
||||
this.isUse = isUse;
|
||||
}
|
||||
/**
|
||||
* 获取:是否使用过,0:未使用,1:使用过
|
||||
*/
|
||||
public Integer getIsUse() {
|
||||
return isUse;
|
||||
}
|
||||
/**
|
||||
* 设置:创建时间
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
/**
|
||||
* 获取:创建时间
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
/**
|
||||
* 设置:创建人ID
|
||||
*/
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
/**
|
||||
* 获取:创建人ID
|
||||
*/
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
}
|
176
novel-admin/src/main/java/com/java2nb/novel/domain/AuthorDO.java
Normal file
176
novel-admin/src/main/java/com/java2nb/novel/domain/AuthorDO.java
Normal file
@ -0,0 +1,176 @@
|
||||
package com.java2nb.novel.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.java2nb.common.jsonserializer.LongToStringSerializer;
|
||||
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 作者表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-05-13 11:16:51
|
||||
*/
|
||||
public class AuthorDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
//主键
|
||||
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
|
||||
//所以通过序列化成字符串来解决
|
||||
@JsonSerialize(using = LongToStringSerializer.class)
|
||||
private Long id;
|
||||
//用户ID
|
||||
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
|
||||
//所以通过序列化成字符串来解决
|
||||
@JsonSerialize(using = LongToStringSerializer.class)
|
||||
private Long userId;
|
||||
//邀请码
|
||||
private String inviteCode;
|
||||
//笔名
|
||||
private String penName;
|
||||
//手机号码
|
||||
private String telPhone;
|
||||
//QQ或微信账号
|
||||
private String chatAccount;
|
||||
//电子邮箱
|
||||
private String email;
|
||||
//作品方向,0:男频,1:女频
|
||||
private Integer workDirection;
|
||||
//创建时间
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//0:正常,1:封禁
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 设置:主键
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 获取:主键
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* 设置:用户ID
|
||||
*/
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
/**
|
||||
* 获取:用户ID
|
||||
*/
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
/**
|
||||
* 设置:邀请码
|
||||
*/
|
||||
public void setInviteCode(String inviteCode) {
|
||||
this.inviteCode = inviteCode;
|
||||
}
|
||||
/**
|
||||
* 获取:邀请码
|
||||
*/
|
||||
public String getInviteCode() {
|
||||
return inviteCode;
|
||||
}
|
||||
/**
|
||||
* 设置:笔名
|
||||
*/
|
||||
public void setPenName(String penName) {
|
||||
this.penName = penName;
|
||||
}
|
||||
/**
|
||||
* 获取:笔名
|
||||
*/
|
||||
public String getPenName() {
|
||||
return penName;
|
||||
}
|
||||
/**
|
||||
* 设置:手机号码
|
||||
*/
|
||||
public void setTelPhone(String telPhone) {
|
||||
this.telPhone = telPhone;
|
||||
}
|
||||
/**
|
||||
* 获取:手机号码
|
||||
*/
|
||||
public String getTelPhone() {
|
||||
return telPhone;
|
||||
}
|
||||
/**
|
||||
* 设置:QQ或微信账号
|
||||
*/
|
||||
public void setChatAccount(String chatAccount) {
|
||||
this.chatAccount = chatAccount;
|
||||
}
|
||||
/**
|
||||
* 获取:QQ或微信账号
|
||||
*/
|
||||
public String getChatAccount() {
|
||||
return chatAccount;
|
||||
}
|
||||
/**
|
||||
* 设置:电子邮箱
|
||||
*/
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
/**
|
||||
* 获取:电子邮箱
|
||||
*/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
/**
|
||||
* 设置:作品方向,0:男频,1:女频
|
||||
*/
|
||||
public void setWorkDirection(Integer workDirection) {
|
||||
this.workDirection = workDirection;
|
||||
}
|
||||
/**
|
||||
* 获取:作品方向,0:男频,1:女频
|
||||
*/
|
||||
public Integer getWorkDirection() {
|
||||
return workDirection;
|
||||
}
|
||||
/**
|
||||
* 设置:创建时间
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
/**
|
||||
* 获取:创建时间
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
/**
|
||||
* 设置:0:正常,1:封禁
|
||||
*/
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
/**
|
||||
* 获取:0:正常,1:封禁
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.java2nb.novel.service;
|
||||
|
||||
import com.java2nb.novel.domain.AuthorCodeDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作家邀请码表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-05-13 11:29:15
|
||||
*/
|
||||
public interface AuthorCodeService {
|
||||
|
||||
AuthorCodeDO get(Long id);
|
||||
|
||||
List<AuthorCodeDO> list(Map<String, Object> map);
|
||||
|
||||
int count(Map<String, Object> map);
|
||||
|
||||
int save(AuthorCodeDO authorCode);
|
||||
|
||||
int update(AuthorCodeDO authorCode);
|
||||
|
||||
int remove(Long id);
|
||||
|
||||
int batchRemove(Long[] ids);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.java2nb.novel.service;
|
||||
|
||||
import com.java2nb.novel.domain.AuthorDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作者表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-05-13 11:16:51
|
||||
*/
|
||||
public interface AuthorService {
|
||||
|
||||
AuthorDO get(Long id);
|
||||
|
||||
List<AuthorDO> list(Map<String, Object> map);
|
||||
|
||||
int count(Map<String, Object> map);
|
||||
|
||||
int save(AuthorDO author);
|
||||
|
||||
int update(AuthorDO author);
|
||||
|
||||
int remove(Long id);
|
||||
|
||||
int batchRemove(Long[] ids);
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.java2nb.novel.service.impl;
|
||||
|
||||
import com.java2nb.common.utils.ShiroUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.java2nb.novel.dao.AuthorCodeDao;
|
||||
import com.java2nb.novel.domain.AuthorCodeDO;
|
||||
import com.java2nb.novel.service.AuthorCodeService;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
public class AuthorCodeServiceImpl implements AuthorCodeService {
|
||||
@Autowired
|
||||
private AuthorCodeDao authorCodeDao;
|
||||
|
||||
@Override
|
||||
public AuthorCodeDO get(Long id){
|
||||
return authorCodeDao.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuthorCodeDO> list(Map<String, Object> map){
|
||||
return authorCodeDao.list(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(Map<String, Object> map){
|
||||
return authorCodeDao.count(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(AuthorCodeDO authorCode){
|
||||
authorCode.setIsUse(0);
|
||||
authorCode.setCreateTime(new Date());
|
||||
authorCode.setCreateUserId(ShiroUtils.getUserId());
|
||||
return authorCodeDao.save(authorCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(AuthorCodeDO authorCode){
|
||||
return authorCodeDao.update(authorCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remove(Long id){
|
||||
return authorCodeDao.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchRemove(Long[] ids){
|
||||
return authorCodeDao.batchRemove(ids);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.java2nb.novel.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.java2nb.novel.dao.AuthorDao;
|
||||
import com.java2nb.novel.domain.AuthorDO;
|
||||
import com.java2nb.novel.service.AuthorService;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
public class AuthorServiceImpl implements AuthorService {
|
||||
@Autowired
|
||||
private AuthorDao authorDao;
|
||||
|
||||
@Override
|
||||
public AuthorDO get(Long id){
|
||||
return authorDao.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuthorDO> list(Map<String, Object> map){
|
||||
return authorDao.list(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(Map<String, Object> map){
|
||||
return authorDao.count(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(AuthorDO author){
|
||||
return authorDao.save(author);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(AuthorDO author){
|
||||
return authorDao.update(author);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remove(Long id){
|
||||
return authorDao.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchRemove(Long[] ids){
|
||||
return authorDao.batchRemove(ids);
|
||||
}
|
||||
|
||||
}
|
@ -10,9 +10,9 @@ spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://128.0.0.1:3306/novel_biz?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: test123456
|
||||
password:
|
||||
#password:
|
||||
initialSize: 1
|
||||
minIdle: 3
|
||||
|
@ -3,7 +3,7 @@ server:
|
||||
# tomcat:
|
||||
# max-threads: 1000
|
||||
# min-spare-threads: 30
|
||||
port: 8082
|
||||
port: 80
|
||||
# uri-encoding: utf-8
|
||||
#security:
|
||||
# basic:
|
||||
|
@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.java2nb.novel.dao.AuthorCodeDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.novel.domain.AuthorCodeDO">
|
||||
select `id`,`invite_code`,`validity_time`,`is_use`,`create_time`,`create_user_id` from author_code where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.novel.domain.AuthorCodeDO">
|
||||
select `id`,`invite_code`,`validity_time`,`is_use`,`create_time`,`create_user_id` from author_code
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="inviteCode != null and inviteCode != ''"> and invite_code = #{inviteCode} </if>
|
||||
<if test="validityTime != null and validityTime != ''"> and validity_time = #{validityTime} </if>
|
||||
<if test="isUse != null and isUse != ''"> and is_use = #{isUse} </if>
|
||||
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
|
||||
<if test="createUserId != null and createUserId != ''"> and create_user_id = #{createUserId} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from author_code
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="inviteCode != null and inviteCode != ''"> and invite_code = #{inviteCode} </if>
|
||||
<if test="validityTime != null and validityTime != ''"> and validity_time = #{validityTime} </if>
|
||||
<if test="isUse != null and isUse != ''"> and is_use = #{isUse} </if>
|
||||
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
|
||||
<if test="createUserId != null and createUserId != ''"> and create_user_id = #{createUserId} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.novel.domain.AuthorCodeDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into author_code
|
||||
(
|
||||
`invite_code`,
|
||||
`validity_time`,
|
||||
`is_use`,
|
||||
`create_time`,
|
||||
`create_user_id`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{inviteCode},
|
||||
#{validityTime},
|
||||
#{isUse},
|
||||
#{createTime},
|
||||
#{createUserId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="saveSelective" parameterType="com.java2nb.novel.domain.AuthorCodeDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into author_code
|
||||
(
|
||||
<if test="id != null"> `id`, </if>
|
||||
<if test="inviteCode != null"> `invite_code`, </if>
|
||||
<if test="validityTime != null"> `validity_time`, </if>
|
||||
<if test="isUse != null"> `is_use`, </if>
|
||||
<if test="createTime != null"> `create_time`, </if>
|
||||
<if test="createUserId != null"> `create_user_id` </if>
|
||||
)
|
||||
values
|
||||
(
|
||||
<if test="id != null"> #{id}, </if>
|
||||
<if test="inviteCode != null"> #{inviteCode}, </if>
|
||||
<if test="validityTime != null"> #{validityTime}, </if>
|
||||
<if test="isUse != null"> #{isUse}, </if>
|
||||
<if test="createTime != null"> #{createTime}, </if>
|
||||
<if test="createUserId != null"> #{createUserId} </if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.novel.domain.AuthorCodeDO">
|
||||
update author_code
|
||||
<set>
|
||||
<if test="inviteCode != null">`invite_code` = #{inviteCode}, </if>
|
||||
<if test="validityTime != null">`validity_time` = #{validityTime}, </if>
|
||||
<if test="isUse != null">`is_use` = #{isUse}, </if>
|
||||
<if test="createTime != null">`create_time` = #{createTime}, </if>
|
||||
<if test="createUserId != null">`create_user_id` = #{createUserId}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from author_code where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from author_code where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
136
novel-admin/src/main/resources/mybatis/novel/AuthorMapper.xml
Normal file
136
novel-admin/src/main/resources/mybatis/novel/AuthorMapper.xml
Normal file
@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.java2nb.novel.dao.AuthorDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.novel.domain.AuthorDO">
|
||||
select `id`,`user_id`,`invite_code`,`pen_name`,`tel_phone`,`chat_account`,`email`,`work_direction`,`create_time`,`status` from author where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.novel.domain.AuthorDO">
|
||||
select `id`,`user_id`,`invite_code`,`pen_name`,`tel_phone`,`chat_account`,`email`,`work_direction`,`create_time`,`status` from author
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
|
||||
<if test="inviteCode != null and inviteCode != ''"> and invite_code = #{inviteCode} </if>
|
||||
<if test="penName != null and penName != ''"> and pen_name = #{penName} </if>
|
||||
<if test="telPhone != null and telPhone != ''"> and tel_phone = #{telPhone} </if>
|
||||
<if test="chatAccount != null and chatAccount != ''"> and chat_account = #{chatAccount} </if>
|
||||
<if test="email != null and email != ''"> and email = #{email} </if>
|
||||
<if test="workDirection != null and workDirection != ''"> and work_direction = #{workDirection} </if>
|
||||
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
|
||||
<if test="status != null and status != ''"> and status = #{status} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from author
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
|
||||
<if test="inviteCode != null and inviteCode != ''"> and invite_code = #{inviteCode} </if>
|
||||
<if test="penName != null and penName != ''"> and pen_name = #{penName} </if>
|
||||
<if test="telPhone != null and telPhone != ''"> and tel_phone = #{telPhone} </if>
|
||||
<if test="chatAccount != null and chatAccount != ''"> and chat_account = #{chatAccount} </if>
|
||||
<if test="email != null and email != ''"> and email = #{email} </if>
|
||||
<if test="workDirection != null and workDirection != ''"> and work_direction = #{workDirection} </if>
|
||||
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
|
||||
<if test="status != null and status != ''"> and status = #{status} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.novel.domain.AuthorDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into author
|
||||
(
|
||||
`user_id`,
|
||||
`invite_code`,
|
||||
`pen_name`,
|
||||
`tel_phone`,
|
||||
`chat_account`,
|
||||
`email`,
|
||||
`work_direction`,
|
||||
`create_time`,
|
||||
`status`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{userId},
|
||||
#{inviteCode},
|
||||
#{penName},
|
||||
#{telPhone},
|
||||
#{chatAccount},
|
||||
#{email},
|
||||
#{workDirection},
|
||||
#{createTime},
|
||||
#{status}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="saveSelective" parameterType="com.java2nb.novel.domain.AuthorDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into author
|
||||
(
|
||||
<if test="id != null"> `id`, </if>
|
||||
<if test="userId != null"> `user_id`, </if>
|
||||
<if test="inviteCode != null"> `invite_code`, </if>
|
||||
<if test="penName != null"> `pen_name`, </if>
|
||||
<if test="telPhone != null"> `tel_phone`, </if>
|
||||
<if test="chatAccount != null"> `chat_account`, </if>
|
||||
<if test="email != null"> `email`, </if>
|
||||
<if test="workDirection != null"> `work_direction`, </if>
|
||||
<if test="createTime != null"> `create_time`, </if>
|
||||
<if test="status != null"> `status` </if>
|
||||
)
|
||||
values
|
||||
(
|
||||
<if test="id != null"> #{id}, </if>
|
||||
<if test="userId != null"> #{userId}, </if>
|
||||
<if test="inviteCode != null"> #{inviteCode}, </if>
|
||||
<if test="penName != null"> #{penName}, </if>
|
||||
<if test="telPhone != null"> #{telPhone}, </if>
|
||||
<if test="chatAccount != null"> #{chatAccount}, </if>
|
||||
<if test="email != null"> #{email}, </if>
|
||||
<if test="workDirection != null"> #{workDirection}, </if>
|
||||
<if test="createTime != null"> #{createTime}, </if>
|
||||
<if test="status != null"> #{status} </if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.novel.domain.AuthorDO">
|
||||
update author
|
||||
<set>
|
||||
<if test="userId != null">`user_id` = #{userId}, </if>
|
||||
<if test="inviteCode != null">`invite_code` = #{inviteCode}, </if>
|
||||
<if test="penName != null">`pen_name` = #{penName}, </if>
|
||||
<if test="telPhone != null">`tel_phone` = #{telPhone}, </if>
|
||||
<if test="chatAccount != null">`chat_account` = #{chatAccount}, </if>
|
||||
<if test="email != null">`email` = #{email}, </if>
|
||||
<if test="workDirection != null">`work_direction` = #{workDirection}, </if>
|
||||
<if test="createTime != null">`create_time` = #{createTime}, </if>
|
||||
<if test="status != null">`status` = #{status}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from author where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from author where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,107 @@
|
||||
var E = window.wangEditor;
|
||||
$("[id^='contentEditor']").each(function (index, ele) {
|
||||
var relName = $(ele).attr("id").substring(13);
|
||||
var editor = new E('#contentEditor' + relName);
|
||||
// 自定义菜单配置
|
||||
editor.customConfig.menus = [
|
||||
'head', // 标题
|
||||
'bold', // 粗体
|
||||
'fontSize', // 字号
|
||||
'fontName', // 字体
|
||||
'italic', // 斜体
|
||||
'underline', // 下划线
|
||||
'strikeThrough', // 删除线
|
||||
'foreColor', // 文字颜色
|
||||
//'backColor', // 背景颜色
|
||||
//'link', // 插入链接
|
||||
'list', // 列表
|
||||
'justify', // 对齐方式
|
||||
'quote', // 引用
|
||||
'emoticon', // 表情
|
||||
'image', // 插入图片
|
||||
//'table', // 表格
|
||||
//'video', // 插入视频
|
||||
//'code', // 插入代码
|
||||
'undo', // 撤销
|
||||
'redo' // 重复
|
||||
];
|
||||
editor.customConfig.onchange = function (html) {
|
||||
// html 即变化之后的内容
|
||||
$("#" + relName).val(html);
|
||||
}
|
||||
editor.customConfig.uploadImgShowBase64 = true;
|
||||
editor.create();
|
||||
|
||||
})
|
||||
|
||||
$("[id^='picImage']").each(function (index, ele) {
|
||||
var relName = $(ele).attr("id").substring(8);
|
||||
layui.use('upload', function () {
|
||||
var upload = layui.upload;
|
||||
//执行实例
|
||||
var uploadInst = upload.render({
|
||||
elem: '#picImage' + relName, //绑定元素
|
||||
url: '/common/sysFile/upload', //上传接口
|
||||
size: 1000,
|
||||
accept: 'file',
|
||||
done: function (r) {
|
||||
$("#picImage" + relName).attr("src", r.fileName);
|
||||
$("#" + relName).val(r.fileName);
|
||||
},
|
||||
error: function (r) {
|
||||
layer.msg(r.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$().ready(function () {
|
||||
validateRule();
|
||||
});
|
||||
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function () {
|
||||
save();
|
||||
}
|
||||
});
|
||||
function save() {
|
||||
$.ajax({
|
||||
cache: true,
|
||||
type: "POST",
|
||||
url: "/novel/author/save",
|
||||
data: $('#signupForm').serialize(),// 你的formid
|
||||
async: false,
|
||||
error: function (request) {
|
||||
parent.layer.alert("Connection error");
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 0) {
|
||||
parent.layer.msg("操作成功");
|
||||
parent.reLoad();
|
||||
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
|
||||
parent.layer.close(index);
|
||||
|
||||
} else {
|
||||
parent.layer.alert(data.msg)
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
function validateRule() {
|
||||
var icon = "<i class='fa fa-times-circle'></i> ";
|
||||
$("#signupForm").validate({
|
||||
ignore: "",
|
||||
rules: {
|
||||
},
|
||||
messages: {
|
||||
}
|
||||
})
|
||||
}
|
@ -0,0 +1,244 @@
|
||||
var prefix = "/novel/author"
|
||||
$(function () {
|
||||
load();
|
||||
});
|
||||
|
||||
function load() {
|
||||
$('#exampleTable')
|
||||
.bootstrapTable(
|
||||
{
|
||||
method: 'get', // 服务器数据的请求方式 get or post
|
||||
url: prefix + "/list", // 服务器数据的加载地址
|
||||
// showRefresh : true,
|
||||
// showToggle : true,
|
||||
// showColumns : true,
|
||||
iconSize: 'outline',
|
||||
toolbar: '#exampleToolbar',
|
||||
striped: true, // 设置为true会有隔行变色效果
|
||||
dataType: "json", // 服务器返回的数据类型
|
||||
pagination: true, // 设置为true会在底部显示分页条
|
||||
// queryParamsType : "limit",
|
||||
// //设置为limit则会发送符合RESTFull格式的参数
|
||||
singleSelect: false, // 设置为true将禁止多选
|
||||
// contentType : "application/x-www-form-urlencoded",
|
||||
// //发送到服务器的数据编码类型
|
||||
pageSize: 10, // 如果设置了分页,每页数据条数
|
||||
pageNumber: 1, // 如果设置了分布,首页页码
|
||||
//search : true, // 是否显示搜索框
|
||||
showColumns: false, // 是否显示内容下拉框(选择显示的列)
|
||||
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
|
||||
queryParams: function (params) {
|
||||
//说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
|
||||
var queryParams = getFormJson("searchForm");
|
||||
queryParams.limit = params.limit;
|
||||
queryParams.offset = params.offset;
|
||||
return queryParams;
|
||||
},
|
||||
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
|
||||
// queryParamsType = 'limit' ,返回参数必须包含
|
||||
// limit, offset, search, sort, order 否则, 需要包含:
|
||||
// pageSize, pageNumber, searchText, sortName,
|
||||
// sortOrder.
|
||||
// 返回false将会终止请求
|
||||
responseHandler: function (rs) {
|
||||
|
||||
if (rs.code == 0) {
|
||||
return rs.data;
|
||||
} else {
|
||||
parent.layer.alert(rs.msg)
|
||||
return {total: 0, rows: []};
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
title: '序号',
|
||||
formatter: function () {
|
||||
return arguments[2] + 1;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'inviteCode',
|
||||
title: '邀请码'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'penName',
|
||||
title: '笔名'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'telPhone',
|
||||
title: '手机号码'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'chatAccount',
|
||||
title: 'QQ或微信账号'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'email',
|
||||
title: '电子邮箱'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'workDirection',
|
||||
title: '作品方向',
|
||||
formatter: function (value, row, index) {
|
||||
return formatDict("work_direction", value);
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '入驻时间'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
formatter: function (value, row, index) {
|
||||
return value == 1 ? '封禁' : '正常';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
field: 'id',
|
||||
align: 'center',
|
||||
formatter: function (value, row, index) {
|
||||
if(row.status==1) {
|
||||
var e = '<a class="btn btn-primary btn-sm ' + s_edit_h + '" href="#" mce_href="#" title="恢复正常" onclick="edit(\''
|
||||
+ row.id
|
||||
+ '\',0)"><i >恢复正常</i></a> ';
|
||||
}else{
|
||||
var e = '<a class="btn btn-primary btn-sm ' + s_edit_h + '" href="#" mce_href="#" title="封禁" onclick="edit(\''
|
||||
+ row.id
|
||||
+ '\',1)"><i >封禁</i></a> ';
|
||||
}
|
||||
return e ;
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
function reLoad() {
|
||||
$('#exampleTable').bootstrapTable('refresh');
|
||||
}
|
||||
|
||||
function add() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '增加',
|
||||
maxmin: true,
|
||||
shadeClose: false, // 点击遮罩关闭层
|
||||
area: ['800px', '520px'],
|
||||
content: prefix + '/add' // iframe的url
|
||||
});
|
||||
}
|
||||
|
||||
function detail(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '详情',
|
||||
maxmin: true,
|
||||
shadeClose: false, // 点击遮罩关闭层
|
||||
area: ['800px', '520px'],
|
||||
content: prefix + '/detail/' + id // iframe的url
|
||||
});
|
||||
}
|
||||
|
||||
function edit(id,status) {
|
||||
$.ajax({
|
||||
cache: true,
|
||||
type: "POST",
|
||||
url: "/novel/author/update",
|
||||
data: {'id':id,'status':status},// 你的formid
|
||||
async: false,
|
||||
error: function (request) {
|
||||
parent.layer.alert("Connection error");
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 0) {
|
||||
parent.layer.msg("操作成功");
|
||||
reLoad();
|
||||
|
||||
} else {
|
||||
parent.layer.alert(data.msg)
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function remove(id) {
|
||||
layer.confirm('确定要删除选中的记录?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
$.ajax({
|
||||
url: prefix + "/remove",
|
||||
type: "post",
|
||||
data: {
|
||||
'id': id
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.code == 0) {
|
||||
layer.msg(r.msg);
|
||||
reLoad();
|
||||
} else {
|
||||
layer.msg(r.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function resetPwd(id) {
|
||||
}
|
||||
|
||||
function batchRemove() {
|
||||
var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组
|
||||
if (rows.length == 0) {
|
||||
layer.msg("请选择要删除的数据");
|
||||
return;
|
||||
}
|
||||
layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", {
|
||||
btn: ['确定', '取消']
|
||||
// 按钮
|
||||
}, function () {
|
||||
var ids = new Array();
|
||||
// 遍历所有选择的行数据,取每条数据对应的ID
|
||||
$.each(rows, function (i, row) {
|
||||
ids[i] = row['id'];
|
||||
});
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
data: {
|
||||
"ids": ids
|
||||
},
|
||||
url: prefix + '/batchRemove',
|
||||
success: function (r) {
|
||||
if (r.code == 0) {
|
||||
layer.msg(r.msg);
|
||||
reLoad();
|
||||
} else {
|
||||
layer.msg(r.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
var E = window.wangEditor;
|
||||
$("[id^='contentEditor']").each(function (index, ele) {
|
||||
var relName = $(ele).attr("id").substring(13);
|
||||
var editor = new E('#contentEditor' + relName);
|
||||
// 自定义菜单配置
|
||||
editor.customConfig.menus = [
|
||||
'head', // 标题
|
||||
'bold', // 粗体
|
||||
'fontSize', // 字号
|
||||
'fontName', // 字体
|
||||
'italic', // 斜体
|
||||
'underline', // 下划线
|
||||
'strikeThrough', // 删除线
|
||||
'foreColor', // 文字颜色
|
||||
//'backColor', // 背景颜色
|
||||
//'link', // 插入链接
|
||||
'list', // 列表
|
||||
'justify', // 对齐方式
|
||||
'quote', // 引用
|
||||
'emoticon', // 表情
|
||||
'image', // 插入图片
|
||||
//'table', // 表格
|
||||
//'video', // 插入视频
|
||||
//'code', // 插入代码
|
||||
'undo', // 撤销
|
||||
'redo' // 重复
|
||||
];
|
||||
editor.customConfig.onchange = function (html) {
|
||||
// html 即变化之后的内容
|
||||
$("#" + relName).val(html);
|
||||
}
|
||||
editor.customConfig.uploadImgShowBase64 = true;
|
||||
editor.create();
|
||||
editor.txt.html($("#" + relName).val());
|
||||
|
||||
})
|
||||
|
||||
$("[id^='picImage']").each(function (index, ele) {
|
||||
var relName = $(ele).attr("id").substring(8);
|
||||
layui.use('upload', function () {
|
||||
var upload = layui.upload;
|
||||
//执行实例
|
||||
var uploadInst = upload.render({
|
||||
elem: '#picImage' + relName, //绑定元素
|
||||
url: '/common/sysFile/upload', //上传接口
|
||||
size: 1000,
|
||||
accept: 'file',
|
||||
done: function (r) {
|
||||
$("#picImage" + relName).attr("src", r.fileName);
|
||||
$("#" + relName).val(r.fileName);
|
||||
},
|
||||
error: function (r) {
|
||||
layer.msg(r.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$().ready(function () {
|
||||
validateRule();
|
||||
});
|
||||
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function () {
|
||||
update();
|
||||
}
|
||||
});
|
||||
function update() {
|
||||
$.ajax({
|
||||
cache: true,
|
||||
type: "POST",
|
||||
url: "/novel/author/update",
|
||||
data: $('#signupForm').serialize(),// 你的formid
|
||||
async: false,
|
||||
error: function (request) {
|
||||
parent.layer.alert("Connection error");
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 0) {
|
||||
parent.layer.msg("操作成功");
|
||||
parent.reLoad();
|
||||
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
|
||||
parent.layer.close(index);
|
||||
|
||||
} else {
|
||||
parent.layer.alert(data.msg)
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
function validateRule() {
|
||||
var icon = "<i class='fa fa-times-circle'></i> ";
|
||||
$("#signupForm").validate({
|
||||
ignore: "",
|
||||
rules: {
|
||||
},
|
||||
messages: {
|
||||
}
|
||||
})
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
var E = window.wangEditor;
|
||||
$("[id^='contentEditor']").each(function (index, ele) {
|
||||
var relName = $(ele).attr("id").substring(13);
|
||||
var editor = new E('#contentEditor' + relName);
|
||||
// 自定义菜单配置
|
||||
editor.customConfig.menus = [
|
||||
'head', // 标题
|
||||
'bold', // 粗体
|
||||
'fontSize', // 字号
|
||||
'fontName', // 字体
|
||||
'italic', // 斜体
|
||||
'underline', // 下划线
|
||||
'strikeThrough', // 删除线
|
||||
'foreColor', // 文字颜色
|
||||
//'backColor', // 背景颜色
|
||||
//'link', // 插入链接
|
||||
'list', // 列表
|
||||
'justify', // 对齐方式
|
||||
'quote', // 引用
|
||||
'emoticon', // 表情
|
||||
'image', // 插入图片
|
||||
//'table', // 表格
|
||||
//'video', // 插入视频
|
||||
//'code', // 插入代码
|
||||
'undo', // 撤销
|
||||
'redo' // 重复
|
||||
];
|
||||
editor.customConfig.onchange = function (html) {
|
||||
// html 即变化之后的内容
|
||||
$("#" + relName).val(html);
|
||||
}
|
||||
editor.customConfig.uploadImgShowBase64 = true;
|
||||
editor.create();
|
||||
|
||||
})
|
||||
|
||||
$("[id^='picImage']").each(function (index, ele) {
|
||||
var relName = $(ele).attr("id").substring(8);
|
||||
layui.use('upload', function () {
|
||||
var upload = layui.upload;
|
||||
//执行实例
|
||||
var uploadInst = upload.render({
|
||||
elem: '#picImage' + relName, //绑定元素
|
||||
url: '/common/sysFile/upload', //上传接口
|
||||
size: 1000,
|
||||
accept: 'file',
|
||||
done: function (r) {
|
||||
$("#picImage" + relName).attr("src", r.fileName);
|
||||
$("#" + relName).val(r.fileName);
|
||||
},
|
||||
error: function (r) {
|
||||
layer.msg(r.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$().ready(function () {
|
||||
validateRule();
|
||||
});
|
||||
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function () {
|
||||
save();
|
||||
}
|
||||
});
|
||||
function save() {
|
||||
$.ajax({
|
||||
cache: true,
|
||||
type: "POST",
|
||||
url: "/novel/authorCode/save",
|
||||
data: $('#signupForm').serialize(),// 你的formid
|
||||
async: false,
|
||||
error: function (request) {
|
||||
parent.layer.alert("Connection error");
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 0) {
|
||||
parent.layer.msg("操作成功");
|
||||
parent.reLoad();
|
||||
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
|
||||
parent.layer.close(index);
|
||||
|
||||
} else {
|
||||
parent.layer.alert(data.msg)
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
function validateRule() {
|
||||
var icon = "<i class='fa fa-times-circle'></i> ";
|
||||
$("#signupForm").validate({
|
||||
ignore: "",
|
||||
rules: {
|
||||
inviteCode: {
|
||||
required: true
|
||||
}, validityTime: {
|
||||
required: true
|
||||
}, },
|
||||
messages: {
|
||||
inviteCode: {
|
||||
required: icon + "请选择邀请码"
|
||||
}, validityTime: {
|
||||
required: icon + "请选择有效时间"
|
||||
}, }
|
||||
})
|
||||
}
|
@ -0,0 +1,212 @@
|
||||
var prefix = "/novel/authorCode"
|
||||
$(function () {
|
||||
load();
|
||||
});
|
||||
|
||||
function load() {
|
||||
$('#exampleTable')
|
||||
.bootstrapTable(
|
||||
{
|
||||
method: 'get', // 服务器数据的请求方式 get or post
|
||||
url: prefix + "/list", // 服务器数据的加载地址
|
||||
// showRefresh : true,
|
||||
// showToggle : true,
|
||||
// showColumns : true,
|
||||
iconSize: 'outline',
|
||||
toolbar: '#exampleToolbar',
|
||||
striped: true, // 设置为true会有隔行变色效果
|
||||
dataType: "json", // 服务器返回的数据类型
|
||||
pagination: true, // 设置为true会在底部显示分页条
|
||||
// queryParamsType : "limit",
|
||||
// //设置为limit则会发送符合RESTFull格式的参数
|
||||
singleSelect: false, // 设置为true将禁止多选
|
||||
// contentType : "application/x-www-form-urlencoded",
|
||||
// //发送到服务器的数据编码类型
|
||||
pageSize: 10, // 如果设置了分页,每页数据条数
|
||||
pageNumber: 1, // 如果设置了分布,首页页码
|
||||
//search : true, // 是否显示搜索框
|
||||
showColumns: false, // 是否显示内容下拉框(选择显示的列)
|
||||
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
|
||||
queryParams: function (params) {
|
||||
//说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
|
||||
var queryParams = getFormJson("searchForm");
|
||||
queryParams.limit = params.limit;
|
||||
queryParams.offset = params.offset;
|
||||
return queryParams;
|
||||
},
|
||||
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
|
||||
// queryParamsType = 'limit' ,返回参数必须包含
|
||||
// limit, offset, search, sort, order 否则, 需要包含:
|
||||
// pageSize, pageNumber, searchText, sortName,
|
||||
// sortOrder.
|
||||
// 返回false将会终止请求
|
||||
responseHandler: function (rs) {
|
||||
|
||||
if (rs.code == 0) {
|
||||
return rs.data;
|
||||
} else {
|
||||
parent.layer.alert(rs.msg)
|
||||
return {total: 0, rows: []};
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
title: '序号',
|
||||
formatter: function () {
|
||||
return arguments[2] + 1;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'inviteCode',
|
||||
title: '邀请码'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'validityTime',
|
||||
title: '有效时间'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'isUse',
|
||||
title: '是否使用过',
|
||||
formatter: function (value, row, index) {
|
||||
return value == 1 ? '使用过' : '未使用';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间'
|
||||
},
|
||||
|
||||
|
||||
/* {
|
||||
field: 'createUserId',
|
||||
title: '创建人ID'
|
||||
},*/
|
||||
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
field: 'id',
|
||||
align: 'center',
|
||||
formatter: function (value, row, index) {
|
||||
/* var d = '<a class="btn btn-primary btn-sm ' + s_detail_h + '" href="#" mce_href="#" title="详情" onclick="detail(\''
|
||||
+ row.id
|
||||
+ '\')"><i class="fa fa-file"></i></a> ';*/
|
||||
/* var e = '<a class="btn btn-primary btn-sm ' + s_edit_h + '" href="#" mce_href="#" title="编辑" onclick="edit(\''
|
||||
+ row.id
|
||||
+ '\')"><i class="fa fa-edit"></i></a> ';*/
|
||||
var r = '<a class="btn btn-warning btn-sm ' + s_remove_h + '" href="#" title="删除" mce_href="#" onclick="remove(\''
|
||||
+ row.id
|
||||
+ '\')"><i class="fa fa-remove"></i></a> ';
|
||||
return r;
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
function reLoad() {
|
||||
$('#exampleTable').bootstrapTable('refresh');
|
||||
}
|
||||
|
||||
function add() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '增加',
|
||||
maxmin: true,
|
||||
shadeClose: false, // 点击遮罩关闭层
|
||||
area: ['800px', '520px'],
|
||||
content: prefix + '/add' // iframe的url
|
||||
});
|
||||
}
|
||||
|
||||
function detail(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '详情',
|
||||
maxmin: true,
|
||||
shadeClose: false, // 点击遮罩关闭层
|
||||
area: ['800px', '520px'],
|
||||
content: prefix + '/detail/' + id // iframe的url
|
||||
});
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '编辑',
|
||||
maxmin: true,
|
||||
shadeClose: false, // 点击遮罩关闭层
|
||||
area: ['800px', '520px'],
|
||||
content: prefix + '/edit/' + id // iframe的url
|
||||
});
|
||||
}
|
||||
|
||||
function remove(id) {
|
||||
layer.confirm('确定要删除选中的记录?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
$.ajax({
|
||||
url: prefix + "/remove",
|
||||
type: "post",
|
||||
data: {
|
||||
'id': id
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.code == 0) {
|
||||
layer.msg(r.msg);
|
||||
reLoad();
|
||||
} else {
|
||||
layer.msg(r.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function resetPwd(id) {
|
||||
}
|
||||
|
||||
function batchRemove() {
|
||||
var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组
|
||||
if (rows.length == 0) {
|
||||
layer.msg("请选择要删除的数据");
|
||||
return;
|
||||
}
|
||||
layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", {
|
||||
btn: ['确定', '取消']
|
||||
// 按钮
|
||||
}, function () {
|
||||
var ids = new Array();
|
||||
// 遍历所有选择的行数据,取每条数据对应的ID
|
||||
$.each(rows, function (i, row) {
|
||||
ids[i] = row['id'];
|
||||
});
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
data: {
|
||||
"ids": ids
|
||||
},
|
||||
url: prefix + '/batchRemove',
|
||||
success: function (r) {
|
||||
if (r.code == 0) {
|
||||
layer.msg(r.msg);
|
||||
reLoad();
|
||||
} else {
|
||||
layer.msg(r.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
var E = window.wangEditor;
|
||||
$("[id^='contentEditor']").each(function (index, ele) {
|
||||
var relName = $(ele).attr("id").substring(13);
|
||||
var editor = new E('#contentEditor' + relName);
|
||||
// 自定义菜单配置
|
||||
editor.customConfig.menus = [
|
||||
'head', // 标题
|
||||
'bold', // 粗体
|
||||
'fontSize', // 字号
|
||||
'fontName', // 字体
|
||||
'italic', // 斜体
|
||||
'underline', // 下划线
|
||||
'strikeThrough', // 删除线
|
||||
'foreColor', // 文字颜色
|
||||
//'backColor', // 背景颜色
|
||||
//'link', // 插入链接
|
||||
'list', // 列表
|
||||
'justify', // 对齐方式
|
||||
'quote', // 引用
|
||||
'emoticon', // 表情
|
||||
'image', // 插入图片
|
||||
//'table', // 表格
|
||||
//'video', // 插入视频
|
||||
//'code', // 插入代码
|
||||
'undo', // 撤销
|
||||
'redo' // 重复
|
||||
];
|
||||
editor.customConfig.onchange = function (html) {
|
||||
// html 即变化之后的内容
|
||||
$("#" + relName).val(html);
|
||||
}
|
||||
editor.customConfig.uploadImgShowBase64 = true;
|
||||
editor.create();
|
||||
editor.txt.html($("#" + relName).val());
|
||||
|
||||
})
|
||||
|
||||
$("[id^='picImage']").each(function (index, ele) {
|
||||
var relName = $(ele).attr("id").substring(8);
|
||||
layui.use('upload', function () {
|
||||
var upload = layui.upload;
|
||||
//执行实例
|
||||
var uploadInst = upload.render({
|
||||
elem: '#picImage' + relName, //绑定元素
|
||||
url: '/common/sysFile/upload', //上传接口
|
||||
size: 1000,
|
||||
accept: 'file',
|
||||
done: function (r) {
|
||||
$("#picImage" + relName).attr("src", r.fileName);
|
||||
$("#" + relName).val(r.fileName);
|
||||
},
|
||||
error: function (r) {
|
||||
layer.msg(r.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$().ready(function () {
|
||||
validateRule();
|
||||
});
|
||||
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function () {
|
||||
update();
|
||||
}
|
||||
});
|
||||
function update() {
|
||||
$.ajax({
|
||||
cache: true,
|
||||
type: "POST",
|
||||
url: "/novel/authorCode/update",
|
||||
data: $('#signupForm').serialize(),// 你的formid
|
||||
async: false,
|
||||
error: function (request) {
|
||||
parent.layer.alert("Connection error");
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 0) {
|
||||
parent.layer.msg("操作成功");
|
||||
parent.reLoad();
|
||||
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
|
||||
parent.layer.close(index);
|
||||
|
||||
} else {
|
||||
parent.layer.alert(data.msg)
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
function validateRule() {
|
||||
var icon = "<i class='fa fa-times-circle'></i> ";
|
||||
$("#signupForm").validate({
|
||||
ignore: "",
|
||||
rules: {
|
||||
inviteCode:
|
||||
{
|
||||
required: true
|
||||
}, validityTime:
|
||||
{
|
||||
required: true
|
||||
}, },
|
||||
messages: {
|
||||
inviteCode:
|
||||
{
|
||||
required: icon + "请选择邀请码"
|
||||
}, validityTime:
|
||||
{
|
||||
required: icon + "请选择有效时间"
|
||||
}, }
|
||||
})
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
-- 菜单SQL
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
VALUES ('1', '作者表', 'novel/author', 'novel:author:author', '1', 'fa', '6');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
set @parentId = @@identity;
|
||||
|
||||
-- 菜单对应按钮SQL
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '查看', null, 'novel:author:detail', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '新增', null, 'novel:author:add', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '修改', null, 'novel:author:edit', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '删除', null, 'novel:author:remove', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '批量删除', null, 'novel:author:batchRemove', '2', null, '6';
|
@ -0,0 +1,18 @@
|
||||
-- 菜单SQL
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
VALUES ('1', '作家邀请码表', 'novel/authorCode', 'novel:authorCode:authorCode', '1', 'fa', '6');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
set @parentId = @@identity;
|
||||
|
||||
-- 菜单对应按钮SQL
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '查看', null, 'novel:authorCode:detail', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '新增', null, 'novel:authorCode:add', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '修改', null, 'novel:authorCode:edit', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '删除', null, 'novel:authorCode:remove', '2', null, '6';
|
||||
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||
SELECT @parentId, '批量删除', null, 'novel:authorCode:batchRemove', '2', null, '6';
|
114
novel-admin/src/main/resources/templates/novel/author/add.html
Normal file
114
novel-admin/src/main/resources/templates/novel/author/add.html
Normal file
@ -0,0 +1,114 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">用户ID:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="userId" name="userId"
|
||||
class="form-control"
|
||||
type="text">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邀请码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="inviteCode" name="inviteCode"
|
||||
class="form-control"
|
||||
type="text">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">笔名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="penName" name="penName"
|
||||
class="form-control"
|
||||
type="text">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">手机号码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="telPhone" name="telPhone"
|
||||
class="form-control"
|
||||
type="text">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ或微信账号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="chatAccount" name="chatAccount"
|
||||
class="form-control"
|
||||
type="text">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">电子邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="email" name="email"
|
||||
class="form-control"
|
||||
type="text">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">作品方向,0:男频,1:女频:</label>
|
||||
<div class="col-sm-8">
|
||||
|
||||
<select data-placeholder="--选择--" id="workDirection"
|
||||
name="workDirection"
|
||||
class="form-control chosen-select" tabindex="2"
|
||||
dict-type="work_direction">
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">入驻时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="laydate-icon layer-date form-control"
|
||||
id="createTime"
|
||||
name="createTime"
|
||||
onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
|
||||
style="background-color: #fff;" readonly="readonly"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">0:正常,1:封禁:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="status" name="status"
|
||||
class="form-control"
|
||||
type="text">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-8 col-sm-offset-3">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript" src="/wangEditor/release/wangEditor.js"></script>
|
||||
<script type="text/javascript" src="/js/appjs/novel/author/add.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-body">
|
||||
<div class="fixed-table-toolbar">
|
||||
<div class="columns pull-left">
|
||||
</div>
|
||||
<div class="columns pull-right">
|
||||
<button class="btn btn-success" onclick="reLoad()">查询</button>
|
||||
</div>
|
||||
|
||||
<form id="searchForm">
|
||||
<div class="columns pull-right col-md-2">
|
||||
<input id="penName" name="penName" type="text" class="form-control"
|
||||
placeholder="笔名">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<table id="exampleTable" data-mobile-responsive="true">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--shiro控制bootstraptable行内按钮看见性 -->
|
||||
<div>
|
||||
<script type="text/javascript">
|
||||
var s_detail_h = 'hidden';
|
||||
var s_edit_h = 'hidden';
|
||||
var s_remove_h = 'hidden';
|
||||
</script>
|
||||
</div>
|
||||
<div shiro:hasPermission="test:order:detail">
|
||||
<script type="text/javascript">
|
||||
s_detail_h = '';
|
||||
</script>
|
||||
</div>
|
||||
<div shiro:hasPermission="novel:author:edit">
|
||||
<script type="text/javascript">
|
||||
s_edit_h = '';
|
||||
</script>
|
||||
</div>
|
||||
<div shiro:hasPermission="novel:author:remove">
|
||||
<script type="text/javascript">
|
||||
var s_remove_h = '';
|
||||
</script>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script type="text/javascript" src="/js/appjs/novel/author/author.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,111 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<input id="id" name="id" th:value="${author.id}"
|
||||
type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">用户ID:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${author.userId}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邀请码:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${author.inviteCode}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">笔名:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${author.penName}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">手机号码:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${author.telPhone}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ或微信账号:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${author.chatAccount}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">电子邮箱:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${author.email}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">作品方向,0:男频,1:女频:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8 dict-type" dict-type="work_direction"
|
||||
th:attr="dict-value=${author.workDirection}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">入驻时间:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${author.createTime}==null?null:${#dates.format(author.createTime,'yyyy-MM-dd HH:mm:ss')}">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">0:正常,1:封禁:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${author.status}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
</body>
|
||||
</html>
|
116
novel-admin/src/main/resources/templates/novel/author/edit.html
Normal file
116
novel-admin/src/main/resources/templates/novel/author/edit.html
Normal file
@ -0,0 +1,116 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<input id="id" name="id" th:value="${author.id}"
|
||||
type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">用户ID:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="userId" name="userId"
|
||||
th:value="${author.userId}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邀请码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="inviteCode" name="inviteCode"
|
||||
th:value="${author.inviteCode}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">笔名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="penName" name="penName"
|
||||
th:value="${author.penName}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">手机号码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="telPhone" name="telPhone"
|
||||
th:value="${author.telPhone}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ或微信账号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="chatAccount" name="chatAccount"
|
||||
th:value="${author.chatAccount}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">电子邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="email" name="email"
|
||||
th:value="${author.email}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">作品方向,0:男频,1:女频:</label>
|
||||
<div class="col-sm-8">
|
||||
|
||||
<select data-placeholder="--选择--" id="workDirection"
|
||||
name="workDirection"
|
||||
class="form-control chosen-select" tabindex="2"
|
||||
dict-type="work_direction"
|
||||
th:attr="dict-value=${author.workDirection}" >
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">入驻时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="laydate-icon layer-date form-control"
|
||||
id="createTime"
|
||||
name="createTime"
|
||||
th:value="${author.createTime}==null?null:${#dates.format(author.createTime,'yyyy-MM-dd HH:mm:ss')}"
|
||||
onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
|
||||
style="background-color: #fff;" readonly="readonly"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">0:正常,1:封禁:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="status" name="status"
|
||||
th:value="${author.status}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-8 col-sm-offset-3">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript" src="/wangEditor/release/wangEditor.js"></script>
|
||||
<script type="text/javascript" src="/js/appjs/novel/author/edit.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邀请码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="inviteCode" name="inviteCode"
|
||||
class="form-control"
|
||||
type="text">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">有效时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="laydate-icon layer-date form-control"
|
||||
id="validityTime"
|
||||
name="validityTime"
|
||||
onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
|
||||
style="background-color: #fff;" readonly="readonly"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-8 col-sm-offset-3">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript" src="/wangEditor/release/wangEditor.js"></script>
|
||||
<script type="text/javascript" src="/js/appjs/novel/authorCode/add.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-body">
|
||||
<div class="fixed-table-toolbar">
|
||||
<div class="columns pull-left">
|
||||
<button shiro:hasPermission="novel:authorCode:add" type="button"
|
||||
class="btn btn-primary" onclick="add()">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>添加
|
||||
</button>
|
||||
<button shiro:hasPermission="novel:authorCode:batchRemove" type="button"
|
||||
class="btn btn-danger"
|
||||
onclick="batchRemove()">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>删除
|
||||
</button>
|
||||
</div>
|
||||
<div class="columns pull-right">
|
||||
<button class="btn btn-success" onclick="reLoad()">查询</button>
|
||||
</div>
|
||||
|
||||
<form id="searchForm">
|
||||
<div class="columns pull-right col-md-2">
|
||||
<input id="inviteCode" name="inviteCode" type="text" class="form-control"
|
||||
placeholder="邀请码">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<table id="exampleTable" data-mobile-responsive="true">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--shiro控制bootstraptable行内按钮看见性 -->
|
||||
<div>
|
||||
<script type="text/javascript">
|
||||
var s_detail_h = 'hidden';
|
||||
var s_edit_h = 'hidden';
|
||||
var s_remove_h = 'hidden';
|
||||
</script>
|
||||
</div>
|
||||
<div shiro:hasPermission="test:order:detail">
|
||||
<script type="text/javascript">
|
||||
s_detail_h = '';
|
||||
</script>
|
||||
</div>
|
||||
<div shiro:hasPermission="novel:authorCode:edit">
|
||||
<script type="text/javascript">
|
||||
s_edit_h = '';
|
||||
</script>
|
||||
</div>
|
||||
<div shiro:hasPermission="novel:authorCode:remove">
|
||||
<script type="text/javascript">
|
||||
var s_remove_h = '';
|
||||
</script>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script type="text/javascript" src="/js/appjs/novel/authorCode/authorCode.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,70 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<input id="id" name="id" th:value="${authorCode.id}"
|
||||
type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邀请码:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${authorCode.inviteCode}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">有效时间:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${authorCode.validityTime}==null?null:${#dates.format(authorCode.validityTime,'yyyy-MM-dd HH:mm:ss')}">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否使用过,0:未使用,1:使用过:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${authorCode.isUse}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">创建时间:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${authorCode.createTime}==null?null:${#dates.format(authorCode.createTime,'yyyy-MM-dd HH:mm:ss')}">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">创建人ID:</label>
|
||||
|
||||
<div style="padding-top:8px" class="col-sm-8"
|
||||
th:text="${authorCode.createUserId}">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<input id="id" name="id" th:value="${authorCode.id}"
|
||||
type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邀请码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="inviteCode" name="inviteCode"
|
||||
th:value="${authorCode.inviteCode}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">有效时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="laydate-icon layer-date form-control"
|
||||
id="validityTime"
|
||||
name="validityTime"
|
||||
th:value="${authorCode.validityTime}==null?null:${#dates.format(authorCode.validityTime,'yyyy-MM-dd HH:mm:ss')}"
|
||||
onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
|
||||
style="background-color: #fff;" readonly="readonly"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否使用过,0:未使用,1:使用过:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="isUse" name="isUse"
|
||||
th:value="${authorCode.isUse}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">创建时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="laydate-icon layer-date form-control"
|
||||
id="createTime"
|
||||
name="createTime"
|
||||
th:value="${authorCode.createTime}==null?null:${#dates.format(authorCode.createTime,'yyyy-MM-dd HH:mm:ss')}"
|
||||
onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
|
||||
style="background-color: #fff;" readonly="readonly"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">创建人ID:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="createUserId" name="createUserId"
|
||||
th:value="${authorCode.createUserId}"
|
||||
class="form-control"
|
||||
type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-8 col-sm-offset-3">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript" src="/wangEditor/release/wangEditor.js"></script>
|
||||
<script type="text/javascript" src="/js/appjs/novel/authorCode/edit.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>1.1.0</version>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -43,12 +43,22 @@ public enum ResponseStatus {
|
||||
USERNAME_PASS_ERROR(1004,"手机号或密码错误!"),
|
||||
TWO_PASSWORD_DIFF(1005, "两次输入的新密码不匹配!"),
|
||||
OLD_PASSWORD_ERROR(1006, "旧密码不匹配!"),
|
||||
USER_NO_BALANCE(1007, "用户余额不足"),
|
||||
|
||||
/**
|
||||
* 评论相关错误
|
||||
* */
|
||||
HAS_COMMENTS(3001, "已评价过该书籍!"),
|
||||
|
||||
/**
|
||||
* 作者相关错误
|
||||
* */
|
||||
INVITE_CODE_INVALID(4001, "邀请码无效!"),
|
||||
AUTHOR_STATUS_FORBIDDEN(4002, "作者状态异常,暂不能管理小说!")
|
||||
, BOOKNAME_EXISTS(4003,"已发布过同名小说!")
|
||||
|
||||
,
|
||||
|
||||
|
||||
/**
|
||||
* 其他通用错误
|
||||
|
136
novel-common/src/main/java/com/java2nb/novel/entity/Author.java
Normal file
136
novel-common/src/main/java/com/java2nb/novel/entity/Author.java
Normal file
@ -0,0 +1,136 @@
|
||||
package com.java2nb.novel.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
public class Author {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String inviteCode;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String penName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String telPhone;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String chatAccount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String email;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte workDirection;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte status;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getInviteCode() {
|
||||
return inviteCode;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setInviteCode(String inviteCode) {
|
||||
this.inviteCode = inviteCode == null ? null : inviteCode.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getPenName() {
|
||||
return penName;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPenName(String penName) {
|
||||
this.penName = penName == null ? null : penName.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getTelPhone() {
|
||||
return telPhone;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setTelPhone(String telPhone) {
|
||||
this.telPhone = telPhone == null ? null : telPhone.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getChatAccount() {
|
||||
return chatAccount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setChatAccount(String chatAccount) {
|
||||
this.chatAccount = chatAccount == null ? null : chatAccount.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setEmail(String email) {
|
||||
this.email = email == null ? null : email.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getWorkDirection() {
|
||||
return workDirection;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setWorkDirection(Byte workDirection) {
|
||||
this.workDirection = workDirection;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setStatus(Byte status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.java2nb.novel.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
public class AuthorCode {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String inviteCode;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date validityTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte isUse;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long createUserId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getInviteCode() {
|
||||
return inviteCode;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setInviteCode(String inviteCode) {
|
||||
this.inviteCode = inviteCode == null ? null : inviteCode.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getValidityTime() {
|
||||
return validityTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setValidityTime(Date validityTime) {
|
||||
this.validityTime = validityTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getIsUse() {
|
||||
return isUse;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setIsUse(Byte isUse) {
|
||||
this.isUse = isUse;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package com.java2nb.novel.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
public class OrderPay {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long outTradeNo;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String tradeNo;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte payChannel;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Integer totalAmount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte payStatus;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setOutTradeNo(Long outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getTradeNo() {
|
||||
return tradeNo;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo == null ? null : tradeNo.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getPayChannel() {
|
||||
return payChannel;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPayChannel(Byte payChannel) {
|
||||
this.payChannel = payChannel;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Integer getTotalAmount() {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setTotalAmount(Integer totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getPayStatus() {
|
||||
return payStatus;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPayStatus(Byte payStatus) {
|
||||
this.payStatus = payStatus;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package com.java2nb.novel.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
public class UserBuyRecord {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long bookId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String bookName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long bookIndexId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String bookIndexName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Integer buyAmount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookId(Long bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getBookName() {
|
||||
return bookName;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookName(String bookName) {
|
||||
this.bookName = bookName == null ? null : bookName.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getBookIndexId() {
|
||||
return bookIndexId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookIndexId(Long bookIndexId) {
|
||||
this.bookIndexId = bookIndexId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getBookIndexName() {
|
||||
return bookIndexName;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookIndexName(String bookIndexName) {
|
||||
this.bookIndexName = bookIndexName == null ? null : bookIndexName.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Integer getBuyAmount() {
|
||||
return buyAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBuyAmount(Integer buyAmount) {
|
||||
this.buyAmount = buyAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.java2nb.novel.mapper;
|
||||
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
public final class AuthorCodeDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final AuthorCode authorCode = new AuthorCode();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = authorCode.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> inviteCode = authorCode.inviteCode;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> validityTime = authorCode.validityTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> isUse = authorCode.isUse;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = authorCode.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> createUserId = authorCode.createUserId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class AuthorCode extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> inviteCode = column("invite_code", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Date> validityTime = column("validity_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<Byte> isUse = column("is_use", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<Long> createUserId = column("create_user_id", JDBCType.BIGINT);
|
||||
|
||||
public AuthorCode() {
|
||||
super("author_code");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,200 @@
|
||||
package com.java2nb.novel.mapper;
|
||||
|
||||
import static com.java2nb.novel.mapper.AuthorCodeDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
|
||||
import com.java2nb.novel.entity.AuthorCode;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Generated;
|
||||
import org.apache.ibatis.annotations.DeleteProvider;
|
||||
import org.apache.ibatis.annotations.InsertProvider;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.apache.ibatis.annotations.UpdateProvider;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.BasicColumn;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateModel;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
||||
|
||||
@Mapper
|
||||
public interface AuthorCodeMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
BasicColumn[] selectList = BasicColumn.columnList(id, inviteCode, validityTime, isUse, createTime, createUserId);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<AuthorCode> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
|
||||
int insertMultiple(MultiRowInsertStatementProvider<AuthorCode> multipleInsertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("AuthorCodeResult")
|
||||
Optional<AuthorCode> selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="AuthorCodeResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="invite_code", property="inviteCode", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="validity_time", property="validityTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="is_use", property="isUse", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT)
|
||||
})
|
||||
List<AuthorCode> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default long count(CountDSLCompleter completer) {
|
||||
return MyBatis3Utils.countFrom(this::count, authorCode, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int delete(DeleteDSLCompleter completer) {
|
||||
return MyBatis3Utils.deleteFrom(this::delete, authorCode, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return delete(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(AuthorCode record) {
|
||||
return MyBatis3Utils.insert(this::insert, record, authorCode, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(inviteCode).toProperty("inviteCode")
|
||||
.map(validityTime).toProperty("validityTime")
|
||||
.map(isUse).toProperty("isUse")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(createUserId).toProperty("createUserId")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertMultiple(Collection<AuthorCode> records) {
|
||||
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, authorCode, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(inviteCode).toProperty("inviteCode")
|
||||
.map(validityTime).toProperty("validityTime")
|
||||
.map(isUse).toProperty("isUse")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(createUserId).toProperty("createUserId")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(AuthorCode record) {
|
||||
return MyBatis3Utils.insert(this::insert, record, authorCode, c ->
|
||||
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(inviteCode).toPropertyWhenPresent("inviteCode", record::getInviteCode)
|
||||
.map(validityTime).toPropertyWhenPresent("validityTime", record::getValidityTime)
|
||||
.map(isUse).toPropertyWhenPresent("isUse", record::getIsUse)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
.map(createUserId).toPropertyWhenPresent("createUserId", record::getCreateUserId)
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default Optional<AuthorCode> selectOne(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectOne(this::selectOne, selectList, authorCode, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default List<AuthorCode> select(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectList(this::selectMany, selectList, authorCode, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default List<AuthorCode> selectDistinct(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, authorCode, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default Optional<AuthorCode> selectByPrimaryKey(Long id_) {
|
||||
return selectOne(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int update(UpdateDSLCompleter completer) {
|
||||
return MyBatis3Utils.update(this::update, authorCode, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
static UpdateDSL<UpdateModel> updateAllColumns(AuthorCode record, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalTo(record::getId)
|
||||
.set(inviteCode).equalTo(record::getInviteCode)
|
||||
.set(validityTime).equalTo(record::getValidityTime)
|
||||
.set(isUse).equalTo(record::getIsUse)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(createUserId).equalTo(record::getCreateUserId);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
static UpdateDSL<UpdateModel> updateSelectiveColumns(AuthorCode record, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||
.set(inviteCode).equalToWhenPresent(record::getInviteCode)
|
||||
.set(validityTime).equalToWhenPresent(record::getValidityTime)
|
||||
.set(isUse).equalToWhenPresent(record::getIsUse)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(createUserId).equalToWhenPresent(record::getCreateUserId);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(AuthorCode record) {
|
||||
return update(c ->
|
||||
c.set(inviteCode).equalTo(record::getInviteCode)
|
||||
.set(validityTime).equalTo(record::getValidityTime)
|
||||
.set(isUse).equalTo(record::getIsUse)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(createUserId).equalTo(record::getCreateUserId)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(AuthorCode record) {
|
||||
return update(c ->
|
||||
c.set(inviteCode).equalToWhenPresent(record::getInviteCode)
|
||||
.set(validityTime).equalToWhenPresent(record::getValidityTime)
|
||||
.set(isUse).equalToWhenPresent(record::getIsUse)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.java2nb.novel.mapper;
|
||||
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
public final class AuthorDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final Author author = new Author();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = author.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> userId = author.userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> inviteCode = author.inviteCode;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> penName = author.penName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> telPhone = author.telPhone;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> chatAccount = author.chatAccount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> email = author.email;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> workDirection = author.workDirection;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> status = author.status;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = author.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class Author extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> inviteCode = column("invite_code", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> penName = column("pen_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> telPhone = column("tel_phone", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> chatAccount = column("chat_account", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> email = column("email", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Byte> workDirection = column("work_direction", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Byte> status = column("status", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public Author() {
|
||||
super("author");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,232 @@
|
||||
package com.java2nb.novel.mapper;
|
||||
|
||||
import static com.java2nb.novel.mapper.AuthorDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
|
||||
import com.java2nb.novel.entity.Author;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Generated;
|
||||
import org.apache.ibatis.annotations.DeleteProvider;
|
||||
import org.apache.ibatis.annotations.InsertProvider;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.apache.ibatis.annotations.UpdateProvider;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.BasicColumn;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateModel;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
||||
|
||||
@Mapper
|
||||
public interface AuthorMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
BasicColumn[] selectList = BasicColumn.columnList(id, userId, inviteCode, penName, telPhone, chatAccount, email, workDirection, status, createTime);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<Author> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
|
||||
int insertMultiple(MultiRowInsertStatementProvider<Author> multipleInsertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("AuthorResult")
|
||||
Optional<Author> selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="AuthorResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="invite_code", property="inviteCode", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="pen_name", property="penName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="tel_phone", property="telPhone", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="chat_account", property="chatAccount", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="work_direction", property="workDirection", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<Author> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default long count(CountDSLCompleter completer) {
|
||||
return MyBatis3Utils.countFrom(this::count, author, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int delete(DeleteDSLCompleter completer) {
|
||||
return MyBatis3Utils.deleteFrom(this::delete, author, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return delete(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(Author record) {
|
||||
return MyBatis3Utils.insert(this::insert, record, author, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(inviteCode).toProperty("inviteCode")
|
||||
.map(penName).toProperty("penName")
|
||||
.map(telPhone).toProperty("telPhone")
|
||||
.map(chatAccount).toProperty("chatAccount")
|
||||
.map(email).toProperty("email")
|
||||
.map(workDirection).toProperty("workDirection")
|
||||
.map(status).toProperty("status")
|
||||
.map(createTime).toProperty("createTime")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertMultiple(Collection<Author> records) {
|
||||
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, author, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(inviteCode).toProperty("inviteCode")
|
||||
.map(penName).toProperty("penName")
|
||||
.map(telPhone).toProperty("telPhone")
|
||||
.map(chatAccount).toProperty("chatAccount")
|
||||
.map(email).toProperty("email")
|
||||
.map(workDirection).toProperty("workDirection")
|
||||
.map(status).toProperty("status")
|
||||
.map(createTime).toProperty("createTime")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(Author record) {
|
||||
return MyBatis3Utils.insert(this::insert, record, author, c ->
|
||||
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||
.map(inviteCode).toPropertyWhenPresent("inviteCode", record::getInviteCode)
|
||||
.map(penName).toPropertyWhenPresent("penName", record::getPenName)
|
||||
.map(telPhone).toPropertyWhenPresent("telPhone", record::getTelPhone)
|
||||
.map(chatAccount).toPropertyWhenPresent("chatAccount", record::getChatAccount)
|
||||
.map(email).toPropertyWhenPresent("email", record::getEmail)
|
||||
.map(workDirection).toPropertyWhenPresent("workDirection", record::getWorkDirection)
|
||||
.map(status).toPropertyWhenPresent("status", record::getStatus)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default Optional<Author> selectOne(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectOne(this::selectOne, selectList, author, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default List<Author> select(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectList(this::selectMany, selectList, author, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default List<Author> selectDistinct(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, author, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default Optional<Author> selectByPrimaryKey(Long id_) {
|
||||
return selectOne(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int update(UpdateDSLCompleter completer) {
|
||||
return MyBatis3Utils.update(this::update, author, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
static UpdateDSL<UpdateModel> updateAllColumns(Author record, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalTo(record::getId)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(inviteCode).equalTo(record::getInviteCode)
|
||||
.set(penName).equalTo(record::getPenName)
|
||||
.set(telPhone).equalTo(record::getTelPhone)
|
||||
.set(chatAccount).equalTo(record::getChatAccount)
|
||||
.set(email).equalTo(record::getEmail)
|
||||
.set(workDirection).equalTo(record::getWorkDirection)
|
||||
.set(status).equalTo(record::getStatus)
|
||||
.set(createTime).equalTo(record::getCreateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
static UpdateDSL<UpdateModel> updateSelectiveColumns(Author record, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(inviteCode).equalToWhenPresent(record::getInviteCode)
|
||||
.set(penName).equalToWhenPresent(record::getPenName)
|
||||
.set(telPhone).equalToWhenPresent(record::getTelPhone)
|
||||
.set(chatAccount).equalToWhenPresent(record::getChatAccount)
|
||||
.set(email).equalToWhenPresent(record::getEmail)
|
||||
.set(workDirection).equalToWhenPresent(record::getWorkDirection)
|
||||
.set(status).equalToWhenPresent(record::getStatus)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(Author record) {
|
||||
return update(c ->
|
||||
c.set(userId).equalTo(record::getUserId)
|
||||
.set(inviteCode).equalTo(record::getInviteCode)
|
||||
.set(penName).equalTo(record::getPenName)
|
||||
.set(telPhone).equalTo(record::getTelPhone)
|
||||
.set(chatAccount).equalTo(record::getChatAccount)
|
||||
.set(email).equalTo(record::getEmail)
|
||||
.set(workDirection).equalTo(record::getWorkDirection)
|
||||
.set(status).equalTo(record::getStatus)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(Author record) {
|
||||
return update(c ->
|
||||
c.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(inviteCode).equalToWhenPresent(record::getInviteCode)
|
||||
.set(penName).equalToWhenPresent(record::getPenName)
|
||||
.set(telPhone).equalToWhenPresent(record::getTelPhone)
|
||||
.set(chatAccount).equalToWhenPresent(record::getChatAccount)
|
||||
.set(email).equalToWhenPresent(record::getEmail)
|
||||
.set(workDirection).equalToWhenPresent(record::getWorkDirection)
|
||||
.set(status).equalToWhenPresent(record::getStatus)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.java2nb.novel.mapper;
|
||||
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
public final class OrderPayDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final OrderPay orderPay = new OrderPay();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = orderPay.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> outTradeNo = orderPay.outTradeNo;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> tradeNo = orderPay.tradeNo;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> payChannel = orderPay.payChannel;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Integer> totalAmount = orderPay.totalAmount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> userId = orderPay.userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> payStatus = orderPay.payStatus;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = orderPay.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> updateTime = orderPay.updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class OrderPay extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> outTradeNo = column("out_trade_no", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> tradeNo = column("trade_no", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Byte> payChannel = column("pay_channel", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Integer> totalAmount = column("total_amount", JDBCType.INTEGER);
|
||||
|
||||
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Byte> payStatus = column("pay_status", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public OrderPay() {
|
||||
super("order_pay");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,224 @@
|
||||
package com.java2nb.novel.mapper;
|
||||
|
||||
import static com.java2nb.novel.mapper.OrderPayDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
|
||||
import com.java2nb.novel.entity.OrderPay;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Generated;
|
||||
import org.apache.ibatis.annotations.DeleteProvider;
|
||||
import org.apache.ibatis.annotations.InsertProvider;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.apache.ibatis.annotations.UpdateProvider;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.BasicColumn;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateModel;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
||||
|
||||
@Mapper
|
||||
public interface OrderPayMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
BasicColumn[] selectList = BasicColumn.columnList(id, outTradeNo, tradeNo, payChannel, totalAmount, userId, payStatus, createTime, updateTime);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<OrderPay> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
|
||||
int insertMultiple(MultiRowInsertStatementProvider<OrderPay> multipleInsertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("OrderPayResult")
|
||||
Optional<OrderPay> selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="OrderPayResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="trade_no", property="tradeNo", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="pay_channel", property="payChannel", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="total_amount", property="totalAmount", jdbcType=JdbcType.INTEGER),
|
||||
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="pay_status", property="payStatus", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<OrderPay> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default long count(CountDSLCompleter completer) {
|
||||
return MyBatis3Utils.countFrom(this::count, orderPay, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int delete(DeleteDSLCompleter completer) {
|
||||
return MyBatis3Utils.deleteFrom(this::delete, orderPay, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return delete(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(OrderPay record) {
|
||||
return MyBatis3Utils.insert(this::insert, record, orderPay, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(outTradeNo).toProperty("outTradeNo")
|
||||
.map(tradeNo).toProperty("tradeNo")
|
||||
.map(payChannel).toProperty("payChannel")
|
||||
.map(totalAmount).toProperty("totalAmount")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(payStatus).toProperty("payStatus")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(updateTime).toProperty("updateTime")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertMultiple(Collection<OrderPay> records) {
|
||||
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, orderPay, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(outTradeNo).toProperty("outTradeNo")
|
||||
.map(tradeNo).toProperty("tradeNo")
|
||||
.map(payChannel).toProperty("payChannel")
|
||||
.map(totalAmount).toProperty("totalAmount")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(payStatus).toProperty("payStatus")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(updateTime).toProperty("updateTime")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(OrderPay record) {
|
||||
return MyBatis3Utils.insert(this::insert, record, orderPay, c ->
|
||||
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(outTradeNo).toPropertyWhenPresent("outTradeNo", record::getOutTradeNo)
|
||||
.map(tradeNo).toPropertyWhenPresent("tradeNo", record::getTradeNo)
|
||||
.map(payChannel).toPropertyWhenPresent("payChannel", record::getPayChannel)
|
||||
.map(totalAmount).toPropertyWhenPresent("totalAmount", record::getTotalAmount)
|
||||
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||
.map(payStatus).toPropertyWhenPresent("payStatus", record::getPayStatus)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
.map(updateTime).toPropertyWhenPresent("updateTime", record::getUpdateTime)
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default Optional<OrderPay> selectOne(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectOne(this::selectOne, selectList, orderPay, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default List<OrderPay> select(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectList(this::selectMany, selectList, orderPay, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default List<OrderPay> selectDistinct(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, orderPay, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default Optional<OrderPay> selectByPrimaryKey(Long id_) {
|
||||
return selectOne(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int update(UpdateDSLCompleter completer) {
|
||||
return MyBatis3Utils.update(this::update, orderPay, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
static UpdateDSL<UpdateModel> updateAllColumns(OrderPay record, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalTo(record::getId)
|
||||
.set(outTradeNo).equalTo(record::getOutTradeNo)
|
||||
.set(tradeNo).equalTo(record::getTradeNo)
|
||||
.set(payChannel).equalTo(record::getPayChannel)
|
||||
.set(totalAmount).equalTo(record::getTotalAmount)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(payStatus).equalTo(record::getPayStatus)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
static UpdateDSL<UpdateModel> updateSelectiveColumns(OrderPay record, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||
.set(outTradeNo).equalToWhenPresent(record::getOutTradeNo)
|
||||
.set(tradeNo).equalToWhenPresent(record::getTradeNo)
|
||||
.set(payChannel).equalToWhenPresent(record::getPayChannel)
|
||||
.set(totalAmount).equalToWhenPresent(record::getTotalAmount)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(payStatus).equalToWhenPresent(record::getPayStatus)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(OrderPay record) {
|
||||
return update(c ->
|
||||
c.set(outTradeNo).equalTo(record::getOutTradeNo)
|
||||
.set(tradeNo).equalTo(record::getTradeNo)
|
||||
.set(payChannel).equalTo(record::getPayChannel)
|
||||
.set(totalAmount).equalTo(record::getTotalAmount)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(payStatus).equalTo(record::getPayStatus)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(OrderPay record) {
|
||||
return update(c ->
|
||||
c.set(outTradeNo).equalToWhenPresent(record::getOutTradeNo)
|
||||
.set(tradeNo).equalToWhenPresent(record::getTradeNo)
|
||||
.set(payChannel).equalToWhenPresent(record::getPayChannel)
|
||||
.set(totalAmount).equalToWhenPresent(record::getTotalAmount)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(payStatus).equalToWhenPresent(record::getPayStatus)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.java2nb.novel.mapper;
|
||||
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
public final class UserBuyRecordDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final UserBuyRecord userBuyRecord = new UserBuyRecord();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = userBuyRecord.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> userId = userBuyRecord.userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> bookId = userBuyRecord.bookId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> bookName = userBuyRecord.bookName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> bookIndexId = userBuyRecord.bookIndexId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> bookIndexName = userBuyRecord.bookIndexName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Integer> buyAmount = userBuyRecord.buyAmount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = userBuyRecord.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class UserBuyRecord extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> bookId = column("book_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> bookName = column("book_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Long> bookIndexId = column("book_index_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> bookIndexName = column("book_index_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Integer> buyAmount = column("buy_amount", JDBCType.INTEGER);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public UserBuyRecord() {
|
||||
super("user_buy_record");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,216 @@
|
||||
package com.java2nb.novel.mapper;
|
||||
|
||||
import static com.java2nb.novel.mapper.UserBuyRecordDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
|
||||
import com.java2nb.novel.entity.UserBuyRecord;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Generated;
|
||||
import org.apache.ibatis.annotations.DeleteProvider;
|
||||
import org.apache.ibatis.annotations.InsertProvider;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.apache.ibatis.annotations.UpdateProvider;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.BasicColumn;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateModel;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
||||
|
||||
@Mapper
|
||||
public interface UserBuyRecordMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
BasicColumn[] selectList = BasicColumn.columnList(id, userId, bookId, bookName, bookIndexId, bookIndexName, buyAmount, createTime);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<UserBuyRecord> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
|
||||
int insertMultiple(MultiRowInsertStatementProvider<UserBuyRecord> multipleInsertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("UserBuyRecordResult")
|
||||
Optional<UserBuyRecord> selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="UserBuyRecordResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="book_name", property="bookName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="book_index_id", property="bookIndexId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="book_index_name", property="bookIndexName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="buy_amount", property="buyAmount", jdbcType=JdbcType.INTEGER),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<UserBuyRecord> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default long count(CountDSLCompleter completer) {
|
||||
return MyBatis3Utils.countFrom(this::count, userBuyRecord, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int delete(DeleteDSLCompleter completer) {
|
||||
return MyBatis3Utils.deleteFrom(this::delete, userBuyRecord, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return delete(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(UserBuyRecord record) {
|
||||
return MyBatis3Utils.insert(this::insert, record, userBuyRecord, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(bookId).toProperty("bookId")
|
||||
.map(bookName).toProperty("bookName")
|
||||
.map(bookIndexId).toProperty("bookIndexId")
|
||||
.map(bookIndexName).toProperty("bookIndexName")
|
||||
.map(buyAmount).toProperty("buyAmount")
|
||||
.map(createTime).toProperty("createTime")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertMultiple(Collection<UserBuyRecord> records) {
|
||||
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, userBuyRecord, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(bookId).toProperty("bookId")
|
||||
.map(bookName).toProperty("bookName")
|
||||
.map(bookIndexId).toProperty("bookIndexId")
|
||||
.map(bookIndexName).toProperty("bookIndexName")
|
||||
.map(buyAmount).toProperty("buyAmount")
|
||||
.map(createTime).toProperty("createTime")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(UserBuyRecord record) {
|
||||
return MyBatis3Utils.insert(this::insert, record, userBuyRecord, c ->
|
||||
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
|
||||
.map(bookName).toPropertyWhenPresent("bookName", record::getBookName)
|
||||
.map(bookIndexId).toPropertyWhenPresent("bookIndexId", record::getBookIndexId)
|
||||
.map(bookIndexName).toPropertyWhenPresent("bookIndexName", record::getBookIndexName)
|
||||
.map(buyAmount).toPropertyWhenPresent("buyAmount", record::getBuyAmount)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default Optional<UserBuyRecord> selectOne(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectOne(this::selectOne, selectList, userBuyRecord, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default List<UserBuyRecord> select(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectList(this::selectMany, selectList, userBuyRecord, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default List<UserBuyRecord> selectDistinct(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, userBuyRecord, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default Optional<UserBuyRecord> selectByPrimaryKey(Long id_) {
|
||||
return selectOne(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int update(UpdateDSLCompleter completer) {
|
||||
return MyBatis3Utils.update(this::update, userBuyRecord, completer);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
static UpdateDSL<UpdateModel> updateAllColumns(UserBuyRecord record, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalTo(record::getId)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(bookId).equalTo(record::getBookId)
|
||||
.set(bookName).equalTo(record::getBookName)
|
||||
.set(bookIndexId).equalTo(record::getBookIndexId)
|
||||
.set(bookIndexName).equalTo(record::getBookIndexName)
|
||||
.set(buyAmount).equalTo(record::getBuyAmount)
|
||||
.set(createTime).equalTo(record::getCreateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
static UpdateDSL<UpdateModel> updateSelectiveColumns(UserBuyRecord record, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||
.set(bookName).equalToWhenPresent(record::getBookName)
|
||||
.set(bookIndexId).equalToWhenPresent(record::getBookIndexId)
|
||||
.set(bookIndexName).equalToWhenPresent(record::getBookIndexName)
|
||||
.set(buyAmount).equalToWhenPresent(record::getBuyAmount)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(UserBuyRecord record) {
|
||||
return update(c ->
|
||||
c.set(userId).equalTo(record::getUserId)
|
||||
.set(bookId).equalTo(record::getBookId)
|
||||
.set(bookName).equalTo(record::getBookName)
|
||||
.set(bookIndexId).equalTo(record::getBookIndexId)
|
||||
.set(bookIndexName).equalTo(record::getBookIndexName)
|
||||
.set(buyAmount).equalTo(record::getBuyAmount)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(UserBuyRecord record) {
|
||||
return update(c ->
|
||||
c.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||
.set(bookName).equalToWhenPresent(record::getBookName)
|
||||
.set(bookIndexId).equalToWhenPresent(record::getBookIndexId)
|
||||
.set(bookIndexName).equalToWhenPresent(record::getBookIndexName)
|
||||
.set(buyAmount).equalToWhenPresent(record::getBuyAmount)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
);
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ spring:
|
||||
profiles:
|
||||
include: [common]
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/novel_biz?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
@ -8,7 +8,7 @@
|
||||
<property name="suppressAllComments" value="true" />
|
||||
</commentGenerator>
|
||||
<jdbcConnection
|
||||
connectionURL="jdbc:mysql://127.0.0.1:3306/novel_biz?tinyInt1isBit=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true"
|
||||
connectionURL="jdbc:mysql://127.0.0.1:3306/novel_plus?tinyInt1isBit=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true"
|
||||
driverClass="com.mysql.jdbc.Driver" password=""
|
||||
userId="root" />
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
</javaClientGenerator>
|
||||
|
||||
<!--生成全部表tableName设为%-->
|
||||
<table tableName="crawl_source" domainObjectName="CrawlSource"/>
|
||||
<table tableName="user_buy_record" domainObjectName="UserBuyRecord"/>
|
||||
|
||||
<!-- 指定数据库表 -->
|
||||
<!--<table schema="jly" tableName="job_position" domainObjectName="JobPositionTest"/>-->
|
||||
|
6
novel-crawl/Dockerfile
Normal file
6
novel-crawl/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM java:8
|
||||
ADD novel-crawl-1.1.0.jar /root
|
||||
ENV dburl=""
|
||||
ENV username=""
|
||||
ENV password=""
|
||||
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${dburl} -Dspring.datasource.username=${username} -Dspring.datasource.password=${password} -jar /root/novel-crawl-1.1.0.jar"]
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>1.1.0</version>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
6
novel-front/Dockerfile
Normal file
6
novel-front/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM java:8
|
||||
ADD novel-front-1.1.0.jar /root
|
||||
ENV dburl=""
|
||||
ENV username=""
|
||||
ENV password=""
|
||||
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${dburl} -Dspring.datasource.username=${username} -Dspring.datasource.password=${password} -jar /root/novel-front-1.1.0.jar"]
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>1.1.0</version>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,6 +26,13 @@
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>${jjwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.9.153.ALL</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -0,0 +1,121 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.java2nb.novel.core.bean.ResultBean;
|
||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||
import com.java2nb.novel.core.utils.BeanUtil;
|
||||
import com.java2nb.novel.entity.Author;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.service.AuthorService;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.service.FriendLinkService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
@RequestMapping("author")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AuthorController extends BaseController{
|
||||
|
||||
private final AuthorService authorService;
|
||||
|
||||
private final BookService bookService;
|
||||
|
||||
/**
|
||||
* 校验笔名是否存在
|
||||
* */
|
||||
@PostMapping("checkPenName")
|
||||
public ResultBean checkPenName(String penName){
|
||||
|
||||
return ResultBean.ok(authorService.checkPenName(penName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作家发布小说分页列表查询
|
||||
* */
|
||||
@PostMapping("listBookByPage")
|
||||
public ResultBean listBookByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize ,HttpServletRequest request){
|
||||
|
||||
return ResultBean.ok(new PageInfo<>(bookService.listBookPageByUserId(getUserDetails(request).getId(),page,pageSize)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布小说
|
||||
* */
|
||||
@PostMapping("addBook")
|
||||
public ResultBean addBook(Book book,HttpServletRequest request){
|
||||
|
||||
//查询作家信息
|
||||
Author author = authorService.queryAuthor(getUserDetails(request).getId());
|
||||
|
||||
//判断作者状态是否正常
|
||||
if(author.getStatus()==1){
|
||||
//封禁状态,不能发布小说
|
||||
return ResultBean.fail(ResponseStatus.AUTHOR_STATUS_FORBIDDEN);
|
||||
|
||||
}
|
||||
|
||||
//发布小说
|
||||
bookService.addBook(book,author.getId(),author.getPenName());
|
||||
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新小说状态,上架或下架
|
||||
* */
|
||||
@PostMapping("updateBookStatus")
|
||||
public ResultBean updateBookStatus(Long bookId,Byte status,HttpServletRequest request){
|
||||
//查询作家信息
|
||||
Author author = authorService.queryAuthor(getUserDetails(request).getId());
|
||||
|
||||
//判断作者状态是否正常
|
||||
if(author.getStatus()==1){
|
||||
//封禁状态,不能发布小说
|
||||
return ResultBean.fail(ResponseStatus.AUTHOR_STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
//更新小说状态,上架或下架
|
||||
bookService.updateBookStatus(bookId,status,author.getId());
|
||||
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发布章节内容
|
||||
* */
|
||||
@PostMapping("addBookContent")
|
||||
public ResultBean addBookContent(Long bookId,String indexName,String content,HttpServletRequest request){
|
||||
//查询作家信息
|
||||
Author author = authorService.queryAuthor(getUserDetails(request).getId());
|
||||
|
||||
//判断作者状态是否正常
|
||||
if(author.getStatus()==1){
|
||||
//封禁状态,不能发布小说
|
||||
return ResultBean.fail(ResponseStatus.AUTHOR_STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
//发布章节内容
|
||||
bookService.addBookContent(bookId,indexName,content,author.getId());
|
||||
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -116,7 +116,11 @@ public class BookController extends BaseController{
|
||||
public ResultBean queryBookIndexAbout(Long bookId,Long lastBookIndexId) {
|
||||
Map<String,Object> data = new HashMap<>(2);
|
||||
data.put("bookIndexCount",bookService.queryIndexCount(bookId));
|
||||
data.put("lastBookContent",bookService.queryBookContent(lastBookIndexId).getContent().substring(0,42));
|
||||
String lastBookContent = bookService.queryBookContent(lastBookIndexId).getContent();
|
||||
if(lastBookContent.length()>42){
|
||||
lastBookContent=lastBookContent.substring(0,42);
|
||||
}
|
||||
data.put("lastBookContent",lastBookContent);
|
||||
return ResultBean.ok(data);
|
||||
}
|
||||
|
||||
@ -161,4 +165,6 @@ public class BookController extends BaseController{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,19 +1,24 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import com.java2nb.novel.core.bean.ResultBean;
|
||||
import com.java2nb.novel.core.bean.UserDetails;
|
||||
import com.java2nb.novel.core.utils.ThreadLocalUtil;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.entity.BookContent;
|
||||
import com.java2nb.novel.entity.BookIndex;
|
||||
import com.java2nb.novel.entity.News;
|
||||
import com.java2nb.novel.entity.*;
|
||||
import com.java2nb.novel.service.AuthorService;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.service.NewsService;
|
||||
import com.java2nb.novel.service.UserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -22,12 +27,16 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Controller
|
||||
public class PageController{
|
||||
public class PageController extends BaseController{
|
||||
|
||||
private final BookService bookService;
|
||||
|
||||
private final NewsService newsService;
|
||||
|
||||
private final AuthorService authorService;
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
|
||||
@RequestMapping("{url}.html")
|
||||
public String module(@PathVariable("url") String url) {
|
||||
@ -35,7 +44,22 @@ public class PageController{
|
||||
}
|
||||
|
||||
@RequestMapping("{module}/{url}.html")
|
||||
public String module2(@PathVariable("module") String module, @PathVariable("url") String url) {
|
||||
public String module2(@PathVariable("module") String module, @PathVariable("url") String url,HttpServletRequest request) {
|
||||
|
||||
if(request.getRequestURI().startsWith("/author")) {
|
||||
//访问作者专区
|
||||
UserDetails user = getUserDetails(request);
|
||||
if (user == null) {
|
||||
//未登录
|
||||
return "redirect:/user/login.html?originUrl=" + request.getRequestURI();
|
||||
}
|
||||
|
||||
boolean isAuthor = authorService.isAuthor(user.getId());
|
||||
if (!isAuthor) {
|
||||
return "redirect:/author/register.html" ;
|
||||
}
|
||||
}
|
||||
|
||||
return module + "/" + url;
|
||||
}
|
||||
|
||||
@ -100,7 +124,7 @@ public class PageController{
|
||||
* 内容页
|
||||
* */
|
||||
@RequestMapping("/book/{bookId}/{bookIndexId}.html")
|
||||
public String indexList(@PathVariable("bookId") Long bookId,@PathVariable("bookIndexId") Long bookIndexId, Model model) {
|
||||
public String indexList(@PathVariable("bookId") Long bookId,@PathVariable("bookIndexId") Long bookIndexId, HttpServletRequest request,Model model) {
|
||||
//查询书籍
|
||||
Book book = bookService.queryBookDetail(bookId);
|
||||
model.addAttribute("book",book);
|
||||
@ -116,6 +140,23 @@ public class PageController{
|
||||
//查询内容
|
||||
BookContent bookContent = bookService.queryBookContent(bookIndex.getId());
|
||||
model.addAttribute("bookContent",bookContent);
|
||||
//判断该目录是否收费
|
||||
if(bookIndex.getIsVip()!=null && bookIndex.getIsVip() == 1 ){
|
||||
UserDetails user = getUserDetails(request);
|
||||
if(user == null){
|
||||
//未登录
|
||||
return "redirect:/user/login.html?originUrl="+request.getRequestURI();
|
||||
}
|
||||
//收费,判断用户是否购买过该目录
|
||||
boolean isBuy = userService.queryIsBuyBookIndex(user.getId(),bookIndexId);
|
||||
if(!isBuy){
|
||||
//没有购买过,需要购买
|
||||
bookContent.setContent(null);
|
||||
model.addAttribute("needBuy",true);
|
||||
return "book/book_content";
|
||||
}
|
||||
}
|
||||
model.addAttribute("needBuy",false);
|
||||
return ThreadLocalUtil.getTemplateDir()+"book/book_content";
|
||||
}
|
||||
|
||||
@ -141,4 +182,30 @@ public class PageController{
|
||||
return "about/news_info";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作者注册页面
|
||||
* */
|
||||
@RequestMapping("author/register.html")
|
||||
public String authorRegister(Author author, HttpServletRequest request, Model model){
|
||||
UserDetails user = getUserDetails(request);
|
||||
if(user == null){
|
||||
//未登录
|
||||
return "redirect:/user/login.html?originUrl=/author/register.html";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(author.getInviteCode())) {
|
||||
//提交作者注册信息
|
||||
String errorInfo = authorService.register(user.getId(), author);
|
||||
if(StringUtils.isBlank(errorInfo)){
|
||||
//注册成功
|
||||
return "redirect:/author/index.html";
|
||||
}
|
||||
model.addAttribute("LabErr",errorInfo);
|
||||
model.addAttribute("author",author);
|
||||
}
|
||||
return "author/register";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,153 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.internal.util.AlipaySignature;
|
||||
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||
import com.java2nb.novel.core.bean.UserDetails;
|
||||
import com.java2nb.novel.core.config.AlipayConfig;
|
||||
import com.java2nb.novel.service.OrderService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("pay")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PayController extends BaseController {
|
||||
|
||||
|
||||
private final AlipayConfig alipayConfig;
|
||||
|
||||
private final OrderService orderService;
|
||||
|
||||
|
||||
/**
|
||||
* 支付宝支付
|
||||
*/
|
||||
@SneakyThrows
|
||||
@PostMapping("aliPay")
|
||||
public void aliPay(Integer payAmount,HttpServletRequest request,HttpServletResponse httpResponse) {
|
||||
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
//未登录,跳转到登陆页面
|
||||
httpResponse.sendRedirect("/user/login.html?originUrl=/pay/aliPay?payAmount="+payAmount);
|
||||
return;
|
||||
}else {
|
||||
//创建充值订单
|
||||
Long outTradeNo = orderService.createPayOrder((byte)1,payAmount,userDetails.getId());
|
||||
|
||||
//获得初始化的AlipayClient
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig.getGatewayUrl(), alipayConfig.getAppId(), alipayConfig.getMerchantPrivateKey(), "json", alipayConfig.getCharset(), alipayConfig.getPublicKey(), alipayConfig.getSignType());
|
||||
//创建API对应的request
|
||||
AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();
|
||||
alipayRequest.setReturnUrl(alipayConfig.getReturnUrl());
|
||||
//在公共参数中设置回跳和通知地址
|
||||
alipayRequest.setNotifyUrl(alipayConfig.getNotifyUrl());
|
||||
//填充业务参数
|
||||
alipayRequest.setBizContent("{" +
|
||||
" \"out_trade_no\":\"" + outTradeNo + "\"," +
|
||||
" \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," +
|
||||
" \"total_amount\":" + payAmount + "," +
|
||||
" \"subject\":\"小说精品屋-plus\"" +
|
||||
" }");
|
||||
//调用SDK生成表单
|
||||
String form = alipayClient.pageExecute(alipayRequest).getBody();
|
||||
|
||||
httpResponse.setContentType("text/html;charset=utf-8");
|
||||
//直接将完整的表单html输出到页面
|
||||
httpResponse.getWriter().write(form);
|
||||
httpResponse.getWriter().flush();
|
||||
httpResponse.getWriter().close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝支付通知
|
||||
* */
|
||||
@SneakyThrows
|
||||
@RequestMapping("aliPay/notify")
|
||||
public void aliPayNotify(HttpServletRequest request,HttpServletResponse httpResponse){
|
||||
|
||||
|
||||
PrintWriter out = httpResponse.getWriter();
|
||||
|
||||
//获取支付宝POST过来反馈信息
|
||||
Map<String,String> params = new HashMap<String,String>();
|
||||
Map<String,String[]> requestParams = request.getParameterMap();
|
||||
for (Iterator<String> iter = requestParams.keySet().iterator(); iter.hasNext();) {
|
||||
String name = (String) iter.next();
|
||||
String[] values = (String[]) requestParams.get(name);
|
||||
String valueStr = "";
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
valueStr = (i == values.length - 1) ? valueStr + values[i]
|
||||
: valueStr + values[i] + ",";
|
||||
}
|
||||
params.put(name, valueStr);
|
||||
}
|
||||
|
||||
//调用SDK验证签名
|
||||
boolean signVerified = AlipaySignature.rsaCheckV1(params, alipayConfig.getPublicKey(), alipayConfig.getCharset(), alipayConfig.getSignType());
|
||||
|
||||
//——请在这里编写您的程序(以下代码仅作参考)——
|
||||
|
||||
/* 实际验证过程建议商户务必添加以下校验:
|
||||
1、需要验证该通知数据中的out_trade_no是否为商户系统中创建的订单号,
|
||||
2、判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额),
|
||||
3、校验通知中的seller_id(或者seller_email) 是否为out_trade_no这笔单据的对应的操作方(有的时候,一个商户可能有多个seller_id/seller_email)
|
||||
4、验证app_id是否为该商户本身。
|
||||
*/
|
||||
if(signVerified) {
|
||||
//验证成功
|
||||
//商户订单号
|
||||
String outTradeNo = new String(request.getParameter("out_trade_no").getBytes("ISO-8859-1"),"UTF-8");
|
||||
|
||||
//支付宝交易号
|
||||
String tradeNo = new String(request.getParameter("trade_no").getBytes("ISO-8859-1"),"UTF-8");
|
||||
|
||||
//交易状态
|
||||
String tradeStatus = new String(request.getParameter("trade_status").getBytes("ISO-8859-1"),"UTF-8");
|
||||
|
||||
//更新订单状态
|
||||
orderService.updatePayOrder(Long.parseLong(outTradeNo), tradeNo, tradeStatus);
|
||||
|
||||
|
||||
out.println("success");
|
||||
|
||||
}else {//验证失败
|
||||
out.println("fail");
|
||||
|
||||
//调试用,写文本函数记录程序运行情况是否正常
|
||||
//String sWord = AlipaySignature.getSignCheckContentV1(params);
|
||||
//AlipayConfig.logResult(sWord);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -7,6 +7,7 @@ import com.java2nb.novel.core.cache.CacheService;
|
||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||
import com.java2nb.novel.core.utils.RandomValidateCodeUtil;
|
||||
import com.java2nb.novel.entity.User;
|
||||
import com.java2nb.novel.entity.UserBuyRecord;
|
||||
import com.java2nb.novel.form.UserForm;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.service.UserService;
|
||||
@ -264,6 +265,21 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 购买小说章节
|
||||
* */
|
||||
@PostMapping("buyBookIndex")
|
||||
public ResultBean buyBookIndex(UserBuyRecord buyRecord, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
userService.buyBookIndex(userDetails.getId(),buyRecord);
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.java2nb.novel.core.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix="alipay")
|
||||
public class AlipayConfig {
|
||||
|
||||
private String appId;
|
||||
private String merchantPrivateKey;
|
||||
private String publicKey;
|
||||
private String notifyUrl;
|
||||
private String returnUrl;
|
||||
private String signType;
|
||||
private String charset;
|
||||
private String gatewayUrl;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.java2nb.novel.service;
|
||||
|
||||
|
||||
import com.java2nb.novel.entity.Author;
|
||||
import com.java2nb.novel.entity.FriendLink;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
public interface AuthorService {
|
||||
|
||||
/**
|
||||
* 校验笔名是否存在
|
||||
* @param penName 校验的笔名
|
||||
* @return true:存在该笔名,false: 不存在该笔名
|
||||
* */
|
||||
Boolean checkPenName(String penName);
|
||||
|
||||
/**
|
||||
* 作家注册
|
||||
* @param userId 注册用户ID
|
||||
*@param author 注册信息
|
||||
* @return 返回错误信息
|
||||
* */
|
||||
String register(Long userId, Author author);
|
||||
|
||||
/**
|
||||
* 判断是否是作家
|
||||
* @param userId 用户ID
|
||||
* @return true:是作家,false: 不是作家
|
||||
* */
|
||||
Boolean isAuthor(Long userId);
|
||||
|
||||
/**
|
||||
* 查询作家信息
|
||||
* @param userId 用户ID
|
||||
* @return 作家对象
|
||||
* */
|
||||
Author queryAuthor(Long userId);
|
||||
}
|
@ -191,4 +191,37 @@ public interface BookService {
|
||||
* @param bookId 小说ID
|
||||
*/
|
||||
void updateBookPicToLocal(String picUrl, Long bookId);
|
||||
|
||||
/**
|
||||
* 通过作者ID查询小说分页列表
|
||||
* @param userId 用户ID
|
||||
* @param page 页码
|
||||
* @param pageSize 分页大小
|
||||
* */
|
||||
List<Book> listBookPageByUserId(Long userId, int page, int pageSize);
|
||||
|
||||
/**
|
||||
* 发布小说
|
||||
* @param book 小说信息
|
||||
* @param authorId 作家ID
|
||||
* @param penName 作家笔名
|
||||
* */
|
||||
void addBook(Book book, Long authorId, String penName);
|
||||
|
||||
/**
|
||||
* 更新小说状态,上架或下架
|
||||
* @param bookId 小说ID
|
||||
* @param status 更新的状态
|
||||
* @param authorId 作者ID
|
||||
* */
|
||||
void updateBookStatus(Long bookId, Byte status, Long authorId);
|
||||
|
||||
/**
|
||||
* 发布章节内容
|
||||
* @param bookId 小说ID
|
||||
* @param indexName 章节名
|
||||
* @param content 章节内容
|
||||
* @param authorId 作者ID
|
||||
* */
|
||||
void addBookContent(Long bookId, String indexName, String content, Long authorId);
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.java2nb.novel.service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
public interface OrderService {
|
||||
|
||||
|
||||
/**
|
||||
* 创建充值订单
|
||||
*
|
||||
* @param payChannel 支付渠道
|
||||
* @param payAmount 支付金额
|
||||
* @param userId 用户ID
|
||||
* @return 商户订单号
|
||||
* */
|
||||
Long createPayOrder(Byte payChannel, Integer payAmount, Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 更新订单状态
|
||||
* @param outTradeNo 商户订单号
|
||||
* @param tradeNo 支付宝/微信 订单号
|
||||
* @param tradeStatus 支付状态
|
||||
* */
|
||||
void updatePayOrder(Long outTradeNo, String tradeNo, String tradeStatus);
|
||||
}
|
@ -2,6 +2,7 @@ package com.java2nb.novel.service;
|
||||
|
||||
|
||||
import com.java2nb.novel.core.bean.UserDetails;
|
||||
import com.java2nb.novel.entity.UserBuyRecord;
|
||||
import com.java2nb.novel.form.UserForm;
|
||||
import com.java2nb.novel.vo.BookReadHistoryVO;
|
||||
import com.java2nb.novel.vo.BookShelfVO;
|
||||
@ -117,4 +118,24 @@ public interface UserService {
|
||||
void updatePassword(Long userId, String oldPassword, String newPassword);
|
||||
|
||||
|
||||
/**
|
||||
* 增加用户余额
|
||||
* @param userId 用户ID
|
||||
* @param amount 增加的余额 */
|
||||
void addAmount(Long userId, int amount);
|
||||
|
||||
/**
|
||||
* 判断用户是否购买过该小说章节
|
||||
* @param userId 用户ID
|
||||
* @param bookIndexId 章节目录ID
|
||||
* @return true:购买过,false:没购买
|
||||
* */
|
||||
boolean queryIsBuyBookIndex(Long userId, Long bookIndexId);
|
||||
|
||||
/**
|
||||
* 购买小说章节
|
||||
* @param userId 用户ID
|
||||
* @param buyRecord 购买信息
|
||||
* */
|
||||
void buyBookIndex(Long userId, UserBuyRecord buyRecord);
|
||||
}
|
||||
|
@ -0,0 +1,92 @@
|
||||
package com.java2nb.novel.service.impl;
|
||||
|
||||
import com.java2nb.novel.core.cache.CacheKey;
|
||||
import com.java2nb.novel.core.cache.CacheService;
|
||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||
import com.java2nb.novel.core.exception.BusinessException;
|
||||
import com.java2nb.novel.entity.Author;
|
||||
import com.java2nb.novel.entity.FriendLink;
|
||||
import com.java2nb.novel.mapper.*;
|
||||
import com.java2nb.novel.service.AuthorService;
|
||||
import com.java2nb.novel.service.FriendLinkService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.java2nb.novel.mapper.AuthorCodeDynamicSqlSupport.authorCode;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.book;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.id;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.updateTime;
|
||||
import static com.java2nb.novel.mapper.FriendLinkDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
import static org.mybatis.dynamic.sql.select.SelectDSL.select;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AuthorServiceImpl implements AuthorService {
|
||||
|
||||
private final AuthorMapper authorMapper;
|
||||
|
||||
private final AuthorCodeMapper authorCodeMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean checkPenName(String penName) {
|
||||
return authorMapper.count(c ->
|
||||
c.where(AuthorDynamicSqlSupport.penName, isEqualTo(penName))) > 0;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String register(Long userId, Author author) {
|
||||
Date currentDate = new Date();
|
||||
//判断邀请码是否有效
|
||||
if (authorCodeMapper.count(c ->
|
||||
c.where(AuthorCodeDynamicSqlSupport.inviteCode, isEqualTo(author.getInviteCode()))
|
||||
.and(AuthorCodeDynamicSqlSupport.isUse, isEqualTo((byte) 0))
|
||||
.and(AuthorCodeDynamicSqlSupport.validityTime, isGreaterThan(currentDate))) > 0) {
|
||||
//邀请码有效
|
||||
//保存作家信息
|
||||
author.setUserId(userId);
|
||||
author.setCreateTime(currentDate);
|
||||
authorMapper.insertSelective(author);
|
||||
//设置邀请码状态为已使用
|
||||
authorCodeMapper.update(update(authorCode)
|
||||
.set(AuthorCodeDynamicSqlSupport.isUse)
|
||||
.equalTo((byte) 1)
|
||||
.where(AuthorCodeDynamicSqlSupport.inviteCode,isEqualTo(author.getInviteCode()))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
return "";
|
||||
} else {
|
||||
//邀请码无效
|
||||
return "邀请码无效!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isAuthor(Long userId) {
|
||||
return authorMapper.count(c ->
|
||||
c.where(AuthorDynamicSqlSupport.userId, isEqualTo(userId))) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Author queryAuthor(Long userId) {
|
||||
return authorMapper.selectMany(
|
||||
select(AuthorDynamicSqlSupport.id,AuthorDynamicSqlSupport.penName,AuthorDynamicSqlSupport.status)
|
||||
.from(AuthorDynamicSqlSupport.author)
|
||||
.where(AuthorDynamicSqlSupport.userId,isEqualTo(userId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3)).get(0);
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ import com.java2nb.novel.entity.*;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.mapper.*;
|
||||
import com.java2nb.novel.search.BookSP;
|
||||
import com.java2nb.novel.service.AuthorService;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.vo.BookCommentVO;
|
||||
import com.java2nb.novel.vo.BookSettingVO;
|
||||
@ -73,6 +74,8 @@ public class BookServiceImpl implements BookService {
|
||||
|
||||
private final CacheService cacheService;
|
||||
|
||||
private final AuthorService authorService;
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
@ -194,7 +197,7 @@ public class BookServiceImpl implements BookService {
|
||||
|
||||
@Override
|
||||
public Book queryBookDetail(Long bookId) {
|
||||
SelectStatementProvider selectStatement = select(id, catName, catId, picUrl, bookName, authorId, authorName, bookDesc, bookStatus, visitCount, wordCount, lastIndexId, lastIndexName, lastIndexUpdateTime,score)
|
||||
SelectStatementProvider selectStatement = select(id, catName, catId, picUrl, bookName, authorId, authorName, bookDesc, bookStatus, visitCount, wordCount, lastIndexId, lastIndexName, lastIndexUpdateTime,score,status)
|
||||
.from(book)
|
||||
.where(id, isEqualTo(bookId))
|
||||
.build()
|
||||
@ -211,7 +214,7 @@ public class BookServiceImpl implements BookService {
|
||||
PageHelper.startPage(1,limit);
|
||||
}
|
||||
|
||||
SelectStatementProvider selectStatement = select(BookIndexDynamicSqlSupport.id, BookIndexDynamicSqlSupport.bookId, BookIndexDynamicSqlSupport.indexNum, BookIndexDynamicSqlSupport.indexName, BookIndexDynamicSqlSupport.updateTime)
|
||||
SelectStatementProvider selectStatement = select(BookIndexDynamicSqlSupport.id, BookIndexDynamicSqlSupport.bookId, BookIndexDynamicSqlSupport.indexNum, BookIndexDynamicSqlSupport.indexName, BookIndexDynamicSqlSupport.updateTime,BookIndexDynamicSqlSupport.isVip)
|
||||
.from(bookIndex)
|
||||
.where(BookIndexDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||
.build()
|
||||
@ -222,7 +225,7 @@ public class BookServiceImpl implements BookService {
|
||||
|
||||
@Override
|
||||
public BookIndex queryBookIndex(Long bookIndexId) {
|
||||
SelectStatementProvider selectStatement = select(BookIndexDynamicSqlSupport.id, BookIndexDynamicSqlSupport.bookId, BookIndexDynamicSqlSupport.indexNum, BookIndexDynamicSqlSupport.indexName, BookIndexDynamicSqlSupport.wordCount, BookIndexDynamicSqlSupport.updateTime)
|
||||
SelectStatementProvider selectStatement = select(BookIndexDynamicSqlSupport.id, BookIndexDynamicSqlSupport.bookId, BookIndexDynamicSqlSupport.indexNum, BookIndexDynamicSqlSupport.indexName, BookIndexDynamicSqlSupport.wordCount, BookIndexDynamicSqlSupport.updateTime,BookIndexDynamicSqlSupport.isVip)
|
||||
.from(bookIndex)
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(bookIndexId))
|
||||
.build()
|
||||
@ -302,6 +305,7 @@ public class BookServiceImpl implements BookService {
|
||||
}
|
||||
SelectStatementProvider selectStatement = select(id, catId, catName, bookName, lastIndexId, lastIndexName, authorId, authorName, picUrl, bookDesc, wordCount, lastIndexUpdateTime)
|
||||
.from(book)
|
||||
.where(wordCount,isGreaterThan(0))
|
||||
.orderBy(sortSpecification)
|
||||
.limit(limit)
|
||||
.build()
|
||||
@ -454,5 +458,103 @@ public class BookServiceImpl implements BookService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Book> listBookPageByUserId(Long userId, int page, int pageSize) {
|
||||
|
||||
PageHelper.startPage(page,pageSize);
|
||||
|
||||
SelectStatementProvider selectStatement = select(id, bookName, visitCount, lastIndexName, status)
|
||||
.from(book)
|
||||
.where(authorId, isEqualTo(authorService.queryAuthor(userId).getId()))
|
||||
.orderBy(BookDynamicSqlSupport.createTime.descending())
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
return bookMapper.selectMany(selectStatement);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBook(Book book, Long authorId, String penName) {
|
||||
//判断小说名是否存在
|
||||
if(queryIdByNameAndAuthor(book.getBookName(),penName)!=null){
|
||||
//该作者发布过此书名的小说
|
||||
throw new BusinessException(ResponseStatus.BOOKNAME_EXISTS);
|
||||
};
|
||||
book.setAuthorName(penName);
|
||||
book.setAuthorId(authorId);
|
||||
book.setVisitCount(0L);
|
||||
book.setWordCount(0);
|
||||
book.setScore(6.5f);
|
||||
book.setLastIndexName("");
|
||||
book.setCreateTime(new Date());
|
||||
book.setUpdateTime(book.getCreateTime());
|
||||
bookMapper.insertSelective(book);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBookStatus(Long bookId, Byte status, Long authorId) {
|
||||
bookMapper.update(update(book)
|
||||
.set(BookDynamicSqlSupport.status)
|
||||
.equalTo(status)
|
||||
.where(id,isEqualTo(bookId))
|
||||
.and(BookDynamicSqlSupport.authorId,isEqualTo(authorId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void addBookContent(Long bookId, String indexName, String content, Long authorId) {
|
||||
|
||||
Book book = queryBookDetail(bookId);
|
||||
if(!authorId.equals(book.getAuthorId())){
|
||||
//并不是更新自己的小说
|
||||
return;
|
||||
}
|
||||
Long lastIndexId = new IdWorker().nextId();
|
||||
Date currentDate = new Date();
|
||||
int wordCount = content.length();
|
||||
|
||||
//更新小说主表信息
|
||||
bookMapper.update(update(BookDynamicSqlSupport.book)
|
||||
.set(BookDynamicSqlSupport.lastIndexId)
|
||||
.equalTo(lastIndexId)
|
||||
.set(BookDynamicSqlSupport.lastIndexName)
|
||||
.equalTo(indexName)
|
||||
.set(BookDynamicSqlSupport.lastIndexUpdateTime)
|
||||
.equalTo(currentDate)
|
||||
.set(BookDynamicSqlSupport.wordCount)
|
||||
.equalTo(book.getWordCount()+wordCount)
|
||||
.where(id,isEqualTo(bookId))
|
||||
.and(BookDynamicSqlSupport.authorId,isEqualTo(authorId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
//更新小说目录表
|
||||
int indexNum = 0;
|
||||
if(book.getLastIndexId() != null){
|
||||
indexNum = queryBookIndex(book.getLastIndexId()).getIndexNum()+1;
|
||||
}
|
||||
BookIndex lastBookIndex = new BookIndex();
|
||||
lastBookIndex.setId(lastIndexId);
|
||||
lastBookIndex.setWordCount(wordCount);
|
||||
lastBookIndex.setIndexName(indexName);
|
||||
lastBookIndex.setIndexNum(indexNum);
|
||||
lastBookIndex.setBookId(bookId);
|
||||
lastBookIndex.setIsVip(book.getStatus());
|
||||
lastBookIndex.setCreateTime(currentDate);
|
||||
lastBookIndex.setUpdateTime(currentDate);
|
||||
bookIndexMapper.insertSelective(lastBookIndex);
|
||||
|
||||
//更新小说内容表
|
||||
BookContent bookContent = new BookContent();
|
||||
bookContent.setIndexId(lastIndexId);
|
||||
bookContent.setContent(content);
|
||||
bookContentMapper.insertSelective(bookContent);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
package com.java2nb.novel.service.impl;
|
||||
|
||||
import com.java2nb.novel.entity.OrderPay;
|
||||
import com.java2nb.novel.mapper.OrderPayDynamicSqlSupport;
|
||||
import com.java2nb.novel.mapper.OrderPayMapper;
|
||||
import com.java2nb.novel.service.OrderService;
|
||||
import com.java2nb.novel.service.UserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
import static org.mybatis.dynamic.sql.select.SelectDSL.select;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OrderServiceImpl implements OrderService {
|
||||
|
||||
private final OrderPayMapper orderPayMapper;
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Long createPayOrder(Byte payChannel, Integer payAmount, Long userId) {
|
||||
Date currentDate = new Date();
|
||||
Long outTradeNo = Long.parseLong(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(currentDate)+new Random().nextInt(10));
|
||||
OrderPay orderPay = new OrderPay();
|
||||
orderPay.setOutTradeNo(outTradeNo);
|
||||
orderPay.setPayChannel(payChannel);
|
||||
orderPay.setTotalAmount(payAmount);
|
||||
orderPay.setUserId(userId);
|
||||
orderPay.setCreateTime(currentDate);
|
||||
orderPay.setUpdateTime(currentDate);
|
||||
orderPayMapper.insertSelective(orderPay);
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updatePayOrder(Long outTradeNo, String tradeNo, String tradeStatus) {
|
||||
SelectStatementProvider selectStatement = select(OrderPayDynamicSqlSupport.id,OrderPayDynamicSqlSupport.payStatus,OrderPayDynamicSqlSupport.totalAmount,OrderPayDynamicSqlSupport.userId)
|
||||
.from(OrderPayDynamicSqlSupport.orderPay)
|
||||
.where(OrderPayDynamicSqlSupport.outTradeNo, isEqualTo(outTradeNo))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
|
||||
OrderPay orderPay = orderPayMapper.selectMany(selectStatement).get(0);
|
||||
|
||||
if(orderPay.getPayStatus()!=1) {
|
||||
//此订单还未处理过
|
||||
|
||||
if (tradeStatus.equals("TRADE_SUCCESS") || tradeStatus.equals("TRADE_FINISHED")) {
|
||||
//支付成功
|
||||
//1.更新订单状态为成功
|
||||
orderPay.setPayStatus((byte) 1);
|
||||
orderPay.setUpdateTime(new Date());
|
||||
orderPayMapper.updateByPrimaryKeySelective(orderPay);
|
||||
|
||||
//2.增加用户余额
|
||||
userService.addAmount(orderPay.getUserId(),orderPay.getTotalAmount()*100);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -3,14 +3,12 @@ package com.java2nb.novel.service.impl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.java2nb.novel.core.bean.UserDetails;
|
||||
import com.java2nb.novel.core.utils.BeanUtil;
|
||||
import com.java2nb.novel.entity.*;
|
||||
import com.java2nb.novel.entity.User;
|
||||
import com.java2nb.novel.form.UserForm;
|
||||
import com.java2nb.novel.service.UserService;
|
||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||
import com.java2nb.novel.core.exception.BusinessException;
|
||||
import com.java2nb.novel.entity.User;
|
||||
import com.java2nb.novel.entity.UserBookshelf;
|
||||
import com.java2nb.novel.entity.UserFeedback;
|
||||
import com.java2nb.novel.entity.UserReadHistory;
|
||||
import com.java2nb.novel.mapper.*;
|
||||
import com.java2nb.novel.vo.BookReadHistoryVO;
|
||||
import com.java2nb.novel.vo.BookShelfVO;
|
||||
@ -31,6 +29,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.book;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.id;
|
||||
import static com.java2nb.novel.mapper.UserBookshelfDynamicSqlSupport.userBookshelf;
|
||||
import static com.java2nb.novel.mapper.UserDynamicSqlSupport.*;
|
||||
import static com.java2nb.novel.mapper.UserFeedbackDynamicSqlSupport.userFeedback;
|
||||
@ -54,6 +54,8 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
private final UserFeedbackMapper userFeedbackMapper;
|
||||
|
||||
private final UserBuyRecordMapper userBuyRecordMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@ -211,7 +213,7 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
@Override
|
||||
public User userInfo(Long userId) {
|
||||
SelectStatementProvider selectStatement = select(username, nickName, userPhoto,userSex)
|
||||
SelectStatementProvider selectStatement = select(username, nickName, userPhoto,userSex,accountBalance)
|
||||
.from(user)
|
||||
.where(id, isEqualTo(userId))
|
||||
.build()
|
||||
@ -256,6 +258,50 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void addAmount(Long userId, int amount) {
|
||||
User user = this.userInfo(userId);
|
||||
user.setId(userId);
|
||||
user.setAccountBalance(user.getAccountBalance()+amount);
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean queryIsBuyBookIndex(Long userId, Long bookIndexId) {
|
||||
|
||||
return userBuyRecordMapper.count(c ->
|
||||
c.where(UserBuyRecordDynamicSqlSupport.userId, isEqualTo(userId))
|
||||
.and(UserBuyRecordDynamicSqlSupport.bookIndexId,isEqualTo(bookIndexId))) > 0;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void buyBookIndex(Long userId, UserBuyRecord buyRecord) {
|
||||
//查询用户余额
|
||||
long balance = userInfo(userId).getAccountBalance();
|
||||
if(balance<10){
|
||||
//余额不足
|
||||
throw new BusinessException(ResponseStatus.USER_NO_BALANCE);
|
||||
}
|
||||
buyRecord.setUserId(userId);
|
||||
buyRecord.setCreateTime(new Date());
|
||||
buyRecord.setBuyAmount(10);
|
||||
//生成购买记录
|
||||
userBuyRecordMapper.insertSelective(buyRecord);
|
||||
|
||||
//减少用户余额
|
||||
userMapper.update(update(user)
|
||||
.set(UserDynamicSqlSupport.accountBalance)
|
||||
.equalTo(balance-10)
|
||||
.where(id,isEqualTo(userId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
17
novel-front/src/main/resources/application-alipay.yml
Normal file
17
novel-front/src/main/resources/application-alipay.yml
Normal file
@ -0,0 +1,17 @@
|
||||
alipay:
|
||||
#请填写您的AppId,例如:2019091767145019
|
||||
app-id: 2016101600696458
|
||||
#请填写您的应用私钥,例如:MIIEvQIBADANB
|
||||
merchant-private-key: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCJrd9qg88m1p9c7IopcGlLksP9ts0eaf1wesgz4K3O6CzmgaCfR2f+scRI4xrMhKBHfzKDdKlW16LtrebD/YS/aDhRL9MM1GJ0Pr7zFdw6fIka9eIz1FojmmXNyaQVEbaGt/7DvoI+rJjjNtTQAYpMztHnof2W0Nfpra5U4dShJrzsvumS8NapEt9YgQ36jY9Z40RJ97Z06avmMGrAVlQSSTvUInTYz8EQmM3YN0ed3CmnlQFRhuW7kkbgBtZKjq+24iaU2mzp4qvWi5T89l3wuMahhxhFTgTNd24qxFuYShIdD0G3KCtunpwegomj1iQnF47qGv97UwOuA36b6l75AgMBAAECggEAJraZZ94AVa9ryDlK8DQHp5RxP9oy+yZaeVJNESlQNina1kYE4ES33UonI0eYtYFlgDUoAwa+xwiDa8nGZb3XoeqwS0PjWGwv8vfhwYCYGGoEM2yIWoKPhgtYLPFSDgqZBHCgVnIvNWha5Sj51jNYrBhLtZI7ODkpPS/1ITEPFPDds9LmH3Ujci20ttzr1SffKL/1caZ2Xph/Jkm2Xhh227cclORakDsggUmaxt723zibwFwpS6wwRlPJYf7hr3v3SnIgcc0osqKAcnJzrBlmaJVTBgnOAdulp+m/DjKVoIEieMr75OIYTWMRi0trlxAyvv4aDHxxJB6cDGNHFQLIMQKBgQD5j4fJDub2n9EjgxqYS9B6qa2pH5S9yypU+mM6fIXO/AjHpNwEzFQgU8lN3FE1CVfFb4yZx8sOJsQvZPGLvIhMPYT/2xMOIRL2IguJICt23Xnw+c1tNkvHvsHAiLvo/yzwSFixHcOaEwXDKUDsydPyalDFWBrwCGmGGxPEFG/Q/wKBgQCNO0+Muo+HzeUButDyA5gt9oPCX7uZ9g64rnFhuQXZ/eLDQeCW/lhjRiT2R+QafvbRyOYYomKZ6/1iQALY4tqQD7XMClRdu0OUvYR2WaNb9j4sWXl8qhMxgWjXssqorZRzNe+txicX8yOA5/ZVhhq647e2zt4kOS5H6Np0HvxYBwKBgQDvNfA+/cTPk4NhWdLNNqagXTJz0Sy+/BYYnGUu85tDOvyjeVfYVY8x6X4k3tEMWGdEfdc0tHjjmK8misipW8793V417WUHfxZwzVNnXmmrJ0IyhQ+u5oOe9C8+ARK1lJsbuw0gwNn0PtWgK1PrZM5/J/9CGmC/wiB8BkpdAgXoOwKBgE5fa3Wc0al7CGo9UVX7yKc49UUX+vMlKGYz55djJWwjB4NzOz6PRl1Qv5IrstlBO5aO9aEV+8GOw72R6AKTYNYw4aGo2chp8sbHpIpIk+6kZzwVKuWTO7NtLNEF1pBkQszsUWUNYQRZWIpgLsKm+I5db8VyZrOTR6t//DoUN9RhAoGAQLNaaULlw5L2Qsq9hbsdZVkbZN6YY4oiqMufmDKavbpUvchagFBe7/bneX4orza+DiC4vBFDIUOsZawB9eStx8hvL4AcuUF+eoZT3FCmvHB8dAYs4vok28f1nqUpYLmu4yN+wc/sLhihaJd7keErc987/E8mxW18AEin4Q4pKK8=
|
||||
#支付宝公钥字符串
|
||||
public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoR1gAyrjj/XugdKT3zUJBJksYnCXxD3RDiBex+JGfo6oO0oPbyoIQb2cAIIJjCCxT97QATlbYpRGMa+RuXxlxTeBh5ZFkELOsGc/UX0d9Tm51UvN+OV5pyysytlRdZfVgOETORzv9CvfnK7ND1SSHUPDan7TkMoVFipmQnf8205V3tcsDBat5kHEPFCmWXkPxrtLPVge1dAtKSRW9KFMslXkKrspvF1fSLGt12CE38ZwzP39INKgaI+RbIk3o7aRW5CrLqPkYdrgE1KcFBOj/gJXqbZvL/30q1KVn29UQUYm9SR/n6ZaLlAG38p4O3dL9Lu2lGhTBQlUr2qtpo+g8QIDAQAB
|
||||
#填写您的支付类接口异步通知接收服务地址,例如:https://www:test:com/callback:
|
||||
notify-url: http://50148a0b.ngrok.io/pay/aliPay/notify
|
||||
#支付成功跳转页面
|
||||
return-url: http://127.0.0.1:8080/user/userinfo.html
|
||||
#签名方式
|
||||
sign-type: RSA2
|
||||
#编码
|
||||
charset: utf-8
|
||||
#支付宝网关
|
||||
gateway-url: https://openapi.alipaydev.com/gateway.do
|
@ -4,6 +4,7 @@ server:
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
include: alipay
|
||||
|
||||
jwt:
|
||||
secret: novel!#20191230
|
||||
@ -23,3 +24,6 @@ xss:
|
||||
excludes: /system/notice/*
|
||||
# 匹配链接 (多个用逗号分隔)
|
||||
urlPatterns: /book/addBookComment,/user/addFeedBack
|
||||
|
||||
|
||||
|
||||
|
@ -4,34 +4,33 @@
|
||||
<mapper namespace="com.java2nb.novel.mapper.FrontBookMapper">
|
||||
|
||||
<select id="searchByPage" parameterType="com.java2nb.novel.search.BookSP" resultType="com.java2nb.novel.vo.BookVO">
|
||||
select id,cat_id,cat_name,book_name,author_id,author_name,word_count,last_index_id,last_index_name,score,pic_url,book_status,last_index_update_time,book_desc
|
||||
from book
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and (book_name like concat('%',#{keyword},'%') or author_name like concat('%',#{keyword},'%'))
|
||||
</if>
|
||||
<if test="workDirection != null">
|
||||
and work_direction = #{workDirection}
|
||||
</if>
|
||||
<if test="catId != null">
|
||||
and cat_id = #{catId}
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
and is_vip = #{isVip}
|
||||
</if>
|
||||
<if test="bookStatus != null">
|
||||
and book_status = #{bookStatus}
|
||||
</if>
|
||||
<if test="wordCountMin != null">
|
||||
and word_count >= #{wordCountMin}
|
||||
</if>
|
||||
<if test="wordCountMax != null">
|
||||
and word_count <![CDATA[ < ]]> #{wordCountMax}
|
||||
</if>
|
||||
<if test="updateTimeMin != null">
|
||||
and last_index_update_time >= #{updateTimeMin}
|
||||
</if>
|
||||
</where>
|
||||
select
|
||||
id,cat_id,cat_name,book_name,author_id,author_name,word_count,last_index_id,last_index_name,score,pic_url,book_status,last_index_update_time,book_desc
|
||||
from book where word_count > 0
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and (book_name like concat('%',#{keyword},'%') or author_name like concat('%',#{keyword},'%'))
|
||||
</if>
|
||||
<if test="workDirection != null">
|
||||
and work_direction = #{workDirection}
|
||||
</if>
|
||||
<if test="catId != null">
|
||||
and cat_id = #{catId}
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
and is_vip = #{isVip}
|
||||
</if>
|
||||
<if test="bookStatus != null">
|
||||
and book_status = #{bookStatus}
|
||||
</if>
|
||||
<if test="wordCountMin != null">
|
||||
and word_count >= #{wordCountMin}
|
||||
</if>
|
||||
<if test="wordCountMax != null">
|
||||
and word_count <![CDATA[ < ]]> #{wordCountMax}
|
||||
</if>
|
||||
<if test="updateTimeMin != null">
|
||||
and last_index_update_time >= #{updateTimeMin}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
@ -59,7 +58,7 @@
|
||||
limit #{offset},#{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectIdsByScoreAndRandom" parameterType="int" resultType="com.java2nb.novel.entity.Book">
|
||||
<select id="selectIdsByScoreAndRandom" parameterType="int" resultType="com.java2nb.novel.entity.Book">
|
||||
|
||||
select id,book_name,author_name,pic_url,book_desc,score from book ORDER BY score,RAND() LIMIT #{limit};
|
||||
</select>
|
||||
|
3243
novel-front/src/main/resources/static/css/easyui.css
Normal file
3243
novel-front/src/main/resources/static/css/easyui.css
Normal file
File diff suppressed because it is too large
Load Diff
1402
novel-front/src/main/resources/static/css/public.css
Normal file
1402
novel-front/src/main/resources/static/css/public.css
Normal file
File diff suppressed because it is too large
Load Diff
BIN
novel-front/src/main/resources/static/images/pay_wx.png
Normal file
BIN
novel-front/src/main/resources/static/images/pay_wx.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
novel-front/src/main/resources/static/images/pay_zfb.png
Normal file
BIN
novel-front/src/main/resources/static/images/pay_zfb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
617
novel-front/src/main/resources/static/javascript/YT.js
Normal file
617
novel-front/src/main/resources/static/javascript/YT.js
Normal file
@ -0,0 +1,617 @@
|
||||
var $C = function (objName) {
|
||||
if (typeof (document.getElementById(objName)) != "object")
|
||||
{ return null; }
|
||||
else
|
||||
{ return document.getElementById(objName); }
|
||||
}
|
||||
var YT = {
|
||||
BaseCommon: {
|
||||
gL: function (x) { var l = 0; while (x) { l += x.offsetLeft; x = x.offsetParent; } return l },
|
||||
gT: function (x) { var t = 0; while (x) { t += x.offsetTop; x = x.offsetParent; } return t }
|
||||
},
|
||||
BaseData: {
|
||||
WaitImg: "/images/loading.gif"
|
||||
},
|
||||
Fun: {
|
||||
GetWordLength: function (str) {
|
||||
str = str.replace(/(\n)+|(\r\n)+/g, "");
|
||||
str = str.replace(" ", "");
|
||||
str = str.replace(" ", "");
|
||||
return str.length;
|
||||
},
|
||||
ConvertToMoney: function (btanch) {
|
||||
if (btanch != undefined) {
|
||||
return parseFloat(btanch) / 100;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
LoadShow: function () {
|
||||
if ($C("LayerShowPic") == null) {
|
||||
var sp = document.createElement("div");
|
||||
sp.innerHTML = "<div id=\"LayerShowPic\" style=\"position:absolute;width:180px;height:70px;z-index:100;background-color: #fdfce9;border: 1px solid #666666;font-size:12px;\"><div align=\"center\" style=\"z-index:91;\"><br><img src=\"" + YT.BaseData.WaitImg + "\" align=\"absmiddle\" /> 请稍后…</div></div><iframe id=\"LayerCover\" style=\"position:absolute;width:100%;height:100%;z-index:10;left: 0px;top: 0px;background-color:#eeeeee;FILTER: alpha(opacity=1);opacity: 0.3 !important; \"></iframe>";
|
||||
document.body.appendChild(sp);
|
||||
}
|
||||
$C("LayerShowPic").style.display = '';
|
||||
$C("LayerCover").style.display = '';
|
||||
$C("LayerCover").style.height = String(document.documentElement.scrollHeight) + 'px';
|
||||
YT.Fun.ScreenCenter($C("LayerShowPic"), 266, 200);
|
||||
|
||||
},
|
||||
LoadHide: function () {
|
||||
if ($C("LayerShowPic") != null) {
|
||||
$C("LayerShowPic").style.display = 'none';
|
||||
$C("LayerCover").style.display = 'none';
|
||||
}
|
||||
},
|
||||
ScreenCenter: function (obj, width, height) {
|
||||
if (obj.style.display == 'none') {
|
||||
obj.style.display = '';
|
||||
}
|
||||
var scrolltop = document.documentElement.scrollTop;
|
||||
if (width <= 0) {
|
||||
width = obj.offsetWidth;
|
||||
}
|
||||
if (height <= 0) {
|
||||
height = obj.offsetHeight;
|
||||
}
|
||||
if (scrolltop == null || scrolltop == 0) {
|
||||
scrolltop = document.body.scrollTop;
|
||||
}
|
||||
var offsetHT = document.body.clientHeight / 2 - height / 2;
|
||||
if (offsetHT <= 0) { offsetHT = 10; }
|
||||
var offsetWT = document.body.clientWidth / 2 - width / 2;
|
||||
if (offsetWT <= 0) { offsetWT = 10; }
|
||||
obj.style.top = String(scrolltop + offsetHT) + 'px';
|
||||
obj.style.left = String(offsetWT) + 'px';
|
||||
},
|
||||
NewPanel: function (url, title, width, height, needFits) {
|
||||
if (typeof (width) == 'undefind' || width == null) { width = 750; }
|
||||
if (typeof (height) == 'undefind' || height == null) { height = 550; }
|
||||
var fits = false;
|
||||
if (typeof (needFits) != "undefined" && needFits) {
|
||||
if (document.body.clientWidth < 650 || document.body.clientHeight < 450 || document.body.clientHeight - 50 < height)
|
||||
{ fits = true; }
|
||||
}
|
||||
if ($C("YT_Panel") == null) {
|
||||
var sp = document.createElement("div");
|
||||
sp.innerHTML = "<div id=\"YT_Panel\" class=\"easyui-panel\"><iframe frameborder=\"0\" id=\"YT_Panel_i\" name=\"YT_Panel_i\" scrolling=\"auto\" src=\"" + url + "\" style=\"height:100%;visibility:inherit; width:100%;z-index:1;\"></iframe></div>";
|
||||
document.body.appendChild(sp);
|
||||
}
|
||||
if (url.indexOf("?") > 0) {
|
||||
url = url + "&";
|
||||
}
|
||||
else {
|
||||
url = url + "?";
|
||||
}
|
||||
url = url + "randomkeys=" + Math.random();
|
||||
$C("YT_Panel_i").src = url;
|
||||
var sTop = null, sLeft = null;
|
||||
if (window.screen.height < 800) {
|
||||
sTop = 0;
|
||||
}
|
||||
if (fits) {
|
||||
sLeft = 0;
|
||||
}
|
||||
$('#YT_Panel').window({
|
||||
width: width,
|
||||
height: height,
|
||||
title: title,
|
||||
collapsible: true,
|
||||
minimizable: false,
|
||||
maximizable: true,
|
||||
closable: true,
|
||||
modal: true,
|
||||
fit: fits,
|
||||
top: sTop,
|
||||
left: sLeft
|
||||
});
|
||||
},
|
||||
NewPanelNoClose: function (url, title, width, height) {
|
||||
if (typeof (width) == 'undefind' || width == null) { width = 750; }
|
||||
if (typeof (height) == 'undefind' || height == null) { height = 550; }
|
||||
if ($C("YT_Panel") == null) {
|
||||
var sp = document.createElement("div");
|
||||
sp.innerHTML = "<div id=\"YT_Panel\" class=\"easyui-panel\" ><iframe frameborder=\"0\" id=\"YT_Panel_i\" name=\"YT_Panel_i\" scrolling=\"auto\" src=\"" + url + "\" style=\"height:100%;visibility:inherit; width:100%;z-index:1;\"></iframe></div>";
|
||||
document.body.appendChild(sp);
|
||||
}
|
||||
if (url.indexOf("?") > 0) {
|
||||
url = url + "&";
|
||||
}
|
||||
else {
|
||||
url = url + "?";
|
||||
}
|
||||
url = url + "randomkeys=" + Math.random();
|
||||
$C("YT_Panel_i").src = url;
|
||||
$('#YT_Panel').window({
|
||||
width: width,
|
||||
height: height,
|
||||
title: title,
|
||||
collapsible: false,
|
||||
minimizable: false,
|
||||
maximizable: true,
|
||||
closable: false,
|
||||
modal: true
|
||||
});
|
||||
},
|
||||
ClosePanel: function (id) {
|
||||
if (typeof (id) == 'undefind' || id == null) {
|
||||
$('#YT_Panel').panel('close');
|
||||
/*CreateGrid();*/
|
||||
CreateGridReload();
|
||||
}
|
||||
else { $('#' + id).panel('close'); }
|
||||
},
|
||||
/*格式化时间字符串*/
|
||||
formatDate: function (now, types) {
|
||||
if (now != null && now != "") {
|
||||
var dateN = new Date(+/\d+/.exec(now)[0]);
|
||||
var year = dateN.getFullYear();
|
||||
var month = dateN.getMonth() + 1;
|
||||
var date = dateN.getDate();
|
||||
var hour = dateN.getHours();
|
||||
var minute = dateN.getMinutes();
|
||||
var second = dateN.getSeconds();
|
||||
if (typeof (types) != "undefined" && types != null) {
|
||||
return year + "-" + month + "-" + date;
|
||||
}
|
||||
else if (hour == 0 && minute == 0 && second == 0) {
|
||||
return year + "-" + month + "-" + date;
|
||||
}
|
||||
else {
|
||||
return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
/** 获取当前时间月份*/
|
||||
formatMonth: function (now) {
|
||||
if (now != null && now != "") {
|
||||
var dateN = new Date(+/\d+/.exec(now)[0]);
|
||||
var month = dateN.getMonth() + 1;
|
||||
return month;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
/** 获取当前时间具体的某一天*/
|
||||
formatDay: function (now) {
|
||||
if (now != null && now != "") {
|
||||
var dateN = new Date(+/\d+/.exec(now)[0]);
|
||||
var month = dateN.getMonth() + 1;
|
||||
var date = dateN.getDate();
|
||||
return month + "-" + date;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
/** 获取所属时间的季度*/
|
||||
formatSeasonal: function (now) {
|
||||
if (now != null && now != "") {
|
||||
var dateN = new Date(+/\d+/.exec(now)[0]);
|
||||
var year = dateN.getFullYear();
|
||||
var month = dateN.getMonth() + 1;
|
||||
if (month == 1) {
|
||||
return year + "年第1季度";
|
||||
}
|
||||
else if (month == 4) {
|
||||
return year + "年第2季度";
|
||||
}
|
||||
else if (month == 7) {
|
||||
return year + "年第三季度";
|
||||
}
|
||||
else {
|
||||
return year + "年第四季度";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
|
||||
formatStatus: function (id) {
|
||||
if (id == 0) {
|
||||
return "无效";
|
||||
}
|
||||
else {
|
||||
return "有效";
|
||||
}
|
||||
},
|
||||
ShowPanel: function (obj, divName, xlong, ylong) {
|
||||
var showobj = $C(divName);
|
||||
if (showobj) {
|
||||
if (showobj.style.display == 'none') {
|
||||
showobj.style.display = '';
|
||||
}
|
||||
if (xlong)
|
||||
{ showobj.style.top = YT.BaseCommon.gT(obj) + 20 + xlong + "px"; }
|
||||
else
|
||||
{ showobj.style.top = YT.BaseCommon.gT(obj) + 20 + "px"; }
|
||||
if (ylong)
|
||||
{ showobj.style.left = YT.BaseCommon.gL(obj) + ylong + "px"; }
|
||||
else
|
||||
{ showobj.style.left = YT.BaseCommon.gL(obj) + "px"; }
|
||||
}
|
||||
},
|
||||
GetDateDiff:function(startTime,endTime, diffType) {
|
||||
startTime = startTime.replace(/\-/g, "/");
|
||||
endTime= endTime.replace(/\-/g, "/");
|
||||
diffType = diffType.toLowerCase();
|
||||
var sTime = new Date(startTime);
|
||||
var eTime = new Date(endTime);
|
||||
var timeType = 1;
|
||||
switch (diffType) {
|
||||
case "second":
|
||||
timeType = 1000;
|
||||
break;
|
||||
case "minute":
|
||||
timeType = 1000 * 60;
|
||||
break;
|
||||
case "hour":
|
||||
timeType = 1000 * 3600;
|
||||
break;
|
||||
case "day":
|
||||
timeType = 1000 * 3600 * 24;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return parseInt((eTime.getTime() - sTime.getTime()) / parseInt(timeType));
|
||||
}
|
||||
},
|
||||
Dirt: {
|
||||
/*绑定到列表*/
|
||||
BindList: function (listId, dirtName, needBlock) {
|
||||
var obj = $C(listId);
|
||||
if (obj != undefined) {
|
||||
obj.length = 0;
|
||||
var objV = eval("DirtInfo." + dirtName);
|
||||
if (objV != undefined && objV != null) {
|
||||
for (var i = 0; i < objV.length; i++) {
|
||||
obj.options.add(new Option(objV[i][1], objV[i][0]));
|
||||
}
|
||||
}
|
||||
if (needBlock) {
|
||||
obj.options.add(new Option("请选择", "0"));
|
||||
obj.value = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
/*获取值表示的意义*/
|
||||
GetName: function (dirtName, dValue) {
|
||||
var obj = eval("DirtInfo." + dirtName);
|
||||
if (obj != undefined && obj != null) {
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
if (obj[i][0] == dValue) {
|
||||
return obj[i][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
},
|
||||
Cookie: function (name, value, options) {
|
||||
if (typeof value != 'undefined') { /* name and value given, set cookie*/
|
||||
options = options || {};
|
||||
if (value === null) {
|
||||
value = '';
|
||||
options.expires = -1;
|
||||
}
|
||||
var expires = '';
|
||||
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||||
var date;
|
||||
if (typeof options.expires == 'number') {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
||||
} else {
|
||||
date = options.expires;
|
||||
}
|
||||
expires = '; expires=' + date.toUTCString(); /* use expires attribute, max-age is not supported by IE */
|
||||
}
|
||||
var path = options.path ? '; path=' + options.path : '';
|
||||
var domain = options.domain ? '; domain=' + options.domain : '';
|
||||
var secure = options.secure ? '; secure' : '';
|
||||
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
||||
} else { /* only name given, get cookie */
|
||||
var cookieValue = null;
|
||||
if (document.cookie && document.cookie != '') {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim(cookies[i]);
|
||||
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cookieValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*重新定义录入框校验规则*/
|
||||
$.extend($.fn.validatebox.defaults.rules, {
|
||||
chinaMobile: {/*手机号码*/
|
||||
validator: function (value, param) {
|
||||
var reg = /^(13|14|15|17|18)\d{9}$/;
|
||||
var reglt = /^(\d{3}|\d{4})-\d{8}$/;
|
||||
/*var reg = /^\d{11,12}$/;*/
|
||||
if (value.indexOf('-') > 0) {
|
||||
return reglt.test(value);
|
||||
}
|
||||
else {
|
||||
return reg.test(value);
|
||||
}
|
||||
}, message: '手机号码有误'
|
||||
},
|
||||
chinaName: {/*中文名称*/
|
||||
validator: function (value, param) {
|
||||
// var reg = /^[\u4e00-\u9fa5a-zA-Z0-9]{2,6}$/;
|
||||
var reg = /^[a-zA-Z\u4e00-\u9fa5][a-zA-Z0-9\u4e00-\u9fa5]{1,5}$/;
|
||||
// var reg = /^[\u4e00-\u9fa5,a-zA-Z0-9]{2,5}$/;
|
||||
return reg.test(value);
|
||||
}, message: '在笔名中数字不能开头,且昵称的长度应在2-6之间'
|
||||
},
|
||||
realName: {/*真实姓名*/
|
||||
validator: function (value, param) {
|
||||
// var reg = /^[a-zA-Z\u4e00-\u9fa5][a-zA-Z0-9\u4e00-\u9fa5]{1,5}$/;
|
||||
var reg = /^[\u4e00-\u9fa5,a-zA-Z0-9]{2,5}$/;
|
||||
return reg.test(value);
|
||||
}, message: '真实姓名的长度为2-5位中文字符'
|
||||
},
|
||||
maxLength: {
|
||||
validator: function (value, param) {
|
||||
$.fn.validatebox.defaults.rules.maxLength.message = '只能少于' + param + '字符串';
|
||||
return value.length < param;
|
||||
}
|
||||
},
|
||||
isNumber: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^(-|[0-9])(|\d{1,9})$/;
|
||||
return reg.test(value);
|
||||
}, message: '必须是数字'
|
||||
},
|
||||
isBankNumber: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^([0-9]{16}|[0-9]{19})$/;
|
||||
return reg.test(value);
|
||||
}, message: '银行卡号错误'
|
||||
},
|
||||
isEmail: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
|
||||
return reg.test(value);
|
||||
}, message: '邮箱格式错误'
|
||||
},
|
||||
|
||||
isPosInt: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^(\d{1,9})$/;
|
||||
if (reg.test(value) && value > 0) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}, message: '必须是大于0的正整数'
|
||||
},
|
||||
isPosIntTen: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^(\d{1,9})$/;
|
||||
if (reg.test(value) && value > 10) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}, message: '必须是大于10的正整数'
|
||||
},
|
||||
isDate: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29))$/;
|
||||
return reg.test(value);
|
||||
}, message: 'yyyy-MM-dd'
|
||||
},
|
||||
isIdCard: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/;
|
||||
return isCardID(value);
|
||||
}, message: '身份证号码错误'
|
||||
},
|
||||
isFloat: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^(^\+?[1-9][0-9]*$)$|^(\d{1,9}\.\d{1,9})$/;
|
||||
return reg.test(value);
|
||||
}, message: '必须是大于零的数字'
|
||||
},
|
||||
isFloatMin0:
|
||||
{
|
||||
validator: function (value, param) {
|
||||
var reg = /^(^\d{1,9})$|^(\d{1,9}\.\d{1,9})$/;
|
||||
return reg.test(value);
|
||||
}, message: '必须是大于零的数字'
|
||||
},
|
||||
isPassWord: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^[a-zA-Z0-9_]{5,15}$/;
|
||||
return reg.test(value);
|
||||
}, message: '密码格式错误'
|
||||
},
|
||||
isConfirmPassword: {
|
||||
validator: function (value, param) {
|
||||
return $(param[0]).val() == value;
|
||||
}, message: '两次录入的密码不同'
|
||||
},
|
||||
phoneCheck: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^(((\()?\d{2,4}(\))?[-(\s)*]){0,2})?(\d{8})$/;
|
||||
return reg.test(value);
|
||||
}, message: '输入的电话不正确'
|
||||
},
|
||||
isUserName: {
|
||||
validator: function (value, param) {
|
||||
var reg = /^[a-zA-Z0-9_]{3,15}$/;
|
||||
return reg.test(value);
|
||||
}, message: '用户名格式错误'
|
||||
},
|
||||
equalTo: {
|
||||
validator: function (value, param) {
|
||||
return $(param[0]).val() == value;
|
||||
},
|
||||
message: '字段不匹配'
|
||||
}
|
||||
});
|
||||
|
||||
/*空函数*/
|
||||
function CreateGrid() { }
|
||||
function CreateGridReload() { }
|
||||
|
||||
/*身份证校验正确性*/
|
||||
var NumbCardCity = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外" };
|
||||
function isCardID(sId) {
|
||||
var iSum = 0;
|
||||
var info = "";
|
||||
if (!/^\d{17}(\d|x)$/i.test(sId)) return false; /* "你输入的身份证长度或格式错误"; */
|
||||
sId = sId.replace(/x$/i, "a");
|
||||
if (NumbCardCity[parseInt(sId.substr(0, 2))] == null) return false; /*"你的身份证地区非法";*/
|
||||
sBirthday = sId.substr(6, 4) + "-" + Number(sId.substr(10, 2)) + "-" + Number(sId.substr(12, 2));
|
||||
var d = new Date(sBirthday.replace(/-/g, "/"));
|
||||
if (sBirthday != (d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate())) return false; /* "身份证上的出生日期非法";*/
|
||||
for (var i = 17; i >= 0; i--) iSum += (Math.pow(2, i) % 11) * parseInt(sId.charAt(17 - i), 11);
|
||||
if (iSum % 11 != 1) return false; /*"你输入的身份证号非法";*/
|
||||
return true;
|
||||
}
|
||||
|
||||
function getSex(val) {
|
||||
if (parseInt(val.charAt(16) / 2) * 2 != val.charAt(16))
|
||||
return '1';
|
||||
else
|
||||
return '0';
|
||||
}
|
||||
function showBirthday(val) {
|
||||
var mm;
|
||||
if (18 == val.length) {/*18位身份证号码*/
|
||||
mm = val.charAt(6) + val.charAt(7) + val.charAt(8) + val.charAt(9) + '-' + val.charAt(10) + val.charAt(11) + '-' + val.charAt(12) + val.charAt(13);
|
||||
|
||||
}
|
||||
return mm;
|
||||
}
|
||||
|
||||
|
||||
var DirtInfo = {
|
||||
TrueOrFalse: [[0, "否"], [1, "是"]],
|
||||
EnumUserCommendStatus: [[0, "新"], [1, "已处理"], [2, "已查看"]],
|
||||
AvailablesStatus: [[0, "禁用"], [1, "可用"]],
|
||||
SettleClass: [[0, "现金"], [1, "预付扣款"]],
|
||||
EnumSexClass: [[0, "不限"], [1, "男"], [2, "女"]],
|
||||
EnumUserType: [[1, "手机端app"], [2, "手机wap端"]],
|
||||
EnumPayClass: [[1, "支付宝"], [2, "微信"], [3, "微信扫码"], [100, "绑定手机奖励"]],
|
||||
EnumPayStatus: [[0, "新申请"], [2, "充值失败"], [3, "成功"]],
|
||||
EnumMoneyClass: [[0, "购买"], [1, "赠送"]],
|
||||
EnumUserFrom: [[1, "其他"], [2, "微博"], [3, "qq"], [4, "微信"], [10, "app注册"], [11, "wap注册"], [12, "微博绑定"], [13, "qq绑定"], [14, "微信绑定"]],
|
||||
EnumSignType: [[0, "未签约"], [1, "分成"], [2, "买断"], [3, "保底"], [4, "买断整本"], [9, "保底"], [15, "道具结算"], [30, "全勤奖励"]],
|
||||
EnumLogType: [[0, "app登录"], [1, "wap登录"]],
|
||||
EnumAuditStatus: [[-10, "下线"], [-1, "审核失败"], [0, "编辑中"], [1, "提交申请"], [2, "通过审核"], [3, "已发布"]],
|
||||
EnumHandleStatus: [[-1, "处理失败"], [0, "新申请"], [1, "待处理"], [2, "处理成功"]],
|
||||
EnumAuthorLevel: [[1, "一级"], [2, "二级"], [3, "三级"], [4, "四级"], [5, "五级"]],
|
||||
EnumChannelClass: [[0, "特级"], [1, "一级"], [2, "二级"], [3, "三级"], [4, "四级"], [5, "五级"], [6, "六级"], [7, "七级"], [8, "八级"], [9, "九级"], [1100, "千级"]],
|
||||
EnumVipChapter: [[0, "公众"], [1, "VIP"]],
|
||||
EnumBookLeveType: [[1, "A级"], [2, "B级"], [3, "C级"], [4, "普通"], [5, "S级"]],
|
||||
EnumBookLeveTypeL: [[1, "A"], [2, "B"], [3, "C"]],
|
||||
EnumAdmActClass: [[50, "签约等级修改"], [51, "封面修改"], [52, "渠道添加"], [53, "渠道修改"], [54, "渠道删除"], [55, "章节删除"]],
|
||||
EnumSettlementType: [[0, "未结算"], [1, "已结算"], [2, "结算失败"]],
|
||||
EnumBookProcess: [[0, "连载"], [1, "完结"]],
|
||||
EnumAuthStatus: [[1 ,"独家"], [2, "非独家"]]
|
||||
};
|
||||
|
||||
function dateToDate(date) {
|
||||
var sDate = new Date();
|
||||
if (typeof date == 'object'
|
||||
&& typeof new Date().getMonth == "function"
|
||||
) {
|
||||
sDate = date;
|
||||
}
|
||||
else if (typeof date == "string") {
|
||||
var arr = date.split('-')
|
||||
if (arr.length == 3) {
|
||||
sDate = new Date(arr[0] + '-' + arr[1] + '-' + arr[2]);
|
||||
}
|
||||
}
|
||||
|
||||
return sDate;
|
||||
}
|
||||
|
||||
|
||||
function addMonth(date, num) {
|
||||
num = parseInt(num);
|
||||
var sDate = dateToDate(date);
|
||||
|
||||
var sYear = sDate.getFullYear();
|
||||
var sMonth = sDate.getMonth() + 1;
|
||||
var sDay = sDate.getDate();
|
||||
|
||||
var eYear = sYear;
|
||||
var eMonth = sMonth + num;
|
||||
var eDay = sDay;
|
||||
while (eMonth > 12) {
|
||||
eYear++;
|
||||
eMonth -= 12;
|
||||
}
|
||||
|
||||
var eDate = new Date(eYear, eMonth - 1, eDay);
|
||||
|
||||
while (eDate.getMonth() != eMonth - 1) {
|
||||
eDay--;
|
||||
eDate = new Date(eYear, eMonth - 1, eDay);
|
||||
}
|
||||
|
||||
return eDate;
|
||||
}
|
||||
|
||||
function checkAll() {
|
||||
if ($("#selAll").attr("checked")) {
|
||||
$("input[name='selBox']").each(function () {
|
||||
$(this).attr("checked", true);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("input[name='selBox']").each(function () {
|
||||
$(this).removeAttr("checked");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
initSubmitButton(3);
|
||||
});
|
||||
|
||||
//停留时间
|
||||
function initSubmitButton(wait) {
|
||||
$("input[type='submit']").each(function () {
|
||||
$(this).click(function () {
|
||||
if ($(this).attr("submited") == "1") {
|
||||
return false;
|
||||
}
|
||||
var oldVal = $(this).val();
|
||||
$(this).val("正在处理,请稍等(" + wait + ")");
|
||||
$(this).attr("submited", "1");
|
||||
setTimeout('ButtonLimit("' + $(this).attr("id") + '",' + wait + ',"' + oldVal + '")', 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
function ButtonLimit(objId, wait, oldVal) {
|
||||
wait--;
|
||||
if (wait > 0) {
|
||||
$("#" + objId).val("正在处理,请稍等(" + wait + ")");
|
||||
setTimeout('ButtonLimit("' + objId + '",' + wait + ',"' + oldVal + '");', 1000);
|
||||
}
|
||||
else {
|
||||
$("#" + objId).removeAttr("submited");
|
||||
$("#" + objId).val(oldVal);
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
var needLoginPath = ['/user/favorites.html','/user/comment.html','/user/feedback.html',
|
||||
'/user/feedback_list.html','/user/read_history.html','/user/set_name.html',
|
||||
'/user/set_password.html','/user/set_sex.html','/user/setup.html','/user/userinfo.html'];
|
||||
'/user/set_password.html','/user/set_sex.html','/user/setup.html','/user/userinfo.html',
|
||||
"/pay/index.html," +
|
||||
"/author/register.html","/author/index.html"];
|
||||
var isLogin = false;
|
||||
var url = window.location.search;
|
||||
//key(需要检索的键)
|
||||
|
@ -0,0 +1,70 @@
|
||||
if ($.fn.pagination){
|
||||
$.fn.pagination.defaults.beforePageText = '第';
|
||||
$.fn.pagination.defaults.afterPageText = '共{pages}页';
|
||||
$.fn.pagination.defaults.displayMsg = '显示{from}到{to},共{total}记录';
|
||||
}
|
||||
if ($.fn.datagrid){
|
||||
$.fn.datagrid.defaults.loadMsg = '请稍后…';
|
||||
}
|
||||
if ($.fn.treegrid && $.fn.datagrid){
|
||||
$.fn.treegrid.defaults.loadMsg = $.fn.datagrid.defaults.loadMsg;
|
||||
}
|
||||
if ($.messager){
|
||||
$.messager.defaults.ok = '确定';
|
||||
$.messager.defaults.cancel = '取消';
|
||||
}
|
||||
if ($.fn.validatebox){
|
||||
$.fn.validatebox.defaults.missingMessage = '该输入项为必输项';
|
||||
$.fn.validatebox.defaults.rules.email.message = '请输入有效的电子邮件地址';
|
||||
$.fn.validatebox.defaults.rules.url.message = '请输入有效的URL地址';
|
||||
$.fn.validatebox.defaults.rules.length.message = '输入内容长度必须介于{0}和{1}之间';
|
||||
$.fn.validatebox.defaults.rules.remote.message = '请修正该字段';
|
||||
}
|
||||
if ($.fn.numberbox){
|
||||
$.fn.numberbox.defaults.missingMessage = '该输入项为必输项';
|
||||
}
|
||||
if ($.fn.combobox){
|
||||
$.fn.combobox.defaults.missingMessage = '该输入项为必输项';
|
||||
}
|
||||
if ($.fn.combotree){
|
||||
$.fn.combotree.defaults.missingMessage = '该输入项为必输项';
|
||||
}
|
||||
if ($.fn.combogrid){
|
||||
$.fn.combogrid.defaults.missingMessage = '该输入项为必输项';
|
||||
}
|
||||
if ($.fn.calendar){
|
||||
$.fn.calendar.defaults.weeks = ['日','一','二','三','四','五','六'];
|
||||
$.fn.calendar.defaults.months = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'];
|
||||
}
|
||||
if ($.fn.datebox){
|
||||
$.fn.datebox.defaults.currentText = '今天';
|
||||
$.fn.datebox.defaults.closeText = '关闭';
|
||||
$.fn.datebox.defaults.okText = '确定';
|
||||
$.fn.datebox.defaults.missingMessage = '该输入项为必输项';
|
||||
$.fn.datebox.defaults.formatter = function(date){
|
||||
var y = date.getFullYear();
|
||||
var m = date.getMonth()+1;
|
||||
var d = date.getDate();
|
||||
return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
|
||||
};
|
||||
$.fn.datebox.defaults.parser = function(s){
|
||||
if (!s) return new Date();
|
||||
var ss = s.split('-');
|
||||
var y = parseInt(ss[0],10);
|
||||
var m = parseInt(ss[1],10);
|
||||
var d = parseInt(ss[2],10);
|
||||
if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
|
||||
return new Date(y,m-1,d);
|
||||
} else {
|
||||
return new Date();
|
||||
}
|
||||
};
|
||||
}
|
||||
if ($.fn.datetimebox && $.fn.datebox){
|
||||
$.extend($.fn.datetimebox.defaults,{
|
||||
currentText: $.fn.datebox.defaults.currentText,
|
||||
closeText: $.fn.datebox.defaults.closeText,
|
||||
okText: $.fn.datebox.defaults.okText,
|
||||
missingMessage: $.fn.datebox.defaults.missingMessage
|
||||
});
|
||||
}
|
16103
novel-front/src/main/resources/static/javascript/jquery.easyui.min.js
vendored
Normal file
16103
novel-front/src/main/resources/static/javascript/jquery.easyui.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
93
novel-front/src/main/resources/static/javascript/pay.js
Normal file
93
novel-front/src/main/resources/static/javascript/pay.js
Normal file
@ -0,0 +1,93 @@
|
||||
var UserPay = {
|
||||
czData: [[30, "3000屋币"], [50, "5000屋币"], [100, "10000屋币"], [200, "20000屋币"], [500, "50000屋币"], [365, "全站包年阅读"] ],
|
||||
czPayPalData: [[20, "10000屋币"], [50, "25000屋币"], [100, "50000屋币"], [80, "全站包年阅读"]],
|
||||
sendPay: function () {
|
||||
$("#payform").submit();
|
||||
},
|
||||
GetPayState: function (payId) {
|
||||
$.post("/api/book.aspx", { act: "getpaystatus", pid: payId }, function (data, textStatus) {
|
||||
if (data == "1") {
|
||||
location.href = '/pay/wx_return.aspx?out_trade_no=sc'+payId;
|
||||
}
|
||||
else {
|
||||
setTimeout("UserPay.GetPayState("+payId+")",3000);
|
||||
}
|
||||
}, "html");
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$("#ulPayType li").click(function () {
|
||||
|
||||
if($(this).attr("valp")==2){
|
||||
layer.alert("微信支付暂未开通,敬请期待");
|
||||
}
|
||||
|
||||
return ;
|
||||
|
||||
|
||||
|
||||
$($(this).parent()).children().each(function () {
|
||||
$(this).removeClass("on");
|
||||
});
|
||||
$(this).addClass("on");
|
||||
|
||||
var type = $(this).attr("valp");
|
||||
if (type == "3") {
|
||||
$("#ulPayPal").show();
|
||||
$("#ulPayPalXJ").show();
|
||||
$("#ulZFWX").hide();
|
||||
$("#ulZFWXXJ").hide();
|
||||
}
|
||||
else {
|
||||
$("#ulPayPal").hide();
|
||||
$("#ulPayPalXJ").hide();
|
||||
$("#ulZFWX").show();
|
||||
$("#ulZFWXXJ").show();
|
||||
}
|
||||
|
||||
var postUrl = "";
|
||||
switch (type)
|
||||
{
|
||||
case "1":
|
||||
postUrl = "sendalipay.aspx";
|
||||
break;
|
||||
case "2":
|
||||
postUrl = "sendwxpaynowqr.aspx";
|
||||
break;
|
||||
case "3":
|
||||
postUrl = "sendpaypal.aspx";
|
||||
break;
|
||||
}
|
||||
$("#payform").attr("action", postUrl);
|
||||
})
|
||||
|
||||
$("#ulZFWX li").click(function () {
|
||||
$("#ulZFWX li").removeClass("on");
|
||||
$(this).addClass("on");
|
||||
if ($(this).attr("vals") > 0) {
|
||||
$("#pValue").val($(this).attr("vals"));
|
||||
$("#showTotal").html('¥' + $(this).attr("vals") + '元');
|
||||
for (var i = 0; i < UserPay.czData.length; i++) {
|
||||
if (UserPay.czData[i][0] == $(this).attr("vals")) {
|
||||
$("#showRemark").html(UserPay.czData[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#ulPayPal li").click(function () {
|
||||
$("#ulPayPal li").removeClass("on");
|
||||
$(this).addClass("on");
|
||||
if ($(this).attr("vals") > 0) {
|
||||
$("#pValue").val($(this).attr("vals"));
|
||||
$("#showPayPalTotal").html($(this).attr("vals") + '美元');
|
||||
for (var i = 0; i < UserPay.czData.length; i++) {
|
||||
if (UserPay.czPayPalData[i][0] == $(this).attr("vals")) {
|
||||
$("#showPayPalRemark").html(UserPay.czPayPalData[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
58
novel-front/src/main/resources/static/javascript/ycUtils.js
Normal file
58
novel-front/src/main/resources/static/javascript/ycUtils.js
Normal file
@ -0,0 +1,58 @@
|
||||
var SCYC = {
|
||||
}
|
||||
|
||||
$.extend($.fn.validatebox.defaults.rules, {
|
||||
checkBookName: {
|
||||
validator: function (value, param) {
|
||||
var url = "/aspx/book/booklist.aspx";
|
||||
var data = { bid: param, bname: value, act: "getbooknamerepeat" };
|
||||
var bool = false;
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: 'html',
|
||||
async: false,
|
||||
url: url,
|
||||
data: data,
|
||||
cache: false,
|
||||
success: function (result) {
|
||||
if (result == "1") {
|
||||
$.fn.validatebox.defaults.rules.checkBookName.message = '该书名已存在,请重新输入';
|
||||
bool = false;
|
||||
} else {
|
||||
$.fn.validatebox.defaults.rules.checkBookName.message = '';
|
||||
bool = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
return bool;
|
||||
message: '';
|
||||
}
|
||||
},
|
||||
checkNiceName: {
|
||||
validator: function (value, param) {
|
||||
var url = "/author/checkPenName";
|
||||
var data = { penName: value};
|
||||
var bool = false;
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
url: url,
|
||||
data: data,
|
||||
cache: false,
|
||||
success: function (result) {
|
||||
if (result.data) {
|
||||
$.fn.validatebox.defaults.rules.checkNiceName.message = '笔名已存在,请重新输入';
|
||||
bool = false;
|
||||
} else {
|
||||
$.fn.validatebox.defaults.rules.checkNiceName.message = '';
|
||||
bool = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
return bool;
|
||||
message: '';
|
||||
}
|
||||
}
|
||||
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
src/js/util/ierange.js
|
||||
src/js/util/poly-fill.js
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"es6": true
|
||||
},
|
||||
"globals": {
|
||||
"ENV": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"no-console":0,
|
||||
"indent": [
|
||||
"error",
|
||||
4
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single",
|
||||
{
|
||||
"allowTemplateLiterals": true
|
||||
}
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"no-unused-vars": 0,
|
||||
"no-debugger": 0
|
||||
}
|
||||
}
|
22
novel-front/src/main/resources/static/wangEditor/.gitattributes
vendored
Normal file
22
novel-front/src/main/resources/static/wangEditor/.gitattributes
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
51
novel-front/src/main/resources/static/wangEditor/.gitignore
vendored
Normal file
51
novel-front/src/main/resources/static/wangEditor/.gitignore
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
#忽略
|
||||
**/node_modules/*
|
||||
node_modules/*
|
||||
npm-debug.log
|
||||
example/upload-files
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# =========================
|
||||
# Operating System Files
|
||||
# =========================
|
||||
|
||||
# OSX
|
||||
# =========================
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear on external disk
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
@ -0,0 +1,5 @@
|
||||
node_modules/*
|
||||
npm-debug.log
|
||||
docs/*
|
||||
src/*
|
||||
example/*
|
157
novel-front/src/main/resources/static/wangEditor/ISSUE.md
Normal file
157
novel-front/src/main/resources/static/wangEditor/ISSUE.md
Normal file
@ -0,0 +1,157 @@
|
||||
# 问题记录
|
||||
|
||||
## 版本修复
|
||||
|
||||
### v3.0.1
|
||||
|
||||
- [done] 如何设置自动增加高度(补充文档)
|
||||
- [done] src/js/editor/Bar 改为 Progress,仅供上传图片使用
|
||||
- [done] Panel 在右上角增加一个“关闭”按钮
|
||||
- [done] 显示页面 table、quote、code 等样式,说明一下
|
||||
- [done] 增加自定义上传回调函数,用以自定义返回图片的格式
|
||||
- [done] 上传附带的参数,也加入到 form-data 中一份
|
||||
- [done] 编辑器默认情况下,菜单栏不能点击,必须focus了编辑器求之后才能点击
|
||||
- [done] 点击菜单弹出panel之后,再点击编辑器区域其他地方,panel不消失
|
||||
- [done] 自定义filename,v2版本就有
|
||||
- [done] ff 中的 bug
|
||||
- [done] ff 中粘贴图片和文字出现问题 https://github.com/wangfupeng1988/wangEditor/issues/609
|
||||
- [done] 火狐浏览器下,创建表格,编辑表格内容时,会出现两个控制点(有人提供了解决方案)
|
||||
- [done] 配置最多上传的文件个数
|
||||
- [done] 连续给两段内容 添加有/无序列表时,样式会出问题,且其他内容找不到了,并且编辑器不处于编辑状态。
|
||||
- [done] onchange
|
||||
- [done] IE11下面一直报错。并且表格无法正常使用
|
||||
|
||||
### v3.0.2
|
||||
|
||||
- [done] 用 onchange 完善 vue react 的 demo
|
||||
- [done] 插入图片之后,光标移动到图片的前面,然后回车,图片消失,并且不能撤销
|
||||
- [done] 修复上传图片 customInsert 无效的bug
|
||||
- [done] 编辑区域 z-index 可配置
|
||||
- [done] 上传图片不应该把状态码限制在 200,而是 2xx
|
||||
- [done] editor.txt.html() 之后,没有定位光标位置
|
||||
|
||||
### v3.0.3
|
||||
|
||||
- [done] 粘贴图片在低版本的谷歌浏览器中无法使用,提示验证图片未通过,undefined不是图片。
|
||||
- [done] 动态赋值内容,会自动换行,因为给自动加了`<p><br></p>`
|
||||
- [done] 不选中任何内容,点击“加粗”报错:Failed to execute 'setEnd' on 'Range'
|
||||
- [done] toolbar 小图标的 z-index 可配置
|
||||
|
||||
### v3.0.4
|
||||
|
||||
- [done] 允许使用者通过`replace`实现多语言
|
||||
- [done] `_alert()`,可自定义配置提示框
|
||||
- [done] 支持用户自定义上传图片的事件,如用户要上传到七牛云、阿里云
|
||||
|
||||
### v3.0.5
|
||||
|
||||
- [done] 图片上传中,insertLinkImg 方法中,去掉 img.onload 之后再插入的逻辑吧,这样会打乱多个图片的顺序
|
||||
- [done] `<h>` 标签重叠问题,两行文字都是`h2`,然后将第一行选中设置为`h1`,结果是 `<h2><h1>测试1</h1>测试2</h2>`
|
||||
- [done] 补充 ng 集成的示例 https://github.com/wangfupeng1988/wangEditor/issues/859
|
||||
- [done] 菜单不能折叠的说明,加入到文档中
|
||||
- [done] 上传图片 before 函数中,增加一个判断,可以让用户终止图片的上传
|
||||
|
||||
### v3.0.6
|
||||
|
||||
- [done] src/fonts 中的字体文件名改一下,用 icomoon 容易发生冲突
|
||||
- [done] 将禁用编辑器的操作完善到文档中 https://www.kancloud.cn/wangfupeng/wangeditor3/368562
|
||||
- [done] 开放表格中的粘贴功能(之前因不明问题而封闭)
|
||||
- [done] 代码块中,光标定位到最后位置时,连续两次回车要跳出代码块
|
||||
|
||||
### v3.0.7
|
||||
|
||||
- [done] 紧急修复上一个版本导致的菜单图标不显示的 bug
|
||||
|
||||
### v3.0.8
|
||||
|
||||
- [done] 修复 backColor 和 foreColor 代码文件名混淆的问题
|
||||
- [done] 修改 IE 中 “引用” 的功能
|
||||
- [done] 增加粘贴过滤样式的可配置
|
||||
- [done] 修复 IE 粘贴文字的问题
|
||||
|
||||
### v3.0.9
|
||||
|
||||
- [done] config 中,上传图片的 token 注视掉
|
||||
- [done] 将一些常见 API 开放,写到文档中 https://www.kancloud.cn/wangfupeng/wangeditor3/404586
|
||||
- [done] IE 火狐 插入多行代码有问题
|
||||
- [done] 粘贴时,在`<p>`中,不能只粘贴纯文本,还得要图片
|
||||
- [done] 粘贴内容中,过滤掉`<!--xxx-->`注释
|
||||
- [done] **支持上传七牛云存储**
|
||||
|
||||
### v3.0.10
|
||||
|
||||
- [done] 支持插入网络图片的回调函数
|
||||
- [done] 插入链接时候的格式校验
|
||||
- [done] 支持拖拽上传
|
||||
|
||||
### v3.0.11
|
||||
|
||||
- [done] 如何用 textarea 创建编辑器,完善到文档中,许多人提问
|
||||
- [done] 修复`editor.customConfig.customUploadImg`不触发的 bug
|
||||
- [done] 修复有序列表和无序列表切换时 onchange 不触发的 bug
|
||||
|
||||
### v3.0.12
|
||||
|
||||
- [done] 增加 onfocus 和 onblur (感谢 [hold-baby](https://github.com/hold-baby) 提交的 [PR](https://github.com/wangfupeng1988/wangEditor/pull/1076))
|
||||
- [done] 上传的自定义参数`editor.customConfig.uploadImgParams`是否拼接到 url 中,支持可配置
|
||||
- [done] onchange 触发的延迟时间,支持可配置
|
||||
|
||||
### v3.0.13
|
||||
|
||||
- [done] 修复图片 选中/取消选中 时,触发 onchange 的问题
|
||||
- [done] 修复只通过 length 判断 onchange 是否触发的问题
|
||||
- [done] 增加插入网络图片的校验函数
|
||||
- [done] 增加自定义处理粘贴文本的事件
|
||||
- [done] 修复选中一个图片时点击删除键会误删除其他内容的 bug
|
||||
- [done] 修复 window chrome 中“复制图片”然后粘贴图片,会粘贴为两张的 bug
|
||||
- [done] 修复无法撤销“引用”的问题
|
||||
|
||||
### v3.0.14
|
||||
|
||||
- [done] 可以配置前景色、背景色
|
||||
- [done] 回车时无法从`<p><code>....</code></p>`中跳出
|
||||
- [done] 增加获取 JSON 格式内容的 API
|
||||
|
||||
### v3.0.15
|
||||
|
||||
- [done] 表情兼容图片和 emoji ,都可自定义配置
|
||||
|
||||
### v3.0.16
|
||||
|
||||
- [done] 修复粘贴图片的 bug
|
||||
- [done] 修复`pasteTextHandle`执行两次的问题
|
||||
- [done] 修复插入链接时,文字和链接为空时,`linkCheck`不执行的 bug
|
||||
- [done] 粘贴 html 时,过滤掉其中的`data-xxx`属性
|
||||
- [done] 修复中文输入法输入过程中出发 onchange 的问题,感谢 [github.com/CongAn](https://github.com/CongAn) PR
|
||||
- [done] `editor.txt.html`和`editor.txt.text`中,替换`​`字符为空字符串
|
||||
- [done] 精确图片大小计算,将`maxSize / 1000 / 1000`改为`maxSize / 1024 / 1024`
|
||||
- [done] 修复 droplist 类型菜单(颜色、背景色等)点击不准确的问题
|
||||
|
||||
### v3.0.17
|
||||
|
||||
- [done] 合并 pr [菜单和编辑区域分离 onfocus onblur 失效bug](https://github.com/wangfupeng1988/wangEditor/pull/1174) ,感谢 [hold-baby](https://github.com/hold-baby) 提供 pr
|
||||
- [done] 使用`document.execCommand("styleWithCSS", null, true)`,这样设置字体颜色就会用 css 而不是用`<font color=xxx>`
|
||||
|
||||
|
||||
### 近期计划解决
|
||||
|
||||
- 撤销的兼容性问题(会误伤其他编辑器或者 input textarea 等),考虑用 onchange 记录 undo 和 redo 的内容(但是得考虑直接修改 dom 的情况,如 quote code img list table 菜单)
|
||||
- 列表撤销会删除一行?https://github.com/wangfupeng1988/wangEditor/issues/1131
|
||||
- 页面中有 input 等输入标签时,undo redo 会误伤 https://github.com/wangfupeng1988/wangEditor/issues/1024
|
||||
- 两个编辑器 undo 的问题 https://github.com/wangfupeng1988/wangEditor/issues/1010
|
||||
- list undo redo 有问题。选中几行,先设置有序列表,再设置无序列表,然后撤销,就能复现问题
|
||||
- 粘贴文字的样式问题(可暂时配置 `pasteTextHandle` 自行处理)
|
||||
- 先输入文字,再粘贴 excel 表格,样式丢失 https://github.com/wangfupeng1988/wangEditor/issues/1000
|
||||
- IE 11 直接输入文字会空一行在第二行出现内容 https://github.com/wangfupeng1988/wangEditor/issues/919
|
||||
- windows 下 word excel 的粘贴,存在垃圾数据
|
||||
|
||||
## 待排期
|
||||
|
||||
- 调研 safari、IE 和ff中粘贴图片 https://github.com/wangfupeng1988/wangEditor/issues/831
|
||||
- 图片调整大小,表格调整的方式,是否用 toolbar 的方式?
|
||||
- 删除掉`./release`之后,执行`npm run release`会报错,原因是`fonts`文件没拷贝全,就要去替换`css`中的字体文件为`base64`格式,导致找不到文件。
|
||||
- 先点击'B'再输入内容这种形式,前期先支持 webkit 和 IE,火狐的支持后面再加上
|
||||
- 图片压缩 canvas https://github.com/think2011/localResizeIMG
|
||||
- github 徽章 https://github.com/EyreFree/GitHubBadgeIntroduction
|
||||
- 将代码在进行拆分,做到“每个程序只做一件事”,不要出现过长的代码文件。例如 `src/js/command/index.js` 和 `src/js/selection/index.js`
|
||||
|
22
novel-front/src/main/resources/static/wangEditor/LICENSE
Normal file
22
novel-front/src/main/resources/static/wangEditor/LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 王福朋
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
70
novel-front/src/main/resources/static/wangEditor/README.md
Normal file
70
novel-front/src/main/resources/static/wangEditor/README.md
Normal file
@ -0,0 +1,70 @@
|
||||
|
||||
# wangEditor
|
||||
|
||||
## 介绍
|
||||
|
||||
**wangEditor** —— 轻量级 web 富文本编辑器,配置方便,使用简单。支持 IE10+ 浏览器。
|
||||
|
||||
- 官网:[www.wangEditor.com](http://www.wangeditor.com/)
|
||||
- 文档:[www.kancloud.cn/wangfupeng/wangeditor3/332599](http://www.kancloud.cn/wangfupeng/wangeditor3/332599)
|
||||
- 源码:[github.com/wangfupeng1988/wangEditor](https://github.com/wangfupeng1988/wangEditor) (欢迎 star)
|
||||
|
||||

|
||||
|
||||
*查看 v2 版本的代码和文档点击[这里](https://github.com/wangfupeng1988/wangEditor/tree/v2)*
|
||||
|
||||
|
||||
## 下载
|
||||
|
||||
- 直接下载:[https://github.com/wangfupeng1988/wangEditor/releases](https://github.com/wangfupeng1988/wangEditor/releases)
|
||||
- 使用`npm`下载:`npm install wangeditor` (注意 `wangeditor` 全部是**小写字母**)
|
||||
- 使用`bower`下载:`bower install wangEditor` (前提保证电脑已安装了`bower`)
|
||||
- 使用CDN:[//unpkg.com/wangeditor/release/wangEditor.min.js](https://unpkg.com/wangeditor/release/wangEditor.min.js)
|
||||
|
||||
|
||||
## 使用
|
||||
|
||||
```javascript
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#div1')
|
||||
editor.create()
|
||||
```
|
||||
|
||||
|
||||
## 运行 demo
|
||||
|
||||
- 下载源码 `git clone git@github.com:wangfupeng1988/wangEditor.git`
|
||||
- 安装或者升级最新版本 node(最低`v6.x.x`)
|
||||
- 进入目录,安装依赖包 `cd wangEditor && npm i`
|
||||
- 安装包完成之后,windows 用户运行`npm run win-example`,Mac 用户运行`npm run example`
|
||||
- 打开浏览器访问[localhost:3000/index.html](http://localhost:3000/index.html)
|
||||
- 用于 React、vue 或者 angular 可查阅[文档](http://www.kancloud.cn/wangfupeng/wangeditor3/332599)中[其他](https://www.kancloud.cn/wangfupeng/wangeditor3/335783)章节中的相关介绍
|
||||
|
||||
## 交流
|
||||
|
||||
### QQ 群
|
||||
|
||||
以下 QQ 群欢迎加入交流问题(可能有些群已经满员)
|
||||
|
||||
- 164999061
|
||||
- 281268320
|
||||
|
||||
### 提问
|
||||
|
||||
注意,作者只受理以下几种提问方式,其他方式直接忽略
|
||||
|
||||
- 直接在 [github issues](https://github.com/wangfupeng1988/wangEditor/issues) 提交问题
|
||||
- 去[知乎](https://www.zhihu.com/)提问,并邀请[作者](https://www.zhihu.com/people/wang-fu-peng-54/activities)来回答
|
||||
- 去[segmentfault](https://segmentfault.com)提问,并邀请[作者](https://segmentfault.com/u/wangfupeng1988)来回答
|
||||
|
||||
每次升级版本修复的问题记录在[这里](./ISSUE.md)
|
||||
|
||||
## 关于作者
|
||||
|
||||
- 关注作者的博客 - 《[深入理解javascript原型和闭包系列](http://www.cnblogs.com/wangfupeng1988/p/4001284.html)》《[深入理解javascript异步系列](https://github.com/wangfupeng1988/js-async-tutorial)》《[CSS知多少](http://www.cnblogs.com/wangfupeng1988/p/4325007.html)》
|
||||
- 学习作者的教程 - 《[前端JS基础面试题](http://coding.imooc.com/class/115.html)》《[React.js模拟大众点评webapp](http://coding.imooc.com/class/99.html)》《[zepto设计与源码分析](http://www.imooc.com/learn/745)》《[用grunt搭建自动化的web前端开发环境](http://study.163.com/course/courseMain.htm?courseId=1103003)》《[json2.js源码解读](http://study.163.com/course/courseMain.htm?courseId=691008)》
|
||||
|
||||
如果你感觉有收获,欢迎给我打赏 ———— 以激励我更多输出优质开源内容
|
||||
|
||||

|
||||
|
20
novel-front/src/main/resources/static/wangEditor/bower.json
Normal file
20
novel-front/src/main/resources/static/wangEditor/bower.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "wangEditor",
|
||||
"description": "wangEditor - 基于javascript和css开发的 web 富文本编辑器, 轻量、简洁、易用、开源免费",
|
||||
"main": "release/wangEditor.js",
|
||||
"authors": [
|
||||
"wangfupeng <wangfupeng1988@163.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"wangEditor",
|
||||
"web 富文本编辑器"
|
||||
],
|
||||
"homepage": "https://github.com/wangfupeng1988/wangEditor",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"cmd",
|
||||
"node"
|
||||
],
|
||||
"private": true
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
面向开发者的文档
|
||||
|
||||
|
||||
框架介绍
|
||||
|
||||
- 下载和运行
|
||||
- 目录结构介绍
|
||||
- `example`目录
|
||||
- `src`目录(`js`目录,`less`目录)
|
||||
- `package.json`
|
||||
- `gulpfile.js`
|
||||
|
||||
如何提交 PR
|
||||
|
||||
|
||||
|
||||
上线
|
||||
|
||||
- 修改`package.json`版本
|
||||
- 提交到github,并创建tag
|
||||
- 提交到 npm
|
||||
- 更新 .md 文档
|
||||
- 文档同步到 kancloud
|
||||
- ……
|
||||
|
@ -0,0 +1,41 @@
|
||||
# 简单的 demo
|
||||
|
||||
## 下载
|
||||
|
||||
- 点击 [https://github.com/wangfupeng1988/wangEditor/releases](https://github.com/wangfupeng1988/wangEditor/releases) 下载最新版。进入`release`文件夹下找到`wangEditor.js`或者`wangEditor.min.js`即可
|
||||
- 使用CDN:[//unpkg.com/wangeditor/release/wangEditor.min.js](https://unpkg.com/wangeditor/release/wangEditor.min.js)
|
||||
- 使用`bower`下载:`bower install wangEditor` (前提保证电脑已安装了`bower`)
|
||||
|
||||
*PS:支持`npm`安装,请参见后面的章节*
|
||||
|
||||
## 制作 demo
|
||||
|
||||
编辑器效果如下。
|
||||
|
||||

|
||||
|
||||
代码示例如下。**注意,以下代码中无需引用任何 CSS 文件!!!**
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>wangEditor demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="editor">
|
||||
<p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
|
||||
</div>
|
||||
|
||||
<!-- 注意, 只需要引用 JS,无需引用任何 CSS !!!-->
|
||||
<script type="text/javascript" src="/wangEditor.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#editor')
|
||||
// 或者 var editor = new E( document.getElementById('#editor') )
|
||||
editor.create()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
@ -0,0 +1,49 @@
|
||||
# 使用模块定义
|
||||
|
||||
wangEditor 除了直接使用`<script>`引用之外,还支持`AMD`和`CommonJS`的引用方式。
|
||||
|
||||
## AMD
|
||||
|
||||
以`require.js`为例演示
|
||||
|
||||
先创建`main.js`,代码为
|
||||
|
||||
```javascript
|
||||
require(['/wangEditor.min.js'], function (E) {
|
||||
var editor = new E('#editor')
|
||||
editor.create()
|
||||
})
|
||||
```
|
||||
|
||||
然后创建页面,代码为
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>wangEditor demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="editor">
|
||||
<p>欢迎使用 wangEditor 富文本编辑器</p>
|
||||
</div>
|
||||
|
||||
<script data-main="./main.js" src="//cdn.bootcss.com/require.js/2.3.3/require.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## CommonJS
|
||||
|
||||
可以使用`npm install wangeditor`安装(注意,这里`wangeditor`全是**小写字母**)
|
||||
|
||||
```javascript
|
||||
// 引用
|
||||
var E = require('wangeditor') // 使用 npm 安装
|
||||
var E = require('/wangEditor.min.js') // 使用下载的源码
|
||||
|
||||
// 创建编辑器
|
||||
var editor = new E('#editor')
|
||||
editor.create()
|
||||
```
|
@ -0,0 +1,48 @@
|
||||
# 菜单和编辑区域分离
|
||||
|
||||
如果你想要像 知乎专栏、简书、石墨、网易云笔记 这些编辑页面一样,将编辑区域和菜单分离,也可以实现。
|
||||
|
||||
这样,菜单和编辑器区域就是使用者可自己控制的元素,可自定义样式。例如:将菜单`fixed`、编辑器区域高度自动增加等
|
||||
|
||||
## 代码示例
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>wangEditor 菜单和编辑器区域分离</title>
|
||||
<style type="text/css">
|
||||
.toolbar {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
.text {
|
||||
border: 1px solid #ccc;
|
||||
height: 400px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="div1" class="toolbar">
|
||||
</div>
|
||||
<div style="padding: 5px 0; color: #ccc">中间隔离带</div>
|
||||
<div id="div2" class="text"> <!--可使用 min-height 实现编辑区域自动增加高度-->
|
||||
<p>请输入内容</p>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/wangEditor.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var E = window.wangEditor
|
||||
var editor1 = new E('#div1', '#div2') // 两个参数也可以传入 elem 对象,class 选择器
|
||||
editor1.create()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## 显示效果
|
||||
|
||||
从上面代码可以看出,菜单和编辑区域其实就是两个单独的`<div>`,位置、尺寸都可以随便定义。
|
||||
|
||||

|
||||
|
@ -0,0 +1,50 @@
|
||||
# 同一个页面创建多个编辑器
|
||||
|
||||
wangEditor 支持一个页面创建多个编辑器
|
||||
|
||||
## 代码示例
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>wangEditor 一个页面多个编辑器</title>
|
||||
<style type="text/css">
|
||||
.toolbar {
|
||||
background-color: #f1f1f1;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
.text {
|
||||
border: 1px solid #ccc;
|
||||
height: 200px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="div1" class="toolbar">
|
||||
</div>
|
||||
<div style="padding: 5px 0; color: #ccc">中间隔离带</div>
|
||||
<div id="div2" class="text">
|
||||
<p>第一个 demo(菜单和编辑器区域分开)</p>
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<p>第二个 demo(常规)</p>
|
||||
</div>
|
||||
|
||||
<!-- 引用js -->
|
||||
<script type="text/javascript" src="/wangEditor.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var E = window.wangEditor
|
||||
|
||||
var editor1 = new E('#div1', '#div2')
|
||||
editor1.create()
|
||||
|
||||
var editor2 = new E('#div3')
|
||||
editor2.create()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
@ -0,0 +1,46 @@
|
||||
# 设置内容
|
||||
|
||||
以下方式中,如果条件允许,尽量使用第一种方式,效率最高。
|
||||
|
||||
## html 初始化内容
|
||||
|
||||
直接将内容写到要创建编辑器的`<div>`标签中
|
||||
|
||||
```html
|
||||
<div id="div1">
|
||||
<p>初始化的内容</p>
|
||||
<p>初始化的内容</p>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/wangEditor.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#div1')
|
||||
editor.create()
|
||||
</script>
|
||||
```
|
||||
|
||||
## js 设置内容
|
||||
|
||||
创建编辑器之后,使用`editor.txt.html(...)`设置编辑器内容
|
||||
|
||||
```html
|
||||
<div id="div1">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/wangEditor.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#div1')
|
||||
editor.create()
|
||||
editor.txt.html('<p>用 JS 设置的内容</p>')
|
||||
</script>
|
||||
```
|
||||
|
||||
## 追加内容
|
||||
|
||||
创建编辑器之后,可使用`editor.txt.append('<p>追加的内容</p>')`继续追加内容。
|
||||
|
||||
## 清空内容
|
||||
|
||||
可使用`editor.txt.clear()`清空编辑器内容
|
@ -0,0 +1,80 @@
|
||||
# 读取内容
|
||||
|
||||
可以`html`和`text`的方式读取编辑器的内容。
|
||||
|
||||
```html
|
||||
<div id="div1">
|
||||
<p>欢迎使用 wangEditor 编辑器</p>
|
||||
</div>
|
||||
<button id="btn1">获取html</button>
|
||||
<button id="btn2">获取text</button>
|
||||
|
||||
<script type="text/javascript" src="/wangEditor.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#div1')
|
||||
editor.create()
|
||||
|
||||
document.getElementById('btn1').addEventListener('click', function () {
|
||||
// 读取 html
|
||||
alert(editor.txt.html())
|
||||
}, false)
|
||||
|
||||
document.getElementById('btn2').addEventListener('click', function () {
|
||||
// 读取 text
|
||||
alert(editor.txt.text())
|
||||
}, false)
|
||||
|
||||
</script>
|
||||
```
|
||||
|
||||
需要注意的是:**从编辑器中获取的 html 代码是不包含任何样式的纯 html**,如果显示的时候需要对其中的`<table>` `<code>` `<blockquote>`等标签进行自定义样式(这样既可实现多皮肤功能),下面提供了编辑器中使用的样式供参考
|
||||
|
||||
```css
|
||||
/* table 样式 */
|
||||
table {
|
||||
border-top: 1px solid #ccc;
|
||||
border-left: 1px solid #ccc;
|
||||
}
|
||||
table td,
|
||||
table th {
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
padding: 3px 5px;
|
||||
}
|
||||
table th {
|
||||
border-bottom: 2px solid #ccc;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* blockquote 样式 */
|
||||
blockquote {
|
||||
display: block;
|
||||
border-left: 8px solid #d0e5f2;
|
||||
padding: 5px 10px;
|
||||
margin: 10px 0;
|
||||
line-height: 1.4;
|
||||
font-size: 100%;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
/* code 样式 */
|
||||
code {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
background-color: #f1f1f1;
|
||||
border-radius: 3px;
|
||||
padding: 3px 5px;
|
||||
margin: 0 3px;
|
||||
}
|
||||
pre code {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* ul ol 样式 */
|
||||
ul, ol {
|
||||
margin: 10px 0 10px 20px;
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,25 @@
|
||||
# 使用 textarea
|
||||
|
||||
wangEditor 从`v3`版本开始不支持 textarea ,但是可以通过`onchange`来实现 textarea 中提交富文本内容。
|
||||
|
||||
```html
|
||||
<div id="div1">
|
||||
<p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
|
||||
</div>
|
||||
<textarea id="text1" style="width:100%; height:200px;"></textarea>
|
||||
|
||||
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../wangEditor.js"></script>
|
||||
<script type="text/javascript">
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#div1')
|
||||
var $text1 = $('#text1')
|
||||
editor.customConfig.onchange = function (html) {
|
||||
// 监控变化,同步更新到 textarea
|
||||
$text1.val(html)
|
||||
}
|
||||
editor.create()
|
||||
// 初始化 textarea 的值
|
||||
$text1.val(editor.txt.html())
|
||||
</script>
|
||||
```
|
@ -0,0 +1,82 @@
|
||||
# 获取 JSON 格式的内容
|
||||
|
||||
可以通过`editor.txt.getJSON`获取 JSON 格式的编辑器的内容,`v3.0.14`开始支持,示例如下
|
||||
|
||||
```html
|
||||
<div id="div1">
|
||||
<p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
|
||||
<img src="https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_ca79a146.png" style="max-width:100%;"/>
|
||||
</div>
|
||||
<button id="btn1">getJSON</button>
|
||||
|
||||
<script type="text/javascript" src="/wangEditor.js"></script>
|
||||
<script type="text/javascript">
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#div1')
|
||||
editor.create()
|
||||
|
||||
document.getElementById('btn1').addEventListener('click', function () {
|
||||
var json = editor.txt.getJSON() // 获取 JSON 格式的内容
|
||||
var jsonStr = JSON.stringify(json)
|
||||
console.log(json)
|
||||
console.log(jsonStr)
|
||||
})
|
||||
</script>
|
||||
```
|
||||
|
||||
|
||||
-----
|
||||
|
||||
如果编辑器区域的 html 内容是如下:
|
||||
|
||||
```html
|
||||
<p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
|
||||
<img src="https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_ca79a146.png" style="max-width:100%;"/>
|
||||
```
|
||||
|
||||
那么获取的 JSON 格式就如下:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"tag": "p",
|
||||
"attrs": [],
|
||||
"children": [
|
||||
"欢迎使用 ",
|
||||
{
|
||||
"tag": "b",
|
||||
"attrs": [],
|
||||
"children": [
|
||||
"wangEditor"
|
||||
]
|
||||
},
|
||||
" 富文本编辑器"
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "img",
|
||||
"attrs": [
|
||||
{
|
||||
"name": "src",
|
||||
"value": "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_ca79a146.png"
|
||||
},
|
||||
{
|
||||
"name": "style",
|
||||
"value": "max-width:100%;"
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"tag": "p",
|
||||
"attrs": [],
|
||||
"children": [
|
||||
{
|
||||
"tag": "br",
|
||||
"attrs": [],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user