bill 4 years ago
parent
commit
5a47b46fe8
91 changed files with 999 additions and 17 deletions
  1. 3 1
      app.js
  2. 6 6
      config/sys_test.json
  3. 1 1
      intercept/error.js
  4. 26 0
      module/HomeNews.js
  5. 26 0
      module/Media.js
  6. 1 1
      module/News.js
  7. 20 0
      module/Personnel.js
  8. 97 0
      router/home_news.js
  9. 5 2
      router/index.js
  10. 98 0
      router/media.js
  11. 1 1
      router/news.js
  12. 103 0
      router/personnel.js
  13. 8 4
      router/public.js
  14. BIN
      static/images/017f2d3081f1a.png
  15. BIN
      static/images/02f693f8cd5da.png
  16. BIN
      static/images/0308dea2f092b.jpg
  17. BIN
      static/images/0737783bab163.jpg
  18. BIN
      static/images/0a37b80e8673b.png
  19. BIN
      static/images/0afffa283e47e.png
  20. BIN
      static/images/19386557c3f41.png
  21. BIN
      static/images/1c786f0fd5856.jpg
  22. BIN
      static/images/1e478297e5eb5.png
  23. BIN
      static/images/1f3ba6b73466b.jpg
  24. BIN
      static/images/20a6e65ea8643.jpg
  25. BIN
      static/images/24e47943a0e54.png
  26. BIN
      static/images/2936429db2487.png
  27. BIN
      static/images/2bd8000ed8a3b.png
  28. BIN
      static/images/2c88f58606242.png
  29. 270 0
      static/images/35c2c3724e8d1.txt
  30. BIN
      static/images/3bb28625744ba.jpg
  31. BIN
      static/images/4563e36f87b5f.png
  32. BIN
      static/images/4f36428992b09.png
  33. BIN
      static/images/57bf1bfa8779d.png
  34. BIN
      static/images/5840713b8fbbd.jpg
  35. BIN
      static/images/586c48f25343.png
  36. BIN
      static/images/58b1b2ea97932.jpg
  37. BIN
      static/images/5a392413334a.png
  38. BIN
      static/images/62a8530a80067.png
  39. BIN
      static/images/6c0264da74877.png
  40. BIN
      static/images/6df18333ad2c8.png
  41. BIN
      static/images/756a6736f5c98.png
  42. BIN
      static/images/78a6677a54b45.png
  43. BIN
      static/images/7a1eee9ed34d8.png
  44. BIN
      static/images/7a4ab41ad748f.png
  45. BIN
      static/images/7ca2ad0362016.jpg
  46. 270 0
      static/images/7d1b5d1baafd2.txt
  47. BIN
      static/images/7d30049b7c2fa.jpg
  48. BIN
      static/images/892c4e23fa13d.png
  49. BIN
      static/images/897177825dd6e.jpg
  50. BIN
      static/images/8a5d89e228f54.png
  51. BIN
      static/images/929d1e4a37719.png
  52. BIN
      static/images/96fa3013dbe7d.gif
  53. BIN
      static/images/98d84fd4a52a1.png
  54. BIN
      static/images/99c2a07096636.png
  55. BIN
      static/images/9a855d4eeea5b.jpg
  56. BIN
      static/images/9aca51df0a075.png
  57. BIN
      static/images/9c6df0a2cc68.png
  58. BIN
      static/images/9d39e35b367ff.png
  59. BIN
      static/images/a47c481ff880e.png
  60. BIN
      static/images/a9cc2fe94baa7.png
  61. BIN
      static/images/abb4582fdf40c.jpg
  62. BIN
      static/images/ae0177e7f769b.png
  63. BIN
      static/images/b9f639302c3fc.png
  64. BIN
      static/images/bc9f8322b1fa2.png
  65. BIN
      static/images/bd99a5148873a.png
  66. BIN
      static/images/c14f9323343ea.png
  67. BIN
      static/images/c2af0cb5ba33d.png
  68. BIN
      static/images/cb2f429386316.jpg
  69. BIN
      static/images/ceae26257adb9.png
  70. BIN
      static/images/d0b244a63646.jpg
  71. BIN
      static/images/d1712d8150d28.png
  72. BIN
      static/images/d6472c0bc1e66.png
  73. BIN
      static/images/d6f65cb400fdc.jpg
  74. BIN
      static/images/e031f0b461e48.png
  75. BIN
      static/images/e1b17fee4dbca.png
  76. BIN
      static/images/e24e7b3db7b97.jpg
  77. BIN
      static/images/e35ce5e40cb05.jpg
  78. BIN
      static/images/e5c47e6d35228.png
  79. BIN
      static/images/e73605a474337.jpg
  80. BIN
      static/images/e793c5e7216d6.png
  81. BIN
      static/images/e838cfff5860e.png
  82. BIN
      static/images/ed07b00248d5b.jpg
  83. BIN
      static/images/eeb7e631ed8c8.png
  84. BIN
      static/images/f656b52822091.jpg
  85. BIN
      static/images/f79bd7115cc0b.jpg
  86. BIN
      static/images/f9ecb0ad7dd5e.png
  87. BIN
      static/images/fa4b304c3c68d.png
  88. BIN
      static/images/fa8777d78a275.jpg
  89. BIN
      static/images/fd4269dd9c435.png
  90. 1 1
      util/mailSend.js
  91. 63 0
      util/upqiniu.js

+ 3 - 1
app.js

@@ -4,10 +4,12 @@ const session = require('koa-session-minimal');
 const MysqlSession = require('koa-mysql-session');
 const static = require('koa-static');
 const path = require('path');
-const sys = require('./config/sys.json');
+const sys = require('./config/sys_test.json');
 const router = require('./router');
 
 const app = new Koa();
+
+console.log(sys)
 const store = new MysqlSession({
   connectTimeout  : 60* 60 * 60 * 1000,
   host: sys.session.host,

+ 6 - 6
config/sys_test.json

@@ -1,10 +1,10 @@
 {
     "static_dir": "/static",
     "session": {
-        "host": "localhost",
+        "host": "127.0.0.1",
         "db": "4dageOffcial_test",
-        "user": "4dage",
-        "pwd": "123456",
+        "user": "root",
+        "pwd": "4dagecui2019",
         "key": "session key",
         "path": "/",
         "max_age": 86400000,
@@ -12,10 +12,10 @@
         "domain": null
     },
     "mysql": {
-        "host": "localhost",
+        "host": "127.0.0.1",
         "db": "4dageOffcial_test",
-        "user": "4dage",
-        "pwd": "123456"
+        "user": "root",
+        "pwd": "4dagecui2019"
     },
     "mail": {
         "service": "qq",

+ 1 - 1
intercept/error.js

@@ -1,5 +1,5 @@
 const mailSend = require('../util/mailSend');
-const sys = require('../config/sys');
+const sys = require('../config/sys_test');
 
 let api, adminMail;
 

+ 26 - 0
module/HomeNews.js

@@ -0,0 +1,26 @@
+const DBModule = require('./DBModule');
+
+class HomeNews extends DBModule {
+
+  get table() {
+    return 'home_news'
+  }
+
+  get primary() {
+    return 'id'
+  }
+
+  get fields() {
+    return [
+      'id', 'nid', 'cover', 'text', 'title', 'hide', 'language', 'sort'
+    ]
+  }
+
+  query () {
+    return super.query({
+      sql: 'select * from home_news order by sort asc, id asc'
+    })
+  }
+}
+
+module.exports = exports = HomeNews;

+ 26 - 0
module/Media.js

@@ -0,0 +1,26 @@
+const DBModule = require('./DBModule');
+
+class Media extends DBModule {
+
+  get table() {
+    return 'media'
+  }
+
+  get primary() {
+    return 'id'
+  }
+
+  get fields() {
+    return [
+      'id', 'cover', 'text', 'zip', 'hide', 'language', 'type', 'sort'
+    ]
+  }
+
+  query() {
+    return super.query({
+      sql: 'select * from media order by sort asc, id asc'
+    })
+  }
+}
+
+module.exports = exports = Media;

+ 1 - 1
module/News.js

@@ -22,7 +22,7 @@ class News extends DBModule {
     let joinSql = '';
 
     language && (joinSql += `and language = '${language}'`);
-    let sql = `select {{header}} from \`news\` where title like '%${keyword}%' and hide=${this.hide} ${joinSql} order by \`sort\` asc`
+    let sql = `select {{header}} from \`news\` where title like '%${keyword}%' and hide=${this.hide} ${joinSql} order by \`sort\` asc, id DESC `
     return super.paging({
       page,
       limit,

+ 20 - 0
module/Personnel.js

@@ -0,0 +1,20 @@
+const DBModule = require('./DBModule');
+
+class Personnel extends DBModule {
+
+  get table() {
+    return 'personnel'
+  }
+
+  get primary() {
+    return 'id'
+  }
+
+  get fields() {
+    return [
+      'id', 'type', 'address', 'count', 'time', 'describe', 'requirement', 'bonus', 'title', 'hide', 'language'
+    ]
+  }
+}
+
+module.exports = exports = Personnel;

+ 97 - 0
router/home_news.js

@@ -0,0 +1,97 @@
+const HomeNews = require('../module/HomeNews');
+const Router = require('koa-router');
+const permission = require('../intercept/permission');
+const router = new Router();
+
+/**
+ * 获取案例数据
+ */
+router.get('/', async ctx => {
+  let hnews = new HomeNews();
+
+  hnews.hide = 0;
+  for (let key in ctx.request.query) {
+    hnews[key] = ctx.request.query[key]
+  }
+  let result = await hnews.query()
+
+  ctx.body = {
+    msg: '成功获取数据',
+    content: result
+  }
+});
+
+
+
+/**
+ * 添加案例
+ */
+router.post('/', permission, async ctx => {
+  let body = ctx.request.body;
+  let hnews = new HomeNews();
+
+  hnews.cover = body.cover;
+  hnews.text = body.text;
+  hnews.title = body.title;
+  hnews.language = body.language;
+  hnews.nid = body.nid;
+  hnews.sort = body.sort;
+
+  let { insertId } = await hnews.insert()
+
+  ctx.body = {
+    msg: '成功添加!',
+    insertId
+  };
+});
+
+
+
+/**
+ * 修改案例
+ */
+router.put('/', permission, async ctx => {
+  let body = ctx.request.body;
+  let hnews = new HomeNews();
+  hnews.id = body.id;
+
+  if (!await hnews.exists()) {
+    ctx.error('该案例不存在!')
+  }
+
+  hnews.cover = body.cover;
+  hnews.text = body.text;
+  hnews.title = body.title;
+  hnews.language = body.language;
+  hnews.sort = body.sort;
+
+  await hnews.update()
+
+  ctx.body = {
+    msg: '成功修改!'
+  };
+});
+
+/**
+ * 删除案例
+ */
+router.delete('/:id', permission, async ctx => {
+  let id = ctx.params.id;
+
+  (!id || !Number.isFinite(Number(id))) &&
+    ctx.error('该案例不存在,请刷新后重试!');
+
+  let hnews = new HomeNews();
+  hnews.id = id;
+  hnews.hide = 0;
+
+  (await hnews.exists()) ||
+    ctx.error('该案例不存在,请刷新后重试!');
+
+  hnews.hide = 1;
+  await hnews.update();
+
+  ctx.body = { msg: '成功删除!' };
+});
+
+module.exports = exports = { path: '/home_news', router };

+ 5 - 2
router/index.js

@@ -1,12 +1,15 @@
 const Router = require('koa-router');
-const sys = require('../config/sys.json');
+const sys = require('../config/sys_test.json');
 const error = require('../intercept/error');
 const router = new Router();
 const roter_modulars = [
   require('./user'),
   require('./case'),
   require('./news'),
-  require('./public')
+  require('./home_news'),
+  require('./public'),
+  require('./media'),
+  require('./personnel')
 ];
 
 router.use(error('error', sys.err_sendee));

+ 98 - 0
router/media.js

@@ -0,0 +1,98 @@
+const Media = require('../module/Media');
+const Router = require('koa-router');
+const permission = require('../intercept/permission');
+const router = new Router();
+
+/**
+ * 获取案例数据
+ */
+router.get('/', async ctx => {
+  let media = new Media();
+
+  media.hide = 0;
+  for (let key in ctx.request.query) {
+    media[key] = ctx.request.query[key]
+  }
+  let result = await media.query()
+
+  ctx.body = {
+    msg: '成功获取数据',
+    content: result
+  }
+});
+
+
+
+/**
+ * 添加案例
+ */
+router.post('/', permission, async ctx => {
+  let body = ctx.request.body;
+  let media = new Media();
+
+  media.cover = body.cover;
+  media.text = body.text;
+  media.zip = body.zip;
+  media.language = body.language;
+  media.sort = body.sort;
+  media.type = body.type;
+
+  let { insertId } = await media.insert()
+
+  ctx.body = {
+    msg: '成功添加!',
+    insertId
+  };
+});
+
+
+
+/**
+ * 修改案例
+ */
+router.put('/', permission, async ctx => {
+  let body = ctx.request.body;
+  let media = new Media();
+  media.id = body.id;
+
+  if (!await media.exists()) {
+    ctx.error('该媒体不存在!')
+  }
+
+  media.cover = body.cover;
+  media.text = body.text;
+  media.zip = body.zip;
+  media.sort = body.sort;
+  media.language = body.language;
+  media.type = body.type;
+
+  await media.update()
+
+  ctx.body = {
+    msg: '成功修改!'
+  };
+});
+
+/**
+ * 删除案例
+ */
+router.delete('/:id', permission, async ctx => {
+  let id = ctx.params.id;
+
+  (!id || !Number.isFinite(Number(id))) &&
+    ctx.error('该案例不存在,请刷新后重试!');
+
+  let media = new Media();
+  media.id = id;
+  media.hide = 0;
+
+  (await media.exists()) ||
+    ctx.error('该案例不存在,请刷新后重试!');
+
+  media.hide = 1;
+  await media.update();
+
+  ctx.body = { msg: '成功删除!' };
+});
+
+module.exports = exports = { path: '/media', router };

+ 1 - 1
router/news.js

@@ -17,7 +17,7 @@ async function getNews(id) {
  * 获取新闻数据
  */
 router.get('/', async ctx => {
-  let { page = 1, keyword = '', limit = 15, language } = ctx.request.query;
+  let { page = 0, keyword = '', limit = 15, language } = ctx.request.query;
   let news = new News();
 
   news.hide = 0;

+ 103 - 0
router/personnel.js

@@ -0,0 +1,103 @@
+const Personnel = require('../module/Personnel');
+const Router = require('koa-router');
+const permission = require('../intercept/permission');
+const router = new Router();
+
+/**
+ * 获取案例数据
+ */
+router.get('/', async ctx => {
+  let personnel = new Personnel();
+
+  personnel.hide = 0;
+  for (let key in ctx.request.query) {
+    personnel[key] = ctx.request.query[key]
+  }
+  let result = await personnel.query()
+
+  ctx.body = {
+    msg: '成功获取数据',
+    content: result
+  }
+});
+
+
+
+/**
+ * 添加案例
+ */
+router.post('/', permission, async ctx => {
+  let body = ctx.request.body;
+  let personnel = new Personnel();
+
+  personnel.type = body.type;
+  personnel.address = body.address;
+  personnel.count = body.count;
+  personnel.time = Date.now().toString();
+  personnel.describe = body.describe;
+  personnel.requirement = body.requirement;
+  personnel.bonus = body.bonus;
+  personnel.title = body.title;
+  personnel.language = body.language;
+
+  let { insertId } = await personnel.insert()
+
+  ctx.body = {
+    msg: '成功添加!',
+    insertId
+  };
+});
+
+
+
+/**
+ * 修改案例
+ */
+router.put('/', permission, async ctx => {
+  let body = ctx.request.body;
+  let personnel = new Personnel();
+  personnel.id = body.id;
+
+  if (!await personnel.exists()) {
+    ctx.error('该招聘不存在!')
+  }
+
+  personnel.type = body.type;
+  personnel.address = body.address;
+  personnel.count = body.count;
+  personnel.describe = body.describe;
+  personnel.requirement = body.requirement;
+  personnel.bonus = body.bonus;
+  personnel.title = body.title;
+  personnel.language = body.language;
+
+  await personnel.update()
+
+  ctx.body = {
+    msg: '成功修改!'
+  };
+});
+
+/**
+ * 删除案例
+ */
+router.delete('/:id', permission, async ctx => {
+  let id = ctx.params.id;
+
+  (!id || !Number.isFinite(Number(id))) &&
+    ctx.error('该案例不存在,请刷新后重试!');
+
+  let personnel = new Personnel();
+  personnel.id = id;
+  personnel.hide = 0;
+
+  (await personnel.exists()) ||
+    ctx.error('该案例不存在,请刷新后重试!');
+
+  personnel.hide = 1;
+  await personnel.update();
+
+  ctx.body = { msg: '成功删除!' };
+});
+
+module.exports = exports = { path: '/personnel', router };

+ 8 - 4
router/public.js

@@ -1,4 +1,4 @@
-const {static_prefix} = require('../config/sys')
+const {static_prefix} = require('../config/sys_test')
 const Router = require('koa-router');
 // const qiniu = require('qiniu')
 const path = require('path');
@@ -8,6 +8,7 @@ const permission = require('../intercept/permission');
 const fileLocal = path.join(__dirname, '../static/images');
 const fileRemote = static_prefix + '/images/';
 const uploadFile = require('../util/upload')(fileLocal)
+const upqiniu = require('../util/upqiniu')
 
 // const accessKey = 'dlPPwgZky_F-iP8CbSbJpiAtAcqw3BYwb9rdHMrS'
 // const secretKey = 'YEtkLKDsImXB-8m1CT1zV_YwCwwGvrUvo2ktj9KZ'
@@ -29,17 +30,20 @@ const uploadFile = require('../util/upload')(fileLocal)
  */
 router.post('/upload', permission, async ctx => {
   let {file} = await uploadFile(ctx);
+  let url = await upqiniu(path.join(fileLocal, file), file)
+  
   ctx.body = {
     msg: '文件上传成功',
-    content: fileRemote + file
+    content: '//' + url
   }
 });
 
 router.post('/uploads', permission, async ctx => {
-  let {file} = await uploadFile(ctx);
+  let { file } = await uploadFile(ctx);
+  let url = await upqiniu(path.join(fileLocal, file), file)
   ctx.body = {
     errno: 0,
-    data: [ fileRemote + file ]
+    data: ['//' + url]
   }
 });
 

BIN
static/images/017f2d3081f1a.png


BIN
static/images/02f693f8cd5da.png


BIN
static/images/0308dea2f092b.jpg


BIN
static/images/0737783bab163.jpg


BIN
static/images/0a37b80e8673b.png


BIN
static/images/0afffa283e47e.png


BIN
static/images/19386557c3f41.png


BIN
static/images/1c786f0fd5856.jpg


BIN
static/images/1e478297e5eb5.png


BIN
static/images/1f3ba6b73466b.jpg


BIN
static/images/20a6e65ea8643.jpg


BIN
static/images/24e47943a0e54.png


BIN
static/images/2936429db2487.png


BIN
static/images/2bd8000ed8a3b.png


BIN
static/images/2c88f58606242.png


+ 270 - 0
static/images/35c2c3724e8d1.txt

@@ -0,0 +1,270 @@
+{
+	"vertex": [{
+		"x": 0.898,
+		"y": -0.299,
+		"id": 19
+	}, {
+		"x": -2.502,
+		"y": -0.299,
+		"id": 18
+	}, {
+		"x": -2.502,
+		"y": -3.649,
+		"id": 1
+	}, {
+		"x": 0.898,
+		"y": -3.649,
+		"id": 0
+	}, {
+		"x": 0.898,
+		"y": -6.599,
+		"id": 12
+	}, {
+		"x": 7.723,
+		"y": -6.599,
+		"id": 11
+	}, {
+		"x": 7.723,
+		"y": 2.151,
+		"id": 10
+	}, {
+		"x": 4.223,
+		"y": 2.151,
+		"id": 9
+	}, {
+		"x": 4.223,
+		"y": 5.301,
+		"id": 8
+	}, {
+		"x": 0.448,
+		"y": 5.301,
+		"id": 7
+	}, {
+		"x": 0.448,
+		"y": 3.901,
+		"id": 3
+	}, {
+		"x": 0.448,
+		"y": 0.976,
+		"id": 21
+	}, {
+		"x": -1.002,
+		"y": 0.976,
+		"id": 20
+	}, {
+		"x": -2.502,
+		"y": 0.976,
+		"id": 23
+	}, {
+		"x": -4.127,
+		"y": 0.976,
+		"id": 22
+	}, {
+		"x": -6.027,
+		"y": 0.976,
+		"id": 4
+	}, {
+		"x": -6.677,
+		"y": 0.976,
+		"id": 17
+	}, {
+		"x": -6.677,
+		"y": -5.199,
+		"id": 16
+	}, {
+		"x": -2.502,
+		"y": -5.199,
+		"id": 15
+	}, {
+		"x": -1.002,
+		"y": 5.501,
+		"id": 14
+	}, {
+		"x": -4.127,
+		"y": 5.501,
+		"id": 13
+	}, {
+		"x": -4.127,
+		"y": 4.901,
+		"id": 6
+	}, {
+		"x": -1.002,
+		"y": 3.901,
+		"id": 2
+	}, {
+		"x": -6.027,
+		"y": 4.901,
+		"id": 5
+	}],
+	"wall": [{
+		"p1": 19,
+		"p2": 18,
+		"id": 70
+	}, {
+		"p1": 18,
+		"p2": 1,
+		"id": 71
+	}, {
+		"p1": 1,
+		"p2": 0,
+		"id": 72
+	}, {
+		"p1": 0,
+		"p2": 19,
+		"id": 73
+	}, {
+		"p1": 0,
+		"p2": 12,
+		"id": 74
+	}, {
+		"p1": 12,
+		"p2": 11,
+		"id": 75
+	}, {
+		"p1": 11,
+		"p2": 10,
+		"id": 76
+	}, {
+		"p1": 10,
+		"p2": 9,
+		"id": 77
+	}, {
+		"p1": 9,
+		"p2": 8,
+		"id": 78
+	}, {
+		"p1": 8,
+		"p2": 7,
+		"id": 79
+	}, {
+		"p1": 7,
+		"p2": 3,
+		"id": 80
+	}, {
+		"p1": 3,
+		"p2": 21,
+		"id": 81
+	}, {
+		"p1": 21,
+		"p2": 20,
+		"id": 82
+	}, {
+		"p1": 20,
+		"p2": 23,
+		"id": 83
+	}, {
+		"p1": 23,
+		"p2": 18,
+		"id": 84
+	}, {
+		"p1": 23,
+		"p2": 22,
+		"id": 89
+	}, {
+		"p1": 22,
+		"p2": 4,
+		"id": 90
+	}, {
+		"p1": 4,
+		"p2": 17,
+		"id": 91
+	}, {
+		"p1": 17,
+		"p2": 16,
+		"id": 92
+	}, {
+		"p1": 16,
+		"p2": 15,
+		"id": 93
+	}, {
+		"p1": 15,
+		"p2": 1,
+		"id": 94
+	}, {
+		"p1": 14,
+		"p2": 13,
+		"id": 95
+	}, {
+		"p1": 13,
+		"p2": 6,
+		"id": 96
+	}, {
+		"p1": 6,
+		"p2": 22,
+		"id": 97
+	}, {
+		"p1": 20,
+		"p2": 2,
+		"id": 100
+	}, {
+		"p1": 2,
+		"p2": 14,
+		"id": 101
+	}, {
+		"p1": 3,
+		"p2": 2,
+		"id": 102
+	}, {
+		"p1": 6,
+		"p2": 5,
+		"id": 108
+	}, {
+		"p1": 5,
+		"p2": 4,
+		"id": 109
+	}],
+	"column": [],
+	"door": [],
+	"window": [],
+	"houseInfo": {
+		"w": false,
+		"h": false,
+		"area": false,
+		"deg": 0
+	},
+	"room": [{
+		"points": [19, 18, 1, 0],
+		"name": "·¿¼ä1",
+		"area": 11.39,
+		"showArea": true,
+		"showName": true,
+		"top": 2.65,
+		"bottom": -2.16
+	}, {
+		"points": [0, 12, 11, 10, 9, 8, 7, 3, 21, 20, 23, 18, 19],
+		"name": "·¿¼ä2",
+		"area": 76.47,
+		"showArea": true,
+		"showName": true,
+		"top": 2.5100000000000002,
+		"bottom": -2.3200000000000003
+	}, {
+		"points": [1, 18, 23, 22, 4, 17, 16, 15],
+		"name": "·¿¼ä3",
+		"area": 25.78,
+		"showArea": true,
+		"showName": true,
+		"top": 2.69,
+		"bottom": -2.0700000000000003
+	}, {
+		"points": [14, 13, 6, 22, 23, 20, 2],
+		"name": "·¿¼ä4",
+		"area": 14.14,
+		"showArea": true,
+		"showName": true
+	}, {
+		"points": [3, 2, 20, 21],
+		"name": "·¿¼ä5",
+		"area": 4.24,
+		"showArea": true,
+		"showName": true
+	}, {
+		"points": [4, 22, 6, 5],
+		"name": "·¿¼ä6",
+		"area": 7.46,
+		"showArea": true,
+		"showName": true
+	}],
+	"top": 1.600000023841858,
+	"bottom": -1.600000023841858
+}

BIN
static/images/3bb28625744ba.jpg


BIN
static/images/4563e36f87b5f.png


BIN
static/images/4f36428992b09.png


BIN
static/images/57bf1bfa8779d.png


BIN
static/images/5840713b8fbbd.jpg


BIN
static/images/586c48f25343.png


BIN
static/images/58b1b2ea97932.jpg


BIN
static/images/5a392413334a.png


BIN
static/images/62a8530a80067.png


BIN
static/images/6c0264da74877.png


BIN
static/images/6df18333ad2c8.png


BIN
static/images/756a6736f5c98.png


BIN
static/images/78a6677a54b45.png


BIN
static/images/7a1eee9ed34d8.png


BIN
static/images/7a4ab41ad748f.png


BIN
static/images/7ca2ad0362016.jpg


+ 270 - 0
static/images/7d1b5d1baafd2.txt

@@ -0,0 +1,270 @@
+{
+	"vertex": [{
+		"x": 0.898,
+		"y": -0.299,
+		"id": 19
+	}, {
+		"x": -2.502,
+		"y": -0.299,
+		"id": 18
+	}, {
+		"x": -2.502,
+		"y": -3.649,
+		"id": 1
+	}, {
+		"x": 0.898,
+		"y": -3.649,
+		"id": 0
+	}, {
+		"x": 0.898,
+		"y": -6.599,
+		"id": 12
+	}, {
+		"x": 7.723,
+		"y": -6.599,
+		"id": 11
+	}, {
+		"x": 7.723,
+		"y": 2.151,
+		"id": 10
+	}, {
+		"x": 4.223,
+		"y": 2.151,
+		"id": 9
+	}, {
+		"x": 4.223,
+		"y": 5.301,
+		"id": 8
+	}, {
+		"x": 0.448,
+		"y": 5.301,
+		"id": 7
+	}, {
+		"x": 0.448,
+		"y": 3.901,
+		"id": 3
+	}, {
+		"x": 0.448,
+		"y": 0.976,
+		"id": 21
+	}, {
+		"x": -1.002,
+		"y": 0.976,
+		"id": 20
+	}, {
+		"x": -2.502,
+		"y": 0.976,
+		"id": 23
+	}, {
+		"x": -4.127,
+		"y": 0.976,
+		"id": 22
+	}, {
+		"x": -6.027,
+		"y": 0.976,
+		"id": 4
+	}, {
+		"x": -6.677,
+		"y": 0.976,
+		"id": 17
+	}, {
+		"x": -6.677,
+		"y": -5.199,
+		"id": 16
+	}, {
+		"x": -2.502,
+		"y": -5.199,
+		"id": 15
+	}, {
+		"x": -1.002,
+		"y": 5.501,
+		"id": 14
+	}, {
+		"x": -4.127,
+		"y": 5.501,
+		"id": 13
+	}, {
+		"x": -4.127,
+		"y": 4.901,
+		"id": 6
+	}, {
+		"x": -1.002,
+		"y": 3.901,
+		"id": 2
+	}, {
+		"x": -6.027,
+		"y": 4.901,
+		"id": 5
+	}],
+	"wall": [{
+		"p1": 19,
+		"p2": 18,
+		"id": 70
+	}, {
+		"p1": 18,
+		"p2": 1,
+		"id": 71
+	}, {
+		"p1": 1,
+		"p2": 0,
+		"id": 72
+	}, {
+		"p1": 0,
+		"p2": 19,
+		"id": 73
+	}, {
+		"p1": 0,
+		"p2": 12,
+		"id": 74
+	}, {
+		"p1": 12,
+		"p2": 11,
+		"id": 75
+	}, {
+		"p1": 11,
+		"p2": 10,
+		"id": 76
+	}, {
+		"p1": 10,
+		"p2": 9,
+		"id": 77
+	}, {
+		"p1": 9,
+		"p2": 8,
+		"id": 78
+	}, {
+		"p1": 8,
+		"p2": 7,
+		"id": 79
+	}, {
+		"p1": 7,
+		"p2": 3,
+		"id": 80
+	}, {
+		"p1": 3,
+		"p2": 21,
+		"id": 81
+	}, {
+		"p1": 21,
+		"p2": 20,
+		"id": 82
+	}, {
+		"p1": 20,
+		"p2": 23,
+		"id": 83
+	}, {
+		"p1": 23,
+		"p2": 18,
+		"id": 84
+	}, {
+		"p1": 23,
+		"p2": 22,
+		"id": 89
+	}, {
+		"p1": 22,
+		"p2": 4,
+		"id": 90
+	}, {
+		"p1": 4,
+		"p2": 17,
+		"id": 91
+	}, {
+		"p1": 17,
+		"p2": 16,
+		"id": 92
+	}, {
+		"p1": 16,
+		"p2": 15,
+		"id": 93
+	}, {
+		"p1": 15,
+		"p2": 1,
+		"id": 94
+	}, {
+		"p1": 14,
+		"p2": 13,
+		"id": 95
+	}, {
+		"p1": 13,
+		"p2": 6,
+		"id": 96
+	}, {
+		"p1": 6,
+		"p2": 22,
+		"id": 97
+	}, {
+		"p1": 20,
+		"p2": 2,
+		"id": 100
+	}, {
+		"p1": 2,
+		"p2": 14,
+		"id": 101
+	}, {
+		"p1": 3,
+		"p2": 2,
+		"id": 102
+	}, {
+		"p1": 6,
+		"p2": 5,
+		"id": 108
+	}, {
+		"p1": 5,
+		"p2": 4,
+		"id": 109
+	}],
+	"column": [],
+	"door": [],
+	"window": [],
+	"houseInfo": {
+		"w": false,
+		"h": false,
+		"area": false,
+		"deg": 0
+	},
+	"room": [{
+		"points": [19, 18, 1, 0],
+		"name": "·¿¼ä1",
+		"area": 11.39,
+		"showArea": true,
+		"showName": true,
+		"top": 2.65,
+		"bottom": -2.16
+	}, {
+		"points": [0, 12, 11, 10, 9, 8, 7, 3, 21, 20, 23, 18, 19],
+		"name": "·¿¼ä2",
+		"area": 76.47,
+		"showArea": true,
+		"showName": true,
+		"top": 2.5100000000000002,
+		"bottom": -2.3200000000000003
+	}, {
+		"points": [1, 18, 23, 22, 4, 17, 16, 15],
+		"name": "·¿¼ä3",
+		"area": 25.78,
+		"showArea": true,
+		"showName": true,
+		"top": 2.69,
+		"bottom": -2.0700000000000003
+	}, {
+		"points": [14, 13, 6, 22, 23, 20, 2],
+		"name": "·¿¼ä4",
+		"area": 14.14,
+		"showArea": true,
+		"showName": true
+	}, {
+		"points": [3, 2, 20, 21],
+		"name": "·¿¼ä5",
+		"area": 4.24,
+		"showArea": true,
+		"showName": true
+	}, {
+		"points": [4, 22, 6, 5],
+		"name": "·¿¼ä6",
+		"area": 7.46,
+		"showArea": true,
+		"showName": true
+	}],
+	"top": 1.600000023841858,
+	"bottom": -1.600000023841858
+}

BIN
static/images/7d30049b7c2fa.jpg


BIN
static/images/892c4e23fa13d.png


BIN
static/images/897177825dd6e.jpg


BIN
static/images/8a5d89e228f54.png


BIN
static/images/929d1e4a37719.png


BIN
static/images/96fa3013dbe7d.gif


BIN
static/images/98d84fd4a52a1.png


BIN
static/images/99c2a07096636.png


BIN
static/images/9a855d4eeea5b.jpg


BIN
static/images/9aca51df0a075.png


BIN
static/images/9c6df0a2cc68.png


BIN
static/images/9d39e35b367ff.png


BIN
static/images/a47c481ff880e.png


BIN
static/images/a9cc2fe94baa7.png


BIN
static/images/abb4582fdf40c.jpg


BIN
static/images/ae0177e7f769b.png


BIN
static/images/b9f639302c3fc.png


BIN
static/images/bc9f8322b1fa2.png


BIN
static/images/bd99a5148873a.png


BIN
static/images/c14f9323343ea.png


BIN
static/images/c2af0cb5ba33d.png


BIN
static/images/cb2f429386316.jpg


BIN
static/images/ceae26257adb9.png


BIN
static/images/d0b244a63646.jpg


BIN
static/images/d1712d8150d28.png


BIN
static/images/d6472c0bc1e66.png


BIN
static/images/d6f65cb400fdc.jpg


BIN
static/images/e031f0b461e48.png


BIN
static/images/e1b17fee4dbca.png


BIN
static/images/e24e7b3db7b97.jpg


BIN
static/images/e35ce5e40cb05.jpg


BIN
static/images/e5c47e6d35228.png


BIN
static/images/e73605a474337.jpg


BIN
static/images/e793c5e7216d6.png


BIN
static/images/e838cfff5860e.png


BIN
static/images/ed07b00248d5b.jpg


BIN
static/images/eeb7e631ed8c8.png


BIN
static/images/f656b52822091.jpg


BIN
static/images/f79bd7115cc0b.jpg


BIN
static/images/f9ecb0ad7dd5e.png


BIN
static/images/fa4b304c3c68d.png


BIN
static/images/fa8777d78a275.jpg


BIN
static/images/fd4269dd9c435.png


+ 1 - 1
util/mailSend.js

@@ -1,5 +1,5 @@
 const mailer = require('nodemailer');
-const sys = require('../config/sys');
+const sys = require('../config/sys_test');
 
 const mailrg = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
 const transporter = mailer.createTransport({

+ 63 - 0
util/upqiniu.js

@@ -0,0 +1,63 @@
+const qiniu = require('qiniu')
+const path = require('path')
+const key = 'dlPPwgZky_F-iP8CbSbJpiAtAcqw3BYwb9rdHMrS'
+const secre = 'YEtkLKDsImXB-8m1CT1zV_YwCwwGvrUvo2ktj9KZ'
+const host = 'model3d.4dage.com/'
+
+let getToken = (() => {
+  const bucket = 'model3d'
+  const expires = 7200
+
+  let mac = new qiniu.auth.digest.Mac(key, secre);
+  let defaultToken
+
+  (function referToken() {
+    let putPolicy = new qiniu.rs.PutPolicy({ expires, scope: bucket })
+    defaultToken = putPolicy.uploadToken(mac);
+    setTimeout(referToken, (expires - 200) * 1000)
+  })();
+
+  function getToken (name) {
+    if (!name) return defaultToken;
+
+    let scope = name ? bucket + ':' + name : bucket;
+    let putPolicy = new qiniu.rs.PutPolicy({ expires, scope })
+    return putPolicy.uploadToken(mac);
+  }
+  return getToken
+})();
+
+
+let zoons = {
+  '华东': 'Zone_z0',
+  '华北': 'Zone_z1',
+  '华南': 'Zone_z2',
+  '北美': 'Zone_na0'
+}
+function uploadFile(localFile, target, zone = '华南') {
+  target = target.replace(/\\/ig, "\/")
+
+  let config = new qiniu.conf.Config();
+  let token = getToken(target)
+  let formUploader = new qiniu.form_up.FormUploader()
+  let putExtra = new qiniu.form_up.PutExtra();
+
+  config.zone = qiniu.zone[zoons[zone]];
+  config.useHttpsDomain = true;
+  config.useCdnDomain = true;
+  
+  return new Promise((resolve, reject) => {
+    formUploader.putFile(token, target, localFile, putExtra, err => {
+      if (err) {
+        reject(err)
+      } else {
+        resolve(host + target)
+      }
+    })
+  })
+}
+
+
+module.exports = async (file, name) => {
+  return await uploadFile(file, 'data/' + name)
+}