Commit 993b87c1 by limin

新增图表

1 parent 7c3d689d
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 2 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [10]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout Git Source
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm i -g npminstall && npminstall
- name: Continuous Integration
run: npm run ci
- name: Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
sudo: false
language: node_js
node_js:
- '10'
......
<!--
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2020-11-25 16:52:32
* @LastEditors: limin
* @LastEditTime: 2020-11-26 18:14:48
-->
# glsx-data-screen-server
广联数据大屏
......@@ -56,6 +64,8 @@ npm install -g egg-sequelize-auto mysql2
egg-sequelize-auto -o "./app/model/biz" -d glsx_audit -h 192.168.3.153 -u apuser -p 3308 -x 123456 -e mysql
- 不指定-t 为所有表
egg-sequelize-auto -o "./app/model/biz" -d glsx_biz_data -h 192.168.3.227 -t login_areal_dist -u dev_admin -p 3306 -x 1f7e1ed2 -e mysql
-- shell
#!/bin/bash
......
/*
* @Author: chenwq
* @Date: 2020-06-16 10:40:02
* @Author: chenwq
* @Date: 2020-06-16 10:40:02
* @Last Modified by: huyue
* @Last Modified time: 2020-11-25 14:23:16
*/
"use strict";
"use strict";
const Controller = require("egg").Controller;
/**
* @Controller devices
* @Description 设备信息
*/
const Controller = require("egg").Controller;
/**
* @Controller devices
* @Description 设备信息
*/
class devicesController extends Controller {
constructor(ctx) {
super(ctx);
this.validate = ctx.app.validate.validate;
this.request = ctx.request;
this.helper = ctx.helper;
this.redis = ctx.app.redis;
this.devicesService = ctx.service.biz.devices;
this.ServerResponseCode = ctx.response.ServerResponseCode;
this.ServerResponse = ctx.response.ServerResponse;
}
class devicesController extends Controller {
constructor(ctx) {
super(ctx);
this.validate = ctx.app.validate.validate;
this.request = ctx.request;
this.helper = ctx.helper;
this.redis = ctx.app.redis;
this.devicesService = ctx.service.biz.devices;
this.ServerResponseCode = ctx.response.ServerResponseCode;
this.ServerResponse = ctx.response.ServerResponse;
}
/**
* @summary 查询所有设备信息
* @Router POST /biz/devices/findAll
* @Description 查询所有设备信息
* @Request pager
* @Request searcher
* @Response 200 response ok
*/
async findAll({ request: { body: { pager, searcher } } }) {
const result = await this.devicesService.findAll({ pager, searcher });
this.ctx.body = this.ServerResponse.Success(result);
}
/**
* @summary 查询设备登录信息
* @Router POST /biz/devices/searchlogin
* @Description 查询设备登录信息
* @Request pager
* @Request searcher
* @Response 200 response ok
*/
async searchlogin({ request: { body: searcher } }) {
const result = await this.devicesService.searchlogin({ searcher });
this.ctx.body = this.ServerResponse.Success(result);
}
/**
* @summary 查询所有设备信息
* @Router POST /biz/devices/findAll
* @Description 查询所有设备信息
* @Request pager
* @Request searcher
* @Response 200 response ok
*/
async findAll({
request: {
body: { pager, searcher },
},
}) {
const result = await this.devicesService.findAll({ pager, searcher });
this.ctx.body = this.ServerResponse.Success(result);
}
/**
* @summary 查询设备登录信息
* @Router POST /biz/devices/searchlogin
* @Description 查询设备登录信息
* @Request pager
* @Request searcher
* @Response 200 response ok
*/
async searchlogin({ request: { body: searcher } }) {
const result = await this.devicesService.searchlogin({ searcher });
this.ctx.body = this.ServerResponse.Success(result);
}
/**
* @summary 设备登录ip位置分布
* @Router POST /biz/devices/heatMapIp
* @Description 设备登录ip位置分布
* @Response 200 response ok
*/
async heatMapIp() {
const result = await this.devicesService.heatMapIp();
this.ctx.body = this.ServerResponse.Success(result);
}
/**
* @summary 设备登录时段分布
* @Router POST /biz/devices/timeRangeLogin
* @Description 设备登录时段分布
* @Response 200 response ok
*/
async timeRangeLogin() {
const result = await this.devicesService.timeRangeLogin();
this.ctx.body = this.ServerResponse.Success(result);
}
/**
* @summary 查询设备登录趋势
* @Router POST /biz/devices/trendLogin
* @Description 查询设备登录趋势
* @Response 200 response ok
*/
async trendLogin() {
const result = await this.devicesService.trendLogin();
this.ctx.body = this.ServerResponse.Success(result);
}
module.exports = devicesController;
\ No newline at end of file
}
module.exports = devicesController;
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('login_areal_dist', {
id: {
type: DataTypes.BIGINT,
allowNull: false,
primaryKey: true,
autoIncrement: true
},
lng: {
type: DataTypes.DECIMAL,
allowNull: false
},
lat: {
type: DataTypes.DECIMAL,
allowNull: false
},
count: {
type: DataTypes.INTEGER(11),
allowNull: false
}
}, {
tableName: 'login_areal_dist'
});
Model.associate = function() {
}
return Model;
};
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('login_time_dist', {
id: {
type: DataTypes.BIGINT,
allowNull: false,
primaryKey: true,
autoIncrement: true
},
day: {
type: DataTypes.STRING(20),
allowNull: false,
primaryKey: true
},
hour: {
type: DataTypes.STRING(4),
allowNull: false,
primaryKey: true
},
sumLogin: {
type: DataTypes.INTEGER(11),
allowNull: false
}
}, {
tableName: 'login_time_dist'
});
Model.associate = function() {
}
return Model;
};
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2020-11-26 16:10:37
* @LastEditors: limin
* @LastEditTime: 2020-11-26 16:30:46
*/
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('login_trend', {
id: {
type: DataTypes.BIGINT,
allowNull: false,
primaryKey: true,
autoIncrement: true
},
day: {
type: DataTypes.STRING(20),
allowNull: false,
primaryKey: true
},
sumLogin: {
type: DataTypes.INTEGER(11),
allowNull: false
}
}, {
tableName: 'login_trend'
});
Model.associate = function() {
}
return Model;
};
......@@ -14,6 +14,11 @@ module.exports = (app) => {
app.router.get('/biz/merchant/findAll', app.controller.biz.merchant.findAll)
app.router.get('/biz/devices/findAll', app.controller.biz.devices.findAll)
app.router.get('/biz/devices/searchlogin', app.controller.biz.devices.searchlogin)
app.router.get('/biz/devices/heatMapIp', app.controller.biz.devices.heatMapIp)
app.router.get('/biz/devices/timeRangeLogin', app.controller.biz.devices.timeRangeLogin)
app.router.get('/biz/devices/trendLogin', app.controller.biz.devices.trendLogin)
app.router.get('/biz/delivery/findAll', app.controller.biz.delivery.findAll)
app.router.get('/biz/delivery/findCount', app.controller.biz.delivery.findCount)
app.router.get('/biz/clues/findAll', app.controller.biz.clues.findAll)
......
......@@ -20,10 +20,16 @@ class DevicesService extends Service {
_reg_models_alias_() {
const {
DjDeviceInfo,
DjSystemMerchant
DjSystemMerchant,
LoginArealDist,
LoginTimeDist,
LoginTrend
} = this.app.model.Biz;
this.MDDI = DjDeviceInfo;
this.MDSM = DjSystemMerchant;
this.LAD = LoginArealDist;
this.LTD = LoginTimeDist;
this.LT = LoginTrend
}
/**
......@@ -159,5 +165,42 @@ class DevicesService extends Service {
}
return datalist
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 设备登录ip位置分布
*/
async heatMapIp() {
let data = await this.LAD.findAll({
raw: true,
})
return data
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 设备登录时段分布
*/
async timeRangeLogin() {
let data = await this.LTD.findAll({
raw: true,
})
return data
}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 查询设备登录趋势
*/
async trendLogin() {
let data = await this.LT.findAll({
raw: true,
})
return data
}
}
module.exports = DevicesService;
\ No newline at end of file
......@@ -69,7 +69,7 @@ module.exports = app => {
secret: 'glsx-insurence-egg-server' // 自定义 token 的加密条件字符串
}
config.cors = {
origin: 'http://192.168.2.2:8085',
origin: 'http://localhost:8085',
credentials: true,
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
}
......@@ -79,7 +79,7 @@ module.exports = app => {
ignoreJSON: true
},
// domainWhiteList: ["http://192.168.2.222:8085"] //允许访问接口的白名单
domainWhiteList: ['http://localhost:8085', 'http://192.168.2.2:8085', 'http://192.168.2.27:8085'] // 允许访问接口的白名单
domainWhiteList: ['http://localhost:8085', 'http://192.168.2.222:8085', 'http://192.168.2.27:8085'] // 允许访问接口的白名单
}
config.redis = {
client: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!