瀏覽代碼

修改 本地环境配置,sh脚本,网关配置,期刊服务

asd123a20 3 年之前
父節點
當前提交
98ea12ffd5

+ 19 - 19
pm2-start-all.sh

@@ -1,59 +1,59 @@
 cd service-activity
-pm2 start server.js --name service-activity --watch
+pm2 start ./server.js --name service-activity --watch
 cd ..
 cd service-cms
-pm2 start server.js --name service-cms --watch
+pm2 start ./server.js --name service-cms --watch
 cd ..
 cd service-code
-pm2 start server.js --name service-code --watch
+pm2 start ./server.js --name service-code --watch
 cd ..
 cd service-contribution
-pm2 start server.js --name service-contribution --watch
+pm2 start ./server.js --name service-contribution --watch
 cd ..
 cd service-files
-pm2 start server.js --name service-files --watch
+pm2 start ./server.js --name service-files --watch
 cd ..
 cd service-gateway
-pm2 start server.js --name service-gateway --watch
+pm2 start ./server.js --name service-gateway --watch
 cd ..
 cd service-goods
-pm2 start server.js --name service-goods --watch
+pm2 start ./server.js --name service-goods --watch
 cd ..
 cd service-import-export
-pm2 start server.js --name service-import-export --watch
+pm2 start ./server.js --name service-import-export --watch
 cd ..
 cd service-journal
-pm2 start server.js --name service-journal --watch
+pm2 start ./server.js --name service-journal --watch
 cd ..
 cd service-log
-pm2 start server.js --name service-log --watch
+pm2 start ./server.js --name service-log --watch
 cd ..
 cd service-login
-pm2 start server.js --name service-login --watch
+pm2 start ./server.js --name service-login --watch
 cd ..
 cd service-market
-pm2 start server.js --name service-market --watch
+pm2 start ./server.js --name service-market --watch
 cd ..
 cd service-media
-pm2 start server.js --name service-media --watch
+pm2 start ./server.js --name service-media --watch
 cd ..
 cd service-naf
-pm2 start server.js --name service-naf --watch
+pm2 start ./server.js --name service-naf --watch
 cd ..
 cd service-org
-pm2 start server.js --name service-org --watch
+pm2 start ./server.js --name service-org --watch
 cd ..
 cd service-reader
-pm2 start server.js --name service-reader --watch
+pm2 start ./server.js --name service-reader --watch
 cd ..
 cd service-user
-pm2 start server.js --name service-user --watch
+pm2 start ./server.js --name service-user --watch
 cd ..
 cd service-vip
-pm2 start server.js --name service-vip --watch
+pm2 start ./server.js --name service-vip --watch
 cd ..
 cd service-wx
-pm2 start server.js --name service-wx --watch
+pm2 start ./server.js --name service-wx --watch
 cd ..
 pm2 startup 
 pm2 save

+ 2 - 2
service-code/app/service/dictionary.js

@@ -15,8 +15,8 @@ class DictionaryService extends Service {
     try {
       const parent = await this.TypeModel.findOne({ code: parentCode });
       if (!parent) return { errcode: -1001, errmsg: '父级编码不存在', data: '' };
-      const obj = await this.model.findOne({ code });
-      if (obj) return { errcode: -1001, errmsg: '编码已存在', data: '' };
+      // const obj = await this.model.findOne({ code });
+      // if (obj) return { errcode: -1001, errmsg: '编码已存在', data: '' };
       const res = await this.model.create({ name, code, parentCode });
       return { errcode: 0, errmsg: 'ok', data: res };
     } catch (error) {

+ 2 - 1
service-gateway/app/controller/home.js

@@ -33,6 +33,7 @@ class HomeController extends Controller {
     const options = {
       method: requestMethod,
       data,
+      'Content-Type': 'application/json',
       nestedQuerystring: true,
     };
     // 如果是文件上传
@@ -42,12 +43,12 @@ class HomeController extends Controller {
       form.stream(stream.fieldname, stream, stream.filename);
       options.stream = form;
       options.headers = form.headers();
+      options['Content-Type'] = 'multipart/form-data';
     }
     // 发送请求
     const res = await this.ctx.curl(`${address}${path}`, options);
     // 默认返回值
     msg = res.data;
-
     // 日志详情默认值
     details = data;
     result = '成功';

+ 13 - 1
service-gateway/config/config.default.js

@@ -8,6 +8,7 @@ const log = require('./log');
 const login = require('./login');
 const wx = require('./wx');
 const naf = require('./naf');
+const journal = require('./journal');
 /**
  * @param {Egg.EggAppInfo} appInfo app info
  */
@@ -48,6 +49,17 @@ module.exports = appInfo => {
     cms: 'http://127.0.0.1:9004',
     wx: 'http://127.0.0.1:9005',
     log: 'http://127.0.0.1:9006',
+    market: 'http://127.0.0.1:9007',
+    goods: 'http://127.0.0.1:9008',
+    journal: 'http://127.0.0.1:9009',
+    contribution: 'http://127.0.0.1:9010',
+    org: 'http://127.0.0.1:9011',
+    media: 'http://127.0.0.1:9012',
+    user: 'http://127.0.0.1:9013',
+    vip: 'http://127.0.0.1:9014',
+    activity: 'http://127.0.0.1:9015',
+    importExport: 'http://127.0.0.1:9016',
+    reader: 'http://127.0.0.1:9017',
   };
   // 限制文件大小
   config.multipart = {
@@ -59,7 +71,7 @@ module.exports = appInfo => {
   config.jwt = {
     secret: '123456',
   };
-  config.apipath = { code, files, naf, cms, login, wx, log };
+  config.apipath = { code, files, naf, cms, login, wx, log, journal };
   return {
     ...config,
     ...userConfig,

+ 65 - 0
service-gateway/config/journal.js

@@ -0,0 +1,65 @@
+'use strict';
+module.exports = [
+  // 期刊
+  {
+    url: '/api/journal/intact/create',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  {
+    url: '/api/journal/intact/update',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  {
+    url: '/api/journal/intact/delete:id',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  {
+    url: '/api/journal/intact/query',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  {
+    url: '/api/journal/intact/fetch',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  // 目录
+  {
+    url: '/api/journal/catalogue/create',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  {
+    url: '/api/journal/catalogue/update',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  {
+    url: '/api/journal/catalogue/delete:id',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  {
+    url: '/api/journal/catalogue/query',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+  {
+    url: '/api/journal/catalogue/fetch',
+    jwt: true,
+    issuer: [ 'naf' ],
+    log: true,
+  },
+];

+ 1 - 1
service-journal/app/controller/catalogue.js

@@ -19,7 +19,7 @@ class CatalogueController extends Controller {
     this.ctx.body = res;
   }
   async fetch() {
-    const res = await this.ctx.service.catalogue.fetch(this.ctx.params);
+    const res = await this.ctx.service.catalogue.fetch(this.ctx.query);
     this.ctx.body = res;
   }
 }

+ 1 - 1
service-journal/app/controller/intact.js

@@ -19,7 +19,7 @@ class LntactController extends Controller {
     this.ctx.body = res;
   }
   async fetch() {
-    const res = await this.ctx.service.intact.fetch(this.ctx.params);
+    const res = await this.ctx.service.intact.fetch(this.ctx.query);
     this.ctx.body = res;
   }
 }

+ 2 - 0
service-journal/app/router.js

@@ -10,9 +10,11 @@ module.exports = app => {
   router.post('/api/journal/intact/update', controller.intact.update);
   router.delete('/api/journal/intact/delete/:id', controller.intact.delete);
   router.get('/api/journal/intact/query', controller.intact.query);
+  router.get('/api/journal/intact/fetch', controller.intact.fetch);
   // 目录
   router.post('/api/journal/catalogue/create', controller.catalogue.create);
   router.post('/api/journal/catalogue/update', controller.catalogue.update);
   router.delete('/api/journal/catalogue/delete/:id', controller.catalogue.delete);
   router.get('/api/journal/catalogue/query', controller.catalogue.query);
+  router.get('/api/journal/catalogue/fetch', controller.catalogue.fetch);
 };

+ 25 - 0
service-naf/config/menu.js

@@ -105,5 +105,30 @@ const data = [
     parentCode: 'contentHome',
     icon: 'el-icon-star-on',
   },
+  // 期刊管理
+  {
+    module: 'journal',
+    path: '',
+    title: '期刊管理',
+    code: 'journalHome',
+    parentCode: null,
+    icon: 'el-icon-star-on',
+  },
+  {
+    module: 'intact',
+    path: '/intact/home',
+    title: '期刊栏目',
+    code: 'intact',
+    parentCode: 'journalHome',
+    icon: 'el-icon-star-on',
+  },
+  {
+    module: 'catalogue',
+    path: '/catalogue/home',
+    title: '期刊目录',
+    code: 'catalogue',
+    parentCode: 'journalHome',
+    icon: 'el-icon-star-on',
+  },
 ];
 module.exports.data = data;

+ 9 - 0
sh脚本执行失败处理.md

@@ -0,0 +1,9 @@
+**解决办法:**
+
+  用vim打开.sh脚本文件, 重新设置文件的格式
+
+  :set ff 然后回车 再重新设置下文件格式:
+
+  :set ff=unix 然后保存退出
+
+  :wq! 回车