-@body>
\ No newline at end of file
+@body>
+<@script>
+@script>
\ No newline at end of file
diff --git a/WebRoot/WEB-INF/views/activity/search.html b/WebRoot/WEB-INF/views/activity/search.html
deleted file mode 100644
index 3be5daa..0000000
--- a/WebRoot/WEB-INF/views/activity/search.html
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-Insert title here
-
-
-
-
-
-
创建时间
-
名称|交易号
-
对方
-
金额|明细
-
状态
-
操作
-
备注
-
备注
-
-
-
-
-
Data
-
Data
-
Data
-
Data
-
Data
-
Data
-
Data
-
Data
-
- <#list joblist as job>
-
-
${job.createtime}
-
${job.name}
-
${job.title}
-
${job.salary}
-
${job.email}
-
${job.author}
-
${job.company}
-
${job.views}
-
- #list>
-
-
-
-
\ No newline at end of file
diff --git a/WebRoot/WEB-INF/views/activity/add.html b/WebRoot/WEB-INF/views/admin/activity/add.html
similarity index 67%
rename from WebRoot/WEB-INF/views/activity/add.html
rename to WebRoot/WEB-INF/views/admin/activity/add.html
index cf6969a..4ef3231 100644
--- a/WebRoot/WEB-INF/views/activity/add.html
+++ b/WebRoot/WEB-INF/views/admin/activity/add.html
@@ -1,25 +1,24 @@
-<#include "/layout/_layout.html" />
-<@head title="首页|四眼井|互联网人的乐园 ">@head>
+<#include "/layout/admin/_layout.html" />
+<@head title="四眼井-后台管理系统 ">@head>
<@body>
-
-
+
发布活动
-
-
@body>
<@script>
+
+
+
+@head>
+<@body>
+
+
+@body>
+<@script>
+
+@script>
\ No newline at end of file
diff --git a/src/me/thinkjet/controller/ActivityController.java b/src/me/thinkjet/controller/ActivityController.java
index 7f3868f..0b2002b 100644
--- a/src/me/thinkjet/controller/ActivityController.java
+++ b/src/me/thinkjet/controller/ActivityController.java
@@ -14,34 +14,13 @@ public class ActivityController extends Controller {
@Before(CacheInterceptor.class)
@CacheName("activity")
public void index() {
+ int page = this.getParaToInt("page", 1);
setAttr("activitylist", Activity.dao.paginateByCache("activity",
- "activity-index" + this.getParaToInt("page", 1),
- this.getParaToInt("page", 1), 12, "select *", "from activity"));
- }
-
- public void add() {
- render("add.html");
- }
-
- public void create() {
- Activity a = getModel(Activity.class);
- a.set("author", /* this.getSession().getAttribute(SESSION_ID) */1);
- a.save();
- render("index.html");
- }
-
- public void update() {
- Activity a = getModel(Activity.class);
- a.update();
- render("show.html");
+ "activity_" + page, page, 4, "select *", "from activity order by id desc"));
}
public void show() {
setAttr("a", Activity.dao.findById(getPara("id")));
}
- public void edit() {
- setAttr("a", Activity.dao.findById(getPara("id")));
- }
-
}
diff --git a/src/me/thinkjet/controller/UploadController.java b/src/me/thinkjet/controller/UploadController.java
index c348745..61127fa 100644
--- a/src/me/thinkjet/controller/UploadController.java
+++ b/src/me/thinkjet/controller/UploadController.java
@@ -10,8 +10,13 @@
/**
* kindeditor 专用 文件&图片上传实现
*/
-@ControllerBind(controllerKey = "/upload", viewPath = "")
+@ControllerBind(controllerKey = "/upload", viewPath = "/")
public class UploadController extends Controller {
+
+ public void index(){
+ render("upload.html");
+ }
+
public void file() {
File file = this.getFile().getFile();
String url = UploadService.uplaodFileToLocal(file);
@@ -27,6 +32,7 @@ public void file() {
}
public void img() {
+ System.out.println("ok");
File file = this.getFile().getFile();
String url = UploadService.uplaodImgToLocal(file);
if (file.exists())
@@ -37,6 +43,7 @@ public void img() {
} else {
this.setAttr("error", 1);
}
+ System.out.println(url);
this.renderJson();
}
diff --git a/src/me/thinkjet/controller/admin/ActivityController.java b/src/me/thinkjet/controller/admin/ActivityController.java
new file mode 100644
index 0000000..e7759cd
--- /dev/null
+++ b/src/me/thinkjet/controller/admin/ActivityController.java
@@ -0,0 +1,52 @@
+package me.thinkjet.controller.admin;
+
+import me.thinkjet.model.Activity;
+
+import com.jfinal.aop.Before;
+import com.jfinal.core.Controller;
+import com.jfinal.ext.route.ControllerBind;
+import com.jfinal.plugin.ehcache.CacheInterceptor;
+import com.jfinal.plugin.ehcache.CacheName;
+
+@ControllerBind(controllerKey = "/admin/activity", viewPath = "admin/activity")
+public class ActivityController extends Controller {
+
+ @Before(CacheInterceptor.class)
+ @CacheName("activity")
+ public void index() {
+ int page = this.getParaToInt("page", 1);
+ setAttr("activitylist", Activity.dao.paginateByCache("activity",
+ "activity_" + page, page, 4, "select *",
+ "from activity order by id desc"));
+ }
+
+ public void add() {
+ render("add.html");
+ }
+
+ public void create() {
+ Activity a = getModel(Activity.class);
+ a.save();
+ this.redirect("index");
+ }
+
+ public void update() {
+ Activity a = getModel(Activity.class);
+ a.update();
+ this.setAttr("a",a);
+ this.render("show.html");
+ }
+
+ public void show() {
+ setAttr("a", Activity.dao.findById(getPara("id")));
+ }
+
+ public void edit() {
+ setAttr("a", Activity.dao.findById(getPara("id")));
+ }
+
+ public void delete() {
+
+ }
+
+}
diff --git a/src/me/thinkjet/controller/admin/PhotoController.java b/src/me/thinkjet/controller/admin/PhotoController.java
index 5996c55..414e6e7 100644
--- a/src/me/thinkjet/controller/admin/PhotoController.java
+++ b/src/me/thinkjet/controller/admin/PhotoController.java
@@ -9,15 +9,17 @@
import com.jfinal.plugin.ehcache.CacheInterceptor;
import com.jfinal.plugin.ehcache.CacheName;
-@ControllerBind(controllerKey = "/admin/photo", viewPath = "admin/")
+@ControllerBind(controllerKey = "/admin/activity/photo", viewPath = "admin/activity/photo")
public class PhotoController extends Controller {
@Before(CacheInterceptor.class)
@CacheName("photo")
public void index() {
- setAttr("plist", Activity.dao.paginateByCache("photo",
- "photo-index" + this.getParaToInt("page", 1),
- this.getParaToInt("page", 1), 12, "select *", "from activity_photo order by desc"));
+ int page = this.getParaToInt("page", 1);
+ setAttr("plist", Activity.dao.paginateByCache("photo", "photo-" + page,
+ page, 20, "select p.*,a.title as title",
+ "from activity_photo p left join activity a on"
+ + " p.activity_id = a.id order by p.id desc"));
}
public void add() {
@@ -26,7 +28,6 @@ public void add() {
public void create() {
Activity a = getModel(Activity.class);
- a.set("author", /* this.getSession().getAttribute(SESSION_ID) */1);
a.save();
render("index.html");
}
@@ -40,8 +41,8 @@ public void update() {
public void edit() {
setAttr("a", Activity.dao.findById(getPara("id")));
}
-
- public void delete(){
+
+ public void delete() {
ActivityPhoto.dao.deleteById(this.getAttr("id"));
this.render("index/html");
}
diff --git a/src/me/thinkjet/controller/admin/UploadController.java b/src/me/thinkjet/controller/admin/UploadController.java
new file mode 100644
index 0000000..eb419c2
--- /dev/null
+++ b/src/me/thinkjet/controller/admin/UploadController.java
@@ -0,0 +1,31 @@
+package me.thinkjet.controller.admin;
+
+import java.io.File;
+
+import me.thinkjet.service.upyun.UploadService;
+
+import com.jfinal.core.Controller;
+import com.jfinal.ext.route.ControllerBind;
+
+@ControllerBind(controllerKey = "/admin/upload", viewPath = "admin/")
+public class UploadController extends Controller {
+
+ public void index() {
+ render("upload.html");
+ }
+
+ public void img() {
+ File file = this.getFile().getFile();
+ String url = UploadService.uplaodImgToLocal(file);
+ if (file.exists())
+ file.delete();
+ if (url != null) {
+ this.setAttr("error", 0);
+ this.setAttr("url", url);
+ } else {
+ this.setAttr("error", 1);
+ }
+ this.renderJson();
+ }
+
+}
diff --git a/src/me/thinkjet/model/ActivitySummary.java b/src/me/thinkjet/model/ActivitySummary.java
deleted file mode 100644
index ab28a07..0000000
--- a/src/me/thinkjet/model/ActivitySummary.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package me.thinkjet.model;
-
-import com.jfinal.plugin.activerecord.Model;
-
-public class ActivitySummary extends Model {
- /**
- *
- */
- private static final long serialVersionUID = -2074228006305530343L;
- public static final ActivitySummary dao = new ActivitySummary();
-}
\ No newline at end of file
diff --git a/syj.sql b/syj.sql
index 4d1cd23..652f85f 100644
--- a/syj.sql
+++ b/syj.sql
@@ -26,12 +26,9 @@ DROP TABLE IF EXISTS `activity`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `activity` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
- `title` varchar(45) NOT NULL,
- `content` varchar(45) DEFAULT NULL,
- `author` bigint(20) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `auth_idx` (`author`),
- CONSTRAINT `auth` FOREIGN KEY (`author`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
+ `title` varchar(255) NOT NULL,
+ `content` LONGTEXT DEFAULT NULL,
+ PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -71,57 +68,6 @@ LOCK TABLES `activity_photo` WRITE;
/*!40000 ALTER TABLE `activity_photo` ENABLE KEYS */;
UNLOCK TABLES;
---
--- Table structure for table `activity_record`
---
-
-DROP TABLE IF EXISTS `activity_record`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `activity_record` (
- `activity_id` bigint(20) NOT NULL,
- `views` int(11) DEFAULT '0',
- `comments` int(11) DEFAULT '0',
- PRIMARY KEY (`activity_id`),
- UNIQUE KEY `activity_id_UNIQUE` (`activity_id`),
- CONSTRAINT `avtivity_id` FOREIGN KEY (`activity_id`) REFERENCES `activity` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `activity_record`
---
-
-LOCK TABLES `activity_record` WRITE;
-/*!40000 ALTER TABLE `activity_record` DISABLE KEYS */;
-/*!40000 ALTER TABLE `activity_record` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `activity_summary`
---
-
-DROP TABLE IF EXISTS `activity_summary`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `activity_summary` (
- `id` bigint(20) NOT NULL,
- `activity_id` bigint(20) NOT NULL,
- `content` longtext,
- PRIMARY KEY (`id`),
- KEY `fk_idx` (`activity_id`),
- CONSTRAINT `fk` FOREIGN KEY (`activity_id`) REFERENCES `activity` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `activity_summary`
---
-
-LOCK TABLES `activity_summary` WRITE;
-/*!40000 ALTER TABLE `activity_summary` DISABLE KEYS */;
-/*!40000 ALTER TABLE `activity_summary` ENABLE KEYS */;
-UNLOCK TABLES;
--
-- Table structure for table `activity_tags`