update
This commit is contained in:
parent
7f25572ce8
commit
0a481f8bf7
11
api.py
11
api.py
@ -5,6 +5,7 @@ from flask_cors import CORS
|
||||
import pandas as pd
|
||||
|
||||
from handler import *
|
||||
from settings import settings
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app)
|
||||
@ -13,6 +14,7 @@ api = Api(app)
|
||||
parser = reqparse.RequestParser()
|
||||
parser.add_argument('st', type=int)
|
||||
parser.add_argument('et', type=int)
|
||||
parser.add_argument('is_dev', type=int)
|
||||
|
||||
|
||||
class Check(Resource):
|
||||
@ -20,13 +22,18 @@ class Check(Resource):
|
||||
args = parser.parse_args()
|
||||
st = args['st']
|
||||
et = args['et']
|
||||
is_dev = args['is_dev']
|
||||
if not all(args.values()):
|
||||
return {'msg': '缺少参数'}
|
||||
date = pd.Timestamp(st, unit='s', tz='Asia/Shanghai').strftime('%Y-%m-%d')
|
||||
where = {
|
||||
'_ut': {'$gte': st, '$lte': et}
|
||||
}
|
||||
factory = select_db(game, date)
|
||||
mongo_uri = 'mongodb://root:iamciniao@10.0.0.7:27017'
|
||||
if is_dev != 1:
|
||||
mongo_uri = settings.mongo_uri_dict[game]
|
||||
|
||||
factory = select_db(game, date, mongo_uri)
|
||||
res_user = check_data('user', where, factory)
|
||||
res_paylist = check_data('paylist', where, factory)
|
||||
res_event = check_data('event', where, factory)
|
||||
@ -41,4 +48,4 @@ class Check(Resource):
|
||||
api.add_resource(Check, '/<string:game>')
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0')
|
||||
app.run(debug=True, host='0.0.0.0', port=5777)
|
||||
|
@ -3,14 +3,11 @@ from pydantic import ValidationError
|
||||
import pandas as pd
|
||||
from model import *
|
||||
|
||||
from settings import settings
|
||||
|
||||
__all__ = ('select_db', 'check_data')
|
||||
|
||||
myclient = pymongo.MongoClient(settings.MONGO_URI)
|
||||
|
||||
|
||||
def select_db(game, date):
|
||||
def select_db(game, date, mongo_uri):
|
||||
myclient = pymongo.MongoClient(mongo_uri)
|
||||
factory = {
|
||||
'user': {'coll': None, 'models': [TUserModel, UserModel]},
|
||||
'paylist': {'coll': None, 'models': [TPaylistModel, PaylistModel]},
|
||||
|
55
index.html
55
index.html
@ -11,24 +11,39 @@
|
||||
element-loading-text="拼命加载中"
|
||||
element-loading-spinner="el-icon-loading"
|
||||
>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-select v-model="game" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
<el-select v-model="game" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-time-picker
|
||||
is-range
|
||||
v-model="date"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
placeholder="选择时间范围">
|
||||
</el-time-picker>
|
||||
<el-button icon="el-icon-search" circle @click="seach()"></el-button>
|
||||
<el-col :span="5">
|
||||
<el-time-picker
|
||||
is-range
|
||||
v-model="date"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
placeholder="选择时间范围">
|
||||
</el-time-picker>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="1">
|
||||
<el-button icon="el-icon-search" circle @click="seach()"></el-button>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="2" :offset="10">
|
||||
<el-switch
|
||||
v-model="isDev"
|
||||
active-text="测试"
|
||||
inactive-text="生产">
|
||||
</el-switch>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
@ -78,12 +93,13 @@
|
||||
label: '中古战锤'
|
||||
}],
|
||||
loading: false,
|
||||
game: '',
|
||||
game: 'geshouccs',
|
||||
cdate: new Date(),
|
||||
date: [new Date(curTime.setMinutes(curTime.getMinutes() - 10)), new Date()],
|
||||
userTable: '',
|
||||
paylistTable: '',
|
||||
eventTable: '',
|
||||
isDev: true,
|
||||
}
|
||||
},
|
||||
|
||||
@ -91,9 +107,10 @@
|
||||
seach: function () {
|
||||
this.loading = true;
|
||||
var game = this.game;
|
||||
var is_dev = this.isDev==true?1:2;
|
||||
var st = Date.parse(this.date[0]) / 1000;
|
||||
var et = Date.parse(this.date[1]) / 1000;
|
||||
axios.get('http://10.0.0.7:5777/' + game, {params: {'st': st, 'et': et}})
|
||||
axios.get('http://10.0.0.107:5777/' + game, {params: {'st': st, 'et': et,'is_dev':is_dev}})
|
||||
.then(response => {
|
||||
this.userTable = '<h1>user</h1>' + response.data['user'];
|
||||
this.paylistTable = '<h1>paylist</h1>' + response.data['paylist'];
|
||||
|
@ -1,5 +1,11 @@
|
||||
class Settings:
|
||||
MONGO_URI = 'mongodb://root:iamciniao@10.0.0.7:27017'
|
||||
mongo_uri_dict = {
|
||||
'fengbaoqibing':'mongodb://root:iamciniao@8.129.233.127:27017',
|
||||
'geshouccs':'mongodb://root:iamciniao@119.29.176.224:27017',
|
||||
'shenghuajiyuan':'mongodb://root:iamciniao@42.194.225.107:27017',
|
||||
'xinyaoling':'mongodb://root:iamciniao@39.104.90.204:27017',
|
||||
'zgzhanchui':'mongodb://root:iamciniao@119.29.35.35:27017',
|
||||
}
|
||||
|
||||
|
||||
settings = Settings
|
||||
|
Loading…
Reference in New Issue
Block a user