|
@@ -11,6 +11,8 @@ import signal as sig
|
|
import sys, getopt
|
|
import sys, getopt
|
|
|
|
|
|
app = Flask(__name__)
|
|
app = Flask(__name__)
|
|
|
|
+app.debug = True
|
|
|
|
+
|
|
curname = __name__
|
|
curname = __name__
|
|
|
|
|
|
logging.basicConfig(filename='/var/www/html/data/log/flask.log',
|
|
logging.basicConfig(filename='/var/www/html/data/log/flask.log',
|
|
@@ -19,7 +21,7 @@ logging.basicConfig(filename='/var/www/html/data/log/flask.log',
|
|
logger = logging.getLogger('plot')
|
|
logger = logging.getLogger('plot')
|
|
|
|
|
|
from refill import ChannelCumPainter, ChannelCovPainter, ChannelCovSuccPainter
|
|
from refill import ChannelCumPainter, ChannelCovPainter, ChannelCovSuccPainter
|
|
-from refill import MerchantCumRatioPainter, MerchantAmountPainter, MerchantCovRatioPainter,ChannelSpeedAnalyzePainter
|
|
|
|
|
|
+from refill import MerchantCumRatioPainter, MerchantAmountPainter, MerchantCovRatioPainter, ChannelSpeedAnalyzePainter
|
|
from refill import filter_chname, filter_cardtype, filter_mchids, get_channels, get_mchids
|
|
from refill import filter_chname, filter_cardtype, filter_mchids, get_channels, get_mchids
|
|
from refill import NetcheckCovPainter, get_net_channels
|
|
from refill import NetcheckCovPainter, get_net_channels
|
|
|
|
|
|
@@ -57,6 +59,7 @@ def ch_ratio():
|
|
start_time, end_time, card_types, spec, filter_wave = parse_parmeter()
|
|
start_time, end_time, card_types, spec, filter_wave = parse_parmeter()
|
|
chnames = request.args.get('chnames')
|
|
chnames = request.args.get('chnames')
|
|
chnames = filter_chname(chnames)
|
|
chnames = filter_chname(chnames)
|
|
|
|
+ show_all = request.args.get('show_all')
|
|
|
|
|
|
painter = ChannelCumPainter(start_time=start_time, end_time=end_time, chnames=chnames, card_types=card_types, spec=spec,
|
|
painter = ChannelCumPainter(start_time=start_time, end_time=end_time, chnames=chnames, card_types=card_types, spec=spec,
|
|
filter_wave=filter_wave)
|
|
filter_wave=filter_wave)
|
|
@@ -67,6 +70,7 @@ def ch_ratio():
|
|
except Exception as ex:
|
|
except Exception as ex:
|
|
return onError(ex)
|
|
return onError(ex)
|
|
|
|
|
|
|
|
+
|
|
@app.route('/plot/ch_speed_ratio')
|
|
@app.route('/plot/ch_speed_ratio')
|
|
def ch_speed_ratio():
|
|
def ch_speed_ratio():
|
|
try:
|
|
try:
|
|
@@ -80,12 +84,13 @@ def ch_speed_ratio():
|
|
painter = ChannelSpeedAnalyzePainter(start_time=start_time, end_time=end_time,
|
|
painter = ChannelSpeedAnalyzePainter(start_time=start_time, end_time=end_time,
|
|
chnames=chnames, card_types=card_types, spec=spec,
|
|
chnames=chnames, card_types=card_types, spec=spec,
|
|
period=period)
|
|
period=period)
|
|
- buf , ratios = painter.paint()
|
|
|
|
|
|
+ buf, ratios = painter.paint()
|
|
data = base64.b64encode(buf.getbuffer()).decode("ascii")
|
|
data = base64.b64encode(buf.getbuffer()).decode("ascii")
|
|
return jsonify({'img': data, 'ratios': ratios, 'state': 'success'})
|
|
return jsonify({'img': data, 'ratios': ratios, 'state': 'success'})
|
|
except Exception as ex:
|
|
except Exception as ex:
|
|
return onError(ex)
|
|
return onError(ex)
|
|
|
|
|
|
|
|
+
|
|
@app.route('/plot/ch_covratio')
|
|
@app.route('/plot/ch_covratio')
|
|
def ch_covratio():
|
|
def ch_covratio():
|
|
try:
|
|
try:
|
|
@@ -93,9 +98,11 @@ def ch_covratio():
|
|
start_time, end_time, card_types, spec, filter_wave = parse_parmeter()
|
|
start_time, end_time, card_types, spec, filter_wave = parse_parmeter()
|
|
chnames = request.args.get('chnames')
|
|
chnames = request.args.get('chnames')
|
|
chnames = filter_chname(chnames)
|
|
chnames = filter_chname(chnames)
|
|
|
|
+ show_all = request.args.get('show_all')
|
|
|
|
+ show_all = False if show_all is None else bool(show_all)
|
|
|
|
|
|
painter = ChannelCovPainter(start_time=start_time, end_time=end_time, chnames=chnames, card_types=card_types, spec=spec,
|
|
painter = ChannelCovPainter(start_time=start_time, end_time=end_time, chnames=chnames, card_types=card_types, spec=spec,
|
|
- filter_wave=filter_wave)
|
|
|
|
|
|
+ filter_wave=filter_wave,show_all=show_all)
|
|
buf, ratios = painter.paint()
|
|
buf, ratios = painter.paint()
|
|
data = base64.b64encode(buf.getbuffer()).decode("ascii")
|
|
data = base64.b64encode(buf.getbuffer()).decode("ascii")
|
|
|
|
|