Skip to content

Commit

Permalink
update:使用nutzboot-starter-nutz-jdbc替换dao.js,fix:#14
Browse files Browse the repository at this point in the history
  • Loading branch information
EggsBlue committed Feb 14, 2018
1 parent 33128a8 commit 9063393
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 154 deletions.
98 changes: 25 additions & 73 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<properties>
<nutzboot.version>2.2-SNAPSHOT</nutzboot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.25</slf4j.version>
</properties>
<dependencyManagement>
<dependencies>
Expand All @@ -29,104 +30,55 @@
<dependencies>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jetty</artifactId>
<artifactId>nutzboot-starter-nutz-mvc</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-nutz-mvc</artifactId>
<artifactId>nutzboot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-shiro</artifactId>
<artifactId>nutzboot-starter-nutz-dao</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-freemarker</artifactId>
</dependency>

<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-shiro</artifactId>
</dependency>
<!-- mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<!--<dependency> -->
<!--<groupId>org.freemarker</groupId> -->
<!--<artifactId>freemarker</artifactId> -->
<!--<version>2.3.26-incubating</version> -->
<!--</dependency> -->

<dependency>
<groupId>org.t-io</groupId>
<artifactId>tio-websocket-server</artifactId>
<version>0.0.8-tio-websocket</version>
</dependency>
<dependency>
<groupId>org.t-io</groupId>
<artifactId>tio-core</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>2.8.2</version>
</dependency>

<!--<dependency> -->
<!--<groupId>org.nutz</groupId> -->
<!--<artifactId>nutz-plugins-daocache</artifactId> -->
<!--<version>1.r.57</version> -->
<!--</dependency> -->

<!--<dependency> -->
<!--<groupId>org.nutz</groupId> -->
<!--<artifactId>nutz-plugins-views</artifactId> -->
<!--<version>1.r.63.r5</version> -->
<!--</dependency> -->
<!--<dependency> -->
<!--<groupId>org.nutz</groupId> -->
<!--<artifactId>nutz-integration-shiro</artifactId> -->
<!--<version>1.r.60</version> -->
<!--</dependency> -->
<!--<dependency> -->
<!--<groupId>org.apache.shiro</groupId> -->
<!--<artifactId>shiro-all</artifactId> -->
<!--<version>1.4.0</version> -->
<!--<exclusions> -->
<!--<exclusion> -->
<!--<artifactId>ehcache-core</artifactId> -->
<!--<groupId>net.sf.ehcache</groupId> -->
<!--</exclusion> -->
<!--</exclusions> -->
<!--</dependency> -->
<!--<dependency> -->
<!--<groupId>org.apache.shiro</groupId> -->
<!--<artifactId>shiro-core</artifactId> -->
<!--<version>1.4.0</version> -->
<!--</dependency> -->
<!--<dependency> -->
<!--<groupId>org.apache.shiro</groupId> -->
<!--<artifactId>shiro-web</artifactId> -->
<!--<version>1.4.0</version> -->
<!--</dependency> -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>

<!--<dependency> -->
<!--<groupId>org.springframework</groupId> -->
<!--<artifactId>spring-aop</artifactId> -->
<!--<version>4.3.12.RELEASE</version> -->
<!--</dependency> -->

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
</dependencies>
<build>
<finalName>lulichat</finalName>
Expand Down Expand Up @@ -170,7 +122,7 @@
</plugins>
</build>

<profiles>
<profiles>
<profile>
<id>jdk-1.8</id>
<!-- 另外一种激活方式 -->
Expand All @@ -184,9 +136,9 @@
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</profiles>

<repositories>
<repositories>
<repository>
<id>nutz</id>
<url>http://jfrog.nutz.cn/artifactory/libs-release</url>
Expand All @@ -205,5 +157,5 @@
<enabled>false</enabled>
</releases>
</repository>
</repositories>
</repositories>
</project>
26 changes: 26 additions & 0 deletions src/main/java/com/dd/controller/UploadModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,31 @@ public String getDir(){
log.debug("uploadDir:"+parent);
return parent;
}


/**
* 发送图片,上传图片接口
* @param file
* @param context
* @return
*/
@At
@POST
@Filters({@By(type=CrossOriginFilter.class)})
@AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp" })
public Object image2(@Param("file") TempFile file,ServletContext context){



String url = "";
//构建json数据
Map<String,Object> data = new HashMap<String,Object>();
data.put("code", "0");
data.put("msg", "");
Map<String,String> sourceUrl = new HashMap<String,String>();
sourceUrl.put("src", url);
data.put("data", sourceUrl);
return data;
}

}
14 changes: 13 additions & 1 deletion src/main/java/com/dd/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Table;

import java.sql.Timestamp;

/**
* Describe:用户表
* Author:蛋蛋
Expand All @@ -30,7 +32,8 @@ public class User {
private String avatar;
@Column
private String status;

@Column
private Timestamp create_time;

public int getId() {
return id;
Expand Down Expand Up @@ -68,6 +71,15 @@ public String getStatus() {
public void setStatus(String status) {
this.status = status;
}

public Timestamp getCreate_time() {
return create_time;
}

public void setCreate_time(Timestamp create_time) {
this.create_time = create_time;
}

@Override
public String toString() {
return "User [id=" + id + ", username=" + username + ", pwd=" + pwd + ", sign=" + sign + ", avatar=" + avatar
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/com/dd/socket/Accepter.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ public class Accepter implements IWsMsgHandler {
@Inject(value="userDao")
private UserDao userDao;

@Inject
private ReqMessageHandler reqMessageHandler;
@Inject
private DelFriendMessageHandler delFriendMessageHandler;
@Inject
private JoinGroupMessageHandler joinGroupMessageHandler;
@Inject
private OutGroupMessageHandler outGroupMessageHandler;
@Inject
private P2PMessageHandler p2PMessageHandler;
@Inject
private GroupMessageHandler groupMessageHandler;
@Inject
private LoginMessageHandler loginMessageHandler;
@Inject
private OldMessageHandler oldMessageHandler;
private NutMap handlers = new NutMap();
/**
* @param args
Expand Down
16 changes: 10 additions & 6 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ jetty.host=0.0.0.0
shiro.ini.path=shiro.ini

#数据库配置
db.url=jdbc:mysql://127.0.0.1:3306/mychat?useOldAliasMetadataBehavior=true&useUnicode=true&characterEncoding=utf8
db.username=root
db.password=woailuli
db.validationQuery=select 1
db.maxActive=100
jdbc.url=jdbc:mysql://localhost:3306/lulichat?useOldAliasMetadataBehavior=true&useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=asdasdasd
jdbc.type=druid

#socket配置
websocket.port=5210
websocket.port=5210

jetty.threadpool.maxThreads=1000

nutz.dao.interceptor.time.enable=true
nutz.dao.interceptor.cache.enable=true
47 changes: 0 additions & 47 deletions src/main/resources/ioc/dao.js

This file was deleted.

11 changes: 0 additions & 11 deletions src/main/resources/website.properties

This file was deleted.

0 comments on commit 9063393

Please sign in to comment.