Commit 5b41cbe6 by liimin

优化框架设置

1 parent 387d00d5
'use strict';
const path = require('path');
module.exports = {
config: path.join(__dirname, 'database/config.json'),
'migrations-path': path.join(__dirname, 'database/migrations'),
'seeders-path': path.join(__dirname, 'database/seeders'),
'models-path': path.join(__dirname, 'app/model'),
};
\ No newline at end of file \ No newline at end of file
const { SUCCESS, ERROR } = require('./server_response_code'); /*
* @Author: limin
* @Date: 2019-11-21 11:20:08
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:12:52
*/
const { SUCCESS, ERROR } = require("./server_response_code");
module.exports = class ServerResponse { module.exports = class ServerResponse {
constructor(status, msg, data) { constructor(status, msg, data) {
...@@ -23,7 +30,7 @@ module.exports = class ServerResponse { ...@@ -23,7 +30,7 @@ module.exports = class ServerResponse {
return this.msg; return this.msg;
} }
static success({code = SUCCESS,msg='success',data=null}) { static Success({ code = SUCCESS, msg = "success", data = null }) {
return new ServerResponse(code, msg, data); return new ServerResponse(code, msg, data);
} }
...@@ -43,7 +50,7 @@ module.exports = class ServerResponse { ...@@ -43,7 +50,7 @@ module.exports = class ServerResponse {
// return new ServerResponse(SUCCESS, msg, data); // return new ServerResponse(SUCCESS, msg, data);
// } // }
static error({code=ERROR,msg='error', data=null}) { static Error({ code = ERROR, msg = "error", data = null }) {
return new ServerResponse(code, msg, data); return new ServerResponse(code, msg, data);
} }
// static createByError() { // static createByError() {
......
/*
* @Author: limin
* @Date: 2019-11-21 11:20:15
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:12:51
*/
module.exports = { module.exports = {
SUCCESS: 0, SUCCESS: 0,
ERROR: 1, ERROR: 1,
NEED_LOGIN: 10, NEED_LOGIN: 10,
NO_AUTH: 20, NO_AUTH: 20,
ILLEGAL_ARGUMENT: 2,
};
\ No newline at end of file \ No newline at end of file
ILLEGAL_ARGUMENT: 2
};
const Controller = require('egg').Controller; /*
module.exports = app => class DemoController extends Controller { * @Author: limin
* @Date: 2019-11-21 11:19:56
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:12:59
*/
const Controller = require("egg").Controller;
module.exports = app =>
class DemoController extends Controller {
constructor(ctx) { constructor(ctx) {
super(ctx); super(ctx);
this.session = ctx.session; this.session = ctx.session;
...@@ -11,7 +19,11 @@ module.exports = app => class DemoController extends Controller { ...@@ -11,7 +19,11 @@ module.exports = app => class DemoController extends Controller {
// hello // hello
async hello() { async hello() {
const response = await this.DemoService.hello(this.request.body); //调用 redis 缓存服务 , 否则调用 servie 从数据库读取
this.ctx.body = response; // 如果不用 缓存 直接 调用 servie this.DemoService.hello(this.request.body) 即可
const data = await this.CacheService.get("test", () =>
this.DemoService.hello(this.request.body)
);
this.ctx.body = this.ServerResponse.Success({ data });
} }
};
\ No newline at end of file \ No newline at end of file
};
'use strict'; /*
* @Author: limin
* @Date: 2019-11-21 11:19:51
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:13:04
*/
const Controller = require('egg').Controller; "use strict";
const Controller = require("egg").Controller;
class HomeController extends Controller { class HomeController extends Controller {
constructor(ctx) { constructor(ctx) {
...@@ -8,24 +15,27 @@ class HomeController extends Controller { ...@@ -8,24 +15,27 @@ class HomeController extends Controller {
} }
async index() { async index() {
console.log(this.app); console.log(this.app);
this.ctx.body = 'hi, egg'; this.ctx.body = "hi, egg";
} }
// 验证登录并且生成 token // 验证登录并且生成 token
async login() { async login() {
const { ctx ,app } = this; const { ctx, app } = this;
//获取用户端传递过来的参数 //获取用户端传递过来的参数
// const data = ctx.request.body; // const data = ctx.request.body;
// 进行验证 data 数据 登录是否成功 // 进行验证 data 数据 登录是否成功
// ......... // .........
//成功过后进行一下操作 //成功过后进行一下操作
//生成 token 的方式 //生成 token 的方式
const token = app.jwt.sign({ const token = app.jwt.sign(
username: 'limin', //需要存储的 token 数据 {
}, app.config.jwt.secret); username: "limin" //需要存储的 token 数据
},
app.config.jwt.secret
);
// 生成的token = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJpYXQiOjE1NjAzNDY5MDN9.B95GqH-fdRpyZIE5g_T0l8RgzNyWOyXepkLiynWqrJg // 生成的token = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJpYXQiOjE1NjAzNDY5MDN9.B95GqH-fdRpyZIE5g_T0l8RgzNyWOyXepkLiynWqrJg
// 返回 token 到前端 // 返回 token 到前端
ctx.body = token; ctx.body = token;
}; }
} }
module.exports = HomeController; module.exports = HomeController;
/*
* @Author: limin
* @Date: 2019-11-21 11:20:01
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:12:45
*/
"use strict";
const Controller = require("egg").Controller;
class UserController extends Controller {
constructor(ctx) {
super(ctx);
this.session = ctx.session;
this.request = ctx.request;
this.UserService = ctx.service.screen.user;
this.CacheService = ctx.service.cache; //redis 缓存服务
this.ServerResponseCode = ctx.response.ServerResponseCode;
this.ServerResponse = ctx.response.ServerResponse;
}
async statistics() {
const nPid = this.request.query.pid;
const statics = await this.CacheService.get("test", () =>
this.UserService.statistics(nPid)
);
const data = { statics };
this.ctx.body = this.ServerResponse.Success({ data });
}
}
module.exports = UserController;
/*
* @Author: limin
* @Date: 2019-11-21 11:19:43
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 11:19:43
*/
// const moment = require('moment'); // const moment = require('moment');
// exports.relativeTime = time => moment(new Date(time * 1000)).fromNow(); // exports.relativeTime = time => moment(new Date(time * 1000)).fromNow();
\ No newline at end of file \ No newline at end of file
/*
* @Author: limin
* @Date: 2019-11-21 11:19:33
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:13:13
*/
const ServerResponse = require("../common/server_response"); const ServerResponse = require("../common/server_response");
const ServerResponseCode = require("../common/server_response_code"); const ServerResponseCode = require("../common/server_response_code");
......
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('t_city', {
id: {
type: DataTypes.INTEGER(10),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
city_code: {
type: DataTypes.STRING(32),
allowNull: false,
unique: true
},
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
city_name: {
type: DataTypes.STRING(64),
allowNull: false
},
create_time: {
type: DataTypes.DATE,
allowNull: true
},
update_time: {
type: DataTypes.DATE,
allowNull: true
}
}, {
tableName: 't_city'
});
Model.associate = function() {
}
return Model;
};
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('t_province', {
id: {
type: DataTypes.INTEGER(10),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
prov_code: {
type: DataTypes.STRING(32),
allowNull: false,
unique: true
},
prov_name: {
type: DataTypes.STRING(64),
allowNull: false
},
create_time: {
type: DataTypes.DATE,
allowNull: true
},
update_time: {
type: DataTypes.DATE,
allowNull: true
}
}, {
tableName: 't_province'
});
Model.associate = function() {
}
return Model;
};
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
day: { day: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: false,
......
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
days_range: { days_range: {
type: DataTypes.STRING(32), type: DataTypes.STRING(32),
allowNull: false, allowNull: false,
......
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
miles_range: { miles_range: {
type: DataTypes.STRING(32), type: DataTypes.STRING(32),
allowNull: false, allowNull: false,
......
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
brand_code: { brand_code: {
type: DataTypes.STRING(32), type: DataTypes.STRING(32),
allowNull: false, allowNull: false,
......
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
price_range: { price_range: {
type: DataTypes.STRING(32), type: DataTypes.STRING(32),
allowNull: false, allowNull: false,
......
...@@ -12,12 +12,12 @@ module.exports = app => { ...@@ -12,12 +12,12 @@ module.exports = app => {
}, },
prov_code: { prov_code: {
type: DataTypes.STRING(32), type: DataTypes.STRING(32),
allowNull: false, allowNull: false
unique: true
}, },
prov_name: { city_code: {
type: DataTypes.STRING(32), type: DataTypes.STRING(32),
allowNull: false allowNull: false,
unique: true
}, },
total: { total: {
type: DataTypes.INTEGER(10), type: DataTypes.INTEGER(10),
......
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
gender_range: { gender_range: {
type: DataTypes.STRING(32), type: DataTypes.STRING(32),
allowNull: false, allowNull: false,
......
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
day: { day: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: false,
......
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
day: { day: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: false,
......
...@@ -15,15 +15,16 @@ module.exports = app => { ...@@ -15,15 +15,16 @@ module.exports = app => {
allowNull: false, allowNull: false,
unique: true unique: true
}, },
prov_name: {
type: DataTypes.STRING(32),
allowNull: false
},
total: { total: {
type: DataTypes.INTEGER(10), type: DataTypes.INTEGER(10),
allowNull: false, allowNull: false,
defaultValue: '0' defaultValue: '0'
}, },
online_total: {
type: DataTypes.INTEGER(10),
allowNull: false,
defaultValue: '0'
},
create_time: { create_time: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: true allowNull: true
......
...@@ -10,6 +10,10 @@ module.exports = app => { ...@@ -10,6 +10,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
prov_code: {
type: DataTypes.STRING(32),
allowNull: false
},
day: { day: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: false,
......
...@@ -27,6 +27,14 @@ module.exports = app => { ...@@ -27,6 +27,14 @@ module.exports = app => {
update_time: { update_time: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: true allowNull: true
},
created_at: {
type: DataTypes.DATE,
allowNull: false
},
updated_at: {
type: DataTypes.DATE,
allowNull: false
} }
}, { }, {
tableName: 't_user_summary' tableName: 't_user_summary'
......
/* jshint indent: 2 */ /* indent size: 2 */
module.exports = app=> { module.exports = app => {
const { STRING, INTEGER,DECIMAL } = app.Sequelize; const DataTypes = app.Sequelize;
const Usedrow = app.model.define('usedrow', {
const Model = app.model.define('usedrow', {
dbname: { dbname: {
type: STRING(100), type: DataTypes.STRING(100),
allowNull: true, allowNull: false,
primaryKey: true // 必须指定一个主键 defaultValue: '',
primaryKey: true
}, },
tname: { tname: {
type: STRING(100), type: DataTypes.STRING(100),
allowNull: true allowNull: true
}, },
cname: { cname: {
type: STRING(100), type: DataTypes.STRING(100),
allowNull: true allowNull: true
}, },
datatype: { datatype: {
type: STRING(30), type: DataTypes.STRING(30),
allowNull: true allowNull: true
}, },
maxrows: { maxrows: {
type: INTEGER(11), type: DataTypes.INTEGER(11),
allowNull: true allowNull: true
}, },
usedpercent: { usedpercent: {
type: DECIMAL, type: DataTypes.DECIMAL,
allowNull: true allowNull: true
}, },
tablerows: { tablerows: {
type: INTEGER(11), type: DataTypes.INTEGER(11),
allowNull: true allowNull: true
}, },
extra: { extra: {
type: STRING(30), type: DataTypes.STRING(30),
allowNull: true allowNull: true
} }
}, { }, {
tableName: 'usedrow', tableName: 'usedrow'
freezeTableName: true,
timestamps: false
}); });
return Usedrow;
Model.associate = function() {
}
return Model;
}; };
/*
* @Author: limin
* @Date: 2019-11-21 11:18:57
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 11:18:57
*/
'use strict'; 'use strict';
/** /**
...@@ -8,4 +15,5 @@ module.exports = app => { ...@@ -8,4 +15,5 @@ module.exports = app => {
router.get('/',controller.home.index); router.get('/',controller.home.index);
router.post('/login', controller.home.login); router.post('/login', controller.home.login);
require('./router/demo')(app); require('./router/demo')(app);
require('./router/screen/user')(app);
}; };
/*
* @Author: limin
* @Date: 2019-11-21 11:19:15
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 11:19:15
*/
module.exports = app => { module.exports = app => {
app.router.get('/demo/hello', app.controller.demo.hello); app.router.get('/demo/hello', app.controller.demo.hello);
};
\ No newline at end of file \ No newline at end of file
}
\ No newline at end of file \ No newline at end of file
module.exports = app => {
app.router.get('/screen/', app.controller.demo.hello);
};
\ No newline at end of file \ No newline at end of file
/*
* @Author: limin
* @Date: 2019-11-21 11:18:45
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:13:29
*/
module.exports = app => {
app.router.get('/screen/user/statistics', app.controller.screen.user.statistics);
};
\ No newline at end of file \ No newline at end of file
/*
* @Author: limin
* @Date: 2019-11-21 14:32:51
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:07:57
*/
"use strict";
const Service = require("egg").Service;
class CacheService extends Service {
constructor(ctx) {
super(ctx);
this.session = ctx.session;
this.ResponseCode = ctx.response.ResponseCode;
this.ServerResponse = ctx.response.ServerResponse;
}
async set(key, value, ex = 60 * 60) {
this.app.redis && (await this.app.redis.set(key, value, "EX", ex));
}
async get(key, fnGetFromDB, ex) {
if (this.app.redis) {
return await this.app.redis.get(key);
}
if (fnGetFromDB) {
var data = await fnGetFromDB();
await this.set(key, data, ex);
return data;
}
return null;
}
}
module.exports = CacheService;
/*
* @Author: limin
* @Date: 2019-11-21 11:18:30
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 11:18:30
*/
const Service = require("egg").Service; const Service = require("egg").Service;
class DemoService extends Service { class DemoService extends Service {
constructor(ctx) { constructor(ctx) {
super(ctx); super(ctx);
this.session = ctx.session; this.session = ctx.session;
this.DemoModel = ctx.model.Usedrow; this.DemoModel = ctx.model.Usedrow1;
this.ServerResponse = ctx.response.ServerResponse; this.ServerResponse = ctx.response.ServerResponse;
this.ServerResponseCode = ctx.response.ServerResponseCode; this.ServerResponseCode = ctx.response.ServerResponseCode;
} }
...@@ -16,6 +23,7 @@ class DemoService extends Service { ...@@ -16,6 +23,7 @@ class DemoService extends Service {
* @return {Promise.<boolean>} * @return {Promise.<boolean>}
*/ */
async hello() { async hello() {
console.log(this.DemoModel);
const data = await this.DemoModel.findAndCountAll({ const data = await this.DemoModel.findAndCountAll({
where: { tname: "app" } where: { tname: "app" }
}); });
......
/*
* @Author: limin
* @Date: 2019-11-21 11:18:37
* @Last Modified by: limin
* @Last Modified time: 2019-11-21 17:21:17
*/
const Service = require("egg").Service; const Service = require("egg").Service;
class UserService extends Service { class UserService extends Service {
...@@ -9,15 +16,13 @@ class UserService extends Service { ...@@ -9,15 +16,13 @@ class UserService extends Service {
this.ServerResponse = ctx.response.ServerResponse; this.ServerResponse = ctx.response.ServerResponse;
} }
/** /**
*
* @param field {String} * @param field {String}
* @param value {String} * @param value {String}
* @return {Promise.<boolean>} * @return {Promise.<boolean>}
*/ */
async hello() { async statistics(pid) {
const data = await this.DemoModel.findAndCountAll({ const where = pid ? { prov_code: pid } : {};
where: { tname: "app" } const data = await this.UserActiveDailyModel.sum("total", { where });
});
return data; return data;
} }
} }
......
...@@ -2,49 +2,101 @@ ...@@ -2,49 +2,101 @@
* @Author: limin * @Author: limin
* @Date: 2019-11-16 09:26:53 * @Date: 2019-11-16 09:26:53
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-11-16 09:28:07 * @Last Modified time: 2019-11-21 17:59:40
*/ */
/* eslint valid-jsdoc: "off" */ /* eslint valid-jsdoc: "off" */
'use strict'; "use strict";
/** /**
* @param {Egg.EggAppInfo} appInfo app info * @param {Egg.EggAppInfo} app app info
*/ */
module.exports = appInfo => { module.exports = app => {
/** /**
* built-in config * built-in config
* @type {Egg.EggAppConfig} * @type {Egg.EggAppConfig}
**/ **/
const config = exports = {}; const config = (exports = {});
// use for cookie sign key, should change to your own and keep security // use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1573615133248_6253'; config.keys = app.name + "_1573615133248_6253";
// add your middleware config here // add your middleware config here
config.middleware = []; config.middleware = [];
config.onerror = {
//全局异常捕获
all(err, ctx) {
// 在此处定义针对所有响应类型的错误处理方法
// 注意,定义了 config.all 之后,其他错误处理方法不会再生效
ctx.body = JSON.stringify(
ctx.response.ServerResponse.Error({ msg: err.message })
);
ctx.status = 500;
}
// html(err, ctx) {
// // html hander
// ctx.body = '<h3>error</h3>';
// ctx.status = 500;
// },
// json(err, ctx) {
// // json hander
// ctx.body = { message: 'error' };
// ctx.status = 500;
// },
// jsonp(err, ctx) {
// // 一般来说,不需要特殊针对 jsonp 进行错误定义,jsonp 的错误处理会自动调用 json 错误处理,并包装成 jsonp 的响应格式
// },
};
// add your user config here // add your user config here
const userConfig = { const userConfig = {
jwt : { jwt: {
secret: "glsx-data-screen-server"//自定义 token 的加密条件字符串 secret: "glsx-data-screen-server" //自定义 token 的加密条件字符串
}, },
cors : { cors: {
origin:'*', origin: "*",
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH' allowMethods: "GET,HEAD,PUT,POST,DELETE,PATCH"
}, },
security: { security: {
csrf: { csrf: {
enable: false, enable: false,
ignoreJSON: true ignoreJSON: true
}, },
domainWhiteList: ['http://localhost:8080'],//允许访问接口的白名单 domainWhiteList: ["http://localhost:8080"] //允许访问接口的白名单
},
redis: {
client: {
port: 6379, // Redis port
host: "127.0.0.1", // Redis host
password: "auth",
db: 0
}
},
sequelize: {
define: {
underscored: true, // 注意需要加上这个, egg-sequelize只是简单的使用Object.assign对配置和默认配置做了merge, 如果不加这个 update_at会被转变成 updateAt故报错
freezeTableName: true, // 禁止修改表名,默认情况下,sequelize将自动将所有传递的模型名称(define的第一个参数)转换为复数
// 但是为了安全着想,复数的转换可能会发生变化,所以禁止该行为
timestamps: false, // 不自动维护时间戳 [ created_at、updated_at ]
timezone: "+08:00", // 保存为本地时区
dialectOptions: {
dateStrings: true,
typeCast(field, next) {
// for reading from database
if (field.type === "DATETIME") {
return field.string();
}
return next();
}
}
}
} }
}; };
return { return {
...config, ...config,
...userConfig, ...userConfig
}; };
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-11-16 09:26:47 * @Date: 2019-11-16 09:26:47
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-11-20 18:29:52 * @Last Modified time: 2019-11-21 17:25:19
*/ */
/* eslint valid-jsdoc: "off" */ /* eslint valid-jsdoc: "off" */
...@@ -17,11 +17,11 @@ module.exports = appInfo => { ...@@ -17,11 +17,11 @@ module.exports = appInfo => {
* built-in config * built-in config
* @type {Egg.EggAppConfig} * @type {Egg.EggAppConfig}
**/ **/
const config = exports = {}; const config = (exports = {});
config.logger = { config.logger = {
level: "INFO", level: "INFO",
dir: path.join(__dirname, "../logs/dev/app") // 保存路径为工程路径下`logs/prod/app` dir: path.join(__dirname, "../logs/dev") // 保存路径为工程路径下`logs/dev`
}; };
// add your user config here // add your user config here
// myAppName: 'egg', // myAppName: 'egg',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-11-16 09:26:40 * @Date: 2019-11-16 09:26:40
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-11-16 09:28:51 * @Last Modified time: 2019-11-21 17:56:42
*/ */
/* eslint valid-jsdoc: "off" */ /* eslint valid-jsdoc: "off" */
...@@ -21,7 +21,7 @@ module.exports = appInfo => { ...@@ -21,7 +21,7 @@ module.exports = appInfo => {
config.logger = { config.logger = {
level: "INFO", level: "INFO",
dir: path.join(__dirname, "../logs/prod/app") // 保存路径为工程路径下`logs/prod/app` dir: path.join(__dirname, "../logs/pro") // 保存路径为工程路径下`logs/pro`
}; };
// add your user config here // add your user config here
// myAppName: 'egg', // myAppName: 'egg',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-11-16 09:27:00 * @Date: 2019-11-16 09:27:00
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-11-18 15:16:23 * @Last Modified time: 2019-11-21 17:14:09
*/ */
"use strict"; "use strict";
...@@ -29,3 +29,8 @@ exports.cors = { ...@@ -29,3 +29,8 @@ exports.cors = {
enable: true, enable: true,
package: "egg-cors" package: "egg-cors"
}; };
exports.redis = {
enable: false,
package: "egg-redis"
};
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"egg": "^2.15.1", "egg": "^2.15.1",
"egg-cors": "^2.2.3", "egg-cors": "^2.2.3",
"egg-jwt": "^3.1.6", "egg-jwt": "^3.1.6",
"egg-redis": "^2.4.0",
"egg-scripts": "^2.11.0", "egg-scripts": "^2.11.0",
"egg-sequelize": "^5.2.0", "egg-sequelize": "^5.2.0",
"mysql2": "^2.0.0" "mysql2": "^2.0.0"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!