Commit 48cbf837 by liimin

完善接口

1 parent 5b41cbe6
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Egg Debug",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"debug",
"--",
"--inspect-brk"
],
"console": "integratedTerminal",
"restart": true,
"protocol": "auto",
"port": 9229,
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Egg Test",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"test-local",
"--",
"--inspect-brk"
],
"protocol": "auto",
"port": 9229,
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "attach",
"name": "Egg Attach to remote",
"localRoot": "${workspaceRoot}",
"remoteRoot": "/usr/src/app",
"address": "localhost",
"protocol": "auto",
"port": 9999
}
]
}
\ No newline at end of file \ No newline at end of file
module.exports = app => {
app.beforeStart(async function() {
// 应用会等待这个函数执行完成才启动
// await app.model.sync({ force: true }); // 开发环境使用
await app.model.sync({});
});
};
\ No newline at end of file \ No newline at end of file
// module.exports = app => {
// app.beforeStart(async function() {
// // 应用会等待这个函数执行完成才启动
// // await app.model.sync({ force: true }); // 开发环境使用
// await app.model.sync({});
// });
class AppBootHook {
constructor(app) {
this.app = app;
}
configWillLoad() {
console.log(`
◆ 项目:广联赛讯数据大屏后台
◆ 语言:Javascript
◆ 框架:Node.js + Egg.js + MySql
◆ 版本控制: git-github
◆ 代码风格:eslint-standard
◆ 编辑器: VSCode
◆ 数据库: mysql
◆ 服务器端脚本: Node.js
◆ author: limin
`)
}
}
module.exports = AppBootHook;
...@@ -30,8 +30,9 @@ module.exports = class ServerResponse { ...@@ -30,8 +30,9 @@ module.exports = class ServerResponse {
return this.msg; return this.msg;
} }
static Success({ code = SUCCESS, msg = "success", data = null }) { static Success(data = null,respo = SUCCESS) {
return new ServerResponse(code, msg, data); const { code,message } = respo
return new ServerResponse(code,message, data);
} }
// static createBySuccess() { // static createBySuccess() {
...@@ -50,8 +51,9 @@ module.exports = class ServerResponse { ...@@ -50,8 +51,9 @@ 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(data = null , respo = ERROR ) {
return new ServerResponse(code, msg, data); const { code,message } = respo
return new ServerResponse(code,message, data);
} }
// static createByError() { // static createByError() {
// return new ServerResponse(ERROR, 'error', null); // return new ServerResponse(ERROR, 'error', null);
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
*/ */
module.exports = { module.exports = {
SUCCESS: 0, SUCCESS: {code:0,message:'SUCCESS!'},
ERROR: 1, ERROR: {code:1,message:'ERROR!'},
NEED_LOGIN: 10, NEED_LOGIN: {code:10,message:'请登录!'},
NO_AUTH: 20, NO_AUTH: {code:20,message:'无权限访问!'},
ILLEGAL_ARGUMENT: 2 ILLEGAL_ARGUMENT: {code:2,message:'参数错误!'}
}; };
/*
* @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;
/**
* @Controller base
* @Description 数据大屏-用户
*/
class BaseController extends Controller {
constructor(ctx) {
super(ctx);
this.session = ctx.session;
this.request = ctx.request;
this.BaseService = ctx.service.base;
this.CacheService = ctx.service.cache; //redis 缓存服务
this.ServerResponseCode = ctx.response.ServerResponseCode;
this.ServerResponse = ctx.response.ServerResponse;
}
/**
* @Router GET /base/provinces
* @Description 获取所有省份
*/
async provinces() {
const data = await this.CacheService.get("gds_provinces", () =>
this.BaseService.provinces()
);
this.ctx.body = this.ServerResponse.Success({ data });
}
/**
* @Router GET /base/cities
* @Description 通过省份id获取城市
* @Request query integer pid 省份id
*/
async cities_by_pid() {
const nPid = this.request.query.pid;
if(!nPid){
this.ctx.body = this.ServerResponse.Error(null,this.ServerResponseCode.ILLEGAL_ARGUMENT);
return
}
const data = await this.CacheService.get(`gds_cities_${nPid}`, () =>
this.BaseService.cities_by_pid(nPid)
);
this.ctx.body = this.ServerResponse.Success(data);
}
}
module.exports = BaseController;
...@@ -24,6 +24,6 @@ module.exports = app => ...@@ -24,6 +24,6 @@ module.exports = app =>
const data = await this.CacheService.get("test", () => const data = await this.CacheService.get("test", () =>
this.DemoService.hello(this.request.body) this.DemoService.hello(this.request.body)
); );
this.ctx.body = this.ServerResponse.Success({ data }); this.ctx.body = this.ServerResponse.Success(data);
} }
}; };
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
"use strict"; "use strict";
const Controller = require("egg").Controller; const Controller = require("egg").Controller;
/**
* @Controller screen/user
* @Description 数据大屏-用户
*/
class UserController extends Controller { class UserController extends Controller {
constructor(ctx) { constructor(ctx) {
super(ctx); super(ctx);
...@@ -19,13 +22,168 @@ class UserController extends Controller { ...@@ -19,13 +22,168 @@ class UserController extends Controller {
this.ServerResponseCode = ctx.response.ServerResponseCode; this.ServerResponseCode = ctx.response.ServerResponseCode;
this.ServerResponse = ctx.response.ServerResponse; this.ServerResponse = ctx.response.ServerResponse;
} }
async statistics() { /**
* @Router GET /screen/user/total
* @Description 数据大屏-用户总数统计.----参数pid 有 则返回对应的省份数据.没有则是全国数据的统计
* @Request query integer pid 省份id
*/
async total() {
const nPid = this.request.query.pid; const nPid = this.request.query.pid;
const statics = await this.CacheService.get("test", () => const statics = await this.UserService.total(nPid);
this.UserService.statistics(nPid)
);
const data = { statics }; const data = { statics };
this.ctx.body = this.ServerResponse.Success({ data }); this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/statistics
* @Description 数据大屏-数据统计 1. 近七天新增用户数 2.近七天用户活跃度 3.近30天用户留存率 4.用户付费转化率
* @Request query integer pid 省份id
*/
async statistics() {
const nPid = this.request.query.pid;
const n = this.request.query.n || 7; //近 n 天 默认 7天
//近7天新增用户数
const increased = await this.UserService.last_n_day_user_increased(nPid,n);
//近七天 活跃用户数
const nLive = await this.UserService.last_n_day_user_lively(nPid,n);
// 近七天 用户活跃度 (近N天 活跃用户数 / 近N天新增用户数)
const live = ((nLive / increased) * 100).toFixed(2) + '%';
const data = { increased,live };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/increase
* @Description 数据大屏-用户 N天 新增趋势 (默认 7天 不包括当天)
* @Request query integer pid 省份id
* @Request query integer n 初始化 近n 天(默认7天)
*/
async increase() {
const nPid = this.request.query.pid;
const n = this.request.query.n || 7; //近 n 天 默认 7天
//近7天新增用户数 明细
const list = await this.UserService.last_n_day_user_increased_detail(nPid,n);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/lively
* @Description 数据大屏-用户N天 活跃趋势 (默认 7天 不包括当天)
* @Request query integer pid 省份id
* @Request query integer n 初始化 近n天(默认7天)
*/
async lively() {
const nPid = this.request.query.pid;
const n = this.request.query.n || 7; //近 n 天 默认 7天
//近7天新增用户数 明细
const list = await this.UserService.last_n_day_user_lively_detail(nPid,n);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/renew
* @Description 数据大屏-用户 N天 付费转化趋势 (默认 7天 不包括当天)
* @Request query integer pid 省份id
* @Request query integer n 初始化 近n 天(默认7天)
*/
async renew() {
const nPid = this.request.query.pid;
const n = this.request.query.n || 7; //近 n 天 默认 7天
//近7天新增用户数 明细
const list = await this.UserService.last_n_day_user_renew_detail(nPid,n);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/journey
* @Description 数据大屏-用户N天 出行趋势 (默认 7天 不包括当天)
* @Request query integer pid 省份id
* @Request query integer n 初始化 近n天(默认7天)
*/
async journey() {
const nPid = this.request.query.pid;
const n = this.request.query.n || 7; //近 n 天 默认 7天
//近7天新增用户数 明细
const list = await this.UserService.last_n_day_user_journey_detail(nPid,n);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/analysis
* @Description 数据大屏-用户分析
* @Request query integer pid 省份id
*/
async analysis() {
const nPid = this.request.query.pid;
const list = await this.UserService.analysis(nPid);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/carbrand
* @Description 数据大屏-用户车辆品牌排行
* @Request query integer pid 省份id
* @Request query integer n 前n名(默认 5)
*/
async carbrand() {
const nPid = this.request.query.pid;
const n = this.request.query.n || 5; //前n名(默认 5)
const list = await this.UserService.carbrand(nPid,n);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/carprice
* @Description 数据大屏-用户车辆品牌排行
* @Request query integer pid 省份id
*/
async carprice() {
const nPid = this.request.query.pid;
const list = await this.UserService.carprice(nPid);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/city
* @Description 数据大屏-用户城市排行
* @Request query integer pid 省份id
* @Request query integer n 前n名(默认 8)
*/
async city() {
const nPid = this.request.query.pid;
const n = this.request.query.n || 8; //前n名 默认 8
const list = await this.UserService.city(nPid,n);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/milesdaily
* @Description 数据大屏-用户日均里程分布
* @Request query integer pid 省份id
*/
async milesdaily() {
const nPid = this.request.query.pid;
const list = await this.UserService.milesdaily(nPid);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
}
/**
* @Router GET /screen/user/drivedays
* @Description 数据大屏-用户日均里程分布
* @Request query integer pid 省份id
*/
async drivedays() {
const nPid = this.request.query.pid;
const list = await this.UserService.drivedays(nPid);
const data = { list };
this.ctx.body = this.ServerResponse.Success(data);
} }
} }
......
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
* @Last Modified time: 2019-11-21 11:19:43 * @Last Modified time: 2019-11-21 11:19:43
*/ */
// const moment = require('moment');
// exports.relativeTime = time => moment(new Date(time * 1000)).fromNow();
\ No newline at end of file \ No newline at end of file
const moment = require('moment');
// exports.relativeTime = time => moment(new Date(time * 1000)).fromNow();
exports.date = (n,f='YYYY-MM-DD') => moment().add(n,'days').format(f);
\ No newline at end of file \ No newline at end of file
...@@ -23,6 +23,10 @@ module.exports = app => { ...@@ -23,6 +23,10 @@ module.exports = app => {
type: DataTypes.STRING(64), type: DataTypes.STRING(64),
allowNull: false allowNull: false
}, },
cyb_city_code: {
type: DataTypes.STRING(32),
allowNull: true
},
create_time: { create_time: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: true allowNull: true
......
...@@ -19,6 +19,10 @@ module.exports = app => { ...@@ -19,6 +19,10 @@ module.exports = app => {
type: DataTypes.STRING(64), type: DataTypes.STRING(64),
allowNull: false allowNull: false
}, },
cyb_prov_code: {
type: DataTypes.STRING(32),
allowNull: true
},
create_time: { create_time: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: true allowNull: true
......
...@@ -15,5 +15,6 @@ module.exports = app => { ...@@ -15,5 +15,6 @@ 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/base')(app);
require('./router/screen/user')(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 => {
app.router.get('/base/provinces', app.controller.base.provinces);
app.router.get('/base/cities/:pid', app.controller.base.cities_by_pid);
}
\ No newline at end of file \ No newline at end of file
...@@ -6,5 +6,16 @@ ...@@ -6,5 +6,16 @@
*/ */
module.exports = app => { module.exports = app => {
app.router.get('/screen/user/total', app.controller.screen.user.total);
app.router.get('/screen/user/statistics', app.controller.screen.user.statistics); app.router.get('/screen/user/statistics', app.controller.screen.user.statistics);
app.router.get('/screen/user/increase',app.controller.screen.user.increase);
app.router.get('/screen/user/lively',app.controller.screen.user.lively);
app.router.get('/screen/user/renew',app.controller.screen.user.renew);
app.router.get('/screen/user/journey',app.controller.screen.user.journey);
app.router.get('/screen/user/analysis',app.controller.screen.user.analysis);
app.router.get('/screen/user/carbrand',app.controller.screen.user.carbrand);
app.router.get('/screen/user/carprice',app.controller.screen.user.carprice);
app.router.get('/screen/user/city',app.controller.screen.user.city);
app.router.get('/screen/user/milesdaily',app.controller.screen.user.milesdaily);
app.router.get('/screen/user/drivedays',app.controller.screen.user.drivedays);
}; };
\ No newline at end of file \ No newline at end of file
/*
* @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;
class BaseService extends Service {
constructor(ctx) {
super(ctx);
this.session = ctx.session;
this.ProvinceModel = ctx.model.TProvince;
this.CityModel = ctx.model.TCity;
this.ServerResponse = ctx.response.ServerResponse;
this.ServerResponseCode = ctx.response.ServerResponseCode;
}
/**
*
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
*/
async provinces() {
return await this.ProvinceModel.findAll();
}
/**
*
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
*/
async cities_by_pid(pid) {
return await this.CityModel.findAll({
where:{'prov_code':pid}
});
}
}
module.exports = BaseService;
...@@ -6,12 +6,23 @@ ...@@ -6,12 +6,23 @@
*/ */
const Service = require("egg").Service; const Service = require("egg").Service;
// var moment = require('moment');/
class UserService extends Service { class UserService extends Service {
constructor(ctx) { constructor(ctx) {
super(ctx); super(ctx);
this.session = ctx.session; this.session = ctx.session;
this.UserActiveDailyModel = ctx.model.TUserActiveDaily; this.helper = ctx.helper;
this.Op = ctx.app.Sequelize.Op
this.ModelActive = ctx.model.TUserActiveDaily;
this.ModelIncreased = ctx.model.TUserIncreasedDaily;
this.ModelRenew = ctx.model.TUserRenewDaily;
this.ModelGender = ctx.model.TUserGender;
this.ModelCarBrand = ctx.model.TUserCarbrand;
this.ModelCarPrice = ctx.model.TUserCarprice;
this.ModelCity = ctx.model.TUserCity;
this.ModelMilesDaily = ctx.model.TUserAverageMilesDay;
this.ModelDriveDaysMonth = ctx.model.TUserAverageDriveMonth;
this.ModelJourney = ctx.model.TUserJourneyDaily;
this.ResponseCode = ctx.response.ResponseCode; this.ResponseCode = ctx.response.ResponseCode;
this.ServerResponse = ctx.response.ServerResponse; this.ServerResponse = ctx.response.ServerResponse;
} }
...@@ -20,9 +31,211 @@ class UserService extends Service { ...@@ -20,9 +31,211 @@ class UserService extends Service {
* @param value {String} * @param value {String}
* @return {Promise.<boolean>} * @return {Promise.<boolean>}
*/ */
async statistics(pid) { async total(pid) {
const where = pid ? { prov_code: pid } : {}; const where = pid ? { prov_code: pid } : {};
const data = await this.UserActiveDailyModel.sum("total", { where }); const data = await this.ModelActive.sum("total", { where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 近N天 新增用户数
*/
async last_n_day_user_increased(pid,n) {
let where = {
'day': {
[this.Op.between]:[this.helper.date(-n), this.helper.date(0)]
}
}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelIncreased.sum("total", { where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 近N天 新增用户数 明细
*/
async last_n_day_user_increased_detail(pid,n) {
let where = {
'day': {
[this.Op.between]:[this.helper.date(-n), this.helper.date(0)]
}
}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelIncreased.findAll({ where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 近N天 用户活跃度
*/
async last_n_day_user_lively(pid,n) {
let where = {
'day': {
[this.Op.between]:[this.helper.date(-n), this.helper.date(0)]
}
}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelActive.sum("total", { where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 近N天 活跃 明细
*/
async last_n_day_user_lively_detail(pid,n) {
let where = {
'day': {
[this.Op.between]:[this.helper.date(-n), this.helper.date(0)]
}
}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelActive.findAll({ where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 近N天 付费转换 明细
*/
async last_n_day_user_renew_detail(pid,n) {
let where = {
'day': {
[this.Op.between]:[this.helper.date(-n), this.helper.date(0)]
}
}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelRenew.findAll({ where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 用户分析
*/
async analysis(pid) {
// let where = {}
// if(pid){
// where.prov_code = pid;
// }
// const data = await this.ModelGender.sum('total',{ where,group:['gender_range','']});
// return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 用户车辆品牌分布
*/
async carbrand(pid,limit) {
let where = {}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelCarBrand.findAll({ where,limit,order: [['brand_cars', 'DESC']]});
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 用户车辆价格分布
*/
async carprice(pid) {
let where = {}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelCarPrice.findAll({ where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 用户城市排行
*/
async city(pid,limit) {
let where = {}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelCity.findAll({ where,limit,order: [['total', 'DESC']]});
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 用户日均里程分布
*/
async milesdaily(pid) {
let where = {}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelMilesDaily.findAll({ where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 用户日均里程分布
*/
async drivedays(pid) {
let where = {}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelDriveDaysMonth.findAll({ where });
return data;
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 近N天 用户出行明细
*/
async last_n_day_user_journey_detail(pid,n) {
let where = {
'day': {
[this.Op.between]:[this.helper.date(-n), this.helper.date(0)]
}
}
if(pid){
where.prov_code = pid;
}
const data = await this.ModelJourney.findAll({ where });
return data; return data;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @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-21 17:59:40 * @Last Modified time: 2019-11-22 09:48:42
*/ */
/* eslint valid-jsdoc: "off" */ /* eslint valid-jsdoc: "off" */
...@@ -75,12 +75,12 @@ module.exports = app => { ...@@ -75,12 +75,12 @@ module.exports = app => {
} }
}, },
sequelize: { sequelize: {
timezone: "+08:00", // 保存为本地时区
define: { define: {
underscored: true, // 注意需要加上这个, egg-sequelize只是简单的使用Object.assign对配置和默认配置做了merge, 如果不加这个 update_at会被转变成 updateAt故报错 underscored: true, // 注意需要加上这个, egg-sequelize只是简单的使用Object.assign对配置和默认配置做了merge, 如果不加这个 update_at会被转变成 updateAt故报错
freezeTableName: true, // 禁止修改表名,默认情况下,sequelize将自动将所有传递的模型名称(define的第一个参数)转换为复数 freezeTableName: true, // 禁止修改表名,默认情况下,sequelize将自动将所有传递的模型名称(define的第一个参数)转换为复数
// 但是为了安全着想,复数的转换可能会发生变化,所以禁止该行为 // 但是为了安全着想,复数的转换可能会发生变化,所以禁止该行为
timestamps: false, // 不自动维护时间戳 [ created_at、updated_at ] timestamps: false, // 不自动维护时间戳 [ created_at、updated_at ]
timezone: "+08:00", // 保存为本地时区
dialectOptions: { dialectOptions: {
dateStrings: true, dateStrings: true,
typeCast(field, next) { typeCast(field, next) {
...@@ -92,6 +92,38 @@ module.exports = app => { ...@@ -92,6 +92,38 @@ module.exports = app => {
} }
} }
} }
},
swaggerdoc : {
dirScanner: './app/controller',
apiInfo: {
title: 'egg-swagger',
description: 'swagger-ui for egg',
version: '1.0.0',
},
schemes: ['http', 'https'],
consumes: ['application/json'],
produces: ['application/json'],
securityDefinitions: {
// apikey: {
// type: 'apiKey',
// name: 'clientkey',
// in: 'header',
// },
// oauth2: {
// type: 'oauth2',
// tokenUrl: 'http://petstore.swagger.io/oauth/dialog',
// flow: 'password',
// scopes: {
// 'write:access_token': 'write access_token',
// 'read:access_token': 'read access_token',
// },
// },
},
enableSecurity: false,
// enableValidate: true,
routerMap: true ,
enable: true,
} }
}; };
......
...@@ -29,7 +29,7 @@ module.exports = appInfo => { ...@@ -29,7 +29,7 @@ module.exports = appInfo => {
dialect: "mysql", dialect: "mysql",
host: "192.168.0.39", host: "192.168.0.39",
port: 3306, port: 3306,
database: "test", database: "glsx_data_screen",
username: "root", username: "root",
password: "123456" password: "123456"
}; };
......
...@@ -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-21 17:14:09 * @Last Modified time: 2019-11-22 09:48:48
*/ */
"use strict"; "use strict";
...@@ -34,3 +34,8 @@ exports.redis = { ...@@ -34,3 +34,8 @@ exports.redis = {
enable: false, enable: false,
package: "egg-redis" package: "egg-redis"
}; };
exports.swaggerdoc = {
enable: true,
package: 'egg-swagger-doc-feat',
};
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
"egg-redis": "^2.4.0", "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",
"moment": "^2.24.0",
"mysql2": "^2.0.0" "mysql2": "^2.0.0"
}, },
"devDependencies": { "devDependencies": {
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
"egg-bin": "^4.11.0", "egg-bin": "^4.11.0",
"egg-ci": "^1.11.0", "egg-ci": "^1.11.0",
"egg-mock": "^3.21.0", "egg-mock": "^3.21.0",
"egg-swagger-doc-feat": "^2.2.13",
"eslint": "^5.13.0", "eslint": "^5.13.0",
"eslint-config-egg": "^7.1.0", "eslint-config-egg": "^7.1.0",
"sequelize-cli": "^5.5.1" "sequelize-cli": "^5.5.1"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!