def logic(self, data):
     _PR = PR.getInstance()
     _data = {
         "title": {
             "text": 'ECharts 入门示例'
         },
         "tooltip": {},
         "legend": {
             "data": ['销量']
         },
         "xAxis": {
             "data": ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
         },
         "yAxis": {},
         "series": [{
             "name": '销量',
             "type": 'bar',
             "data": [5, 20, 36, 10, 10, 200]
         }]
     }
     _PR.setResult(_data)
     print(_PR.getResult())
     # L.debug(_data)
     # L.info(_data)
     # L.warn(_data)
     # L.error(_data)
     # L.critical(_data)
     return _PR.getPRBytes()
    def line_test(self, data):
        _PR = PR.getInstance()

        _title_text = data['title_text']  # 标题
        _step_count = data["step_count"]  # 横坐标点
        _step = data['step']  # 步长(单位:min)
        _type = data['type']  # 绘图类型
        # 保宝网的点击量和保宝网的观看人数统计的折线图 怎么处理??? 项目 类型
        _legend_infos = data['legend_infos']  # 数据项信息
        print(_legend_infos)
        _legend_datas = _legend_infos.keys()  # 数据项名称

        _search_filter_infos = {}
        for _legend_data in _legend_datas:
            _project_name = _legend_infos[_legend_data]['project_name']  # 项目名称
            _statistic_type = _legend_infos[_legend_data]['statistic_type']  # 统计类型
            _statistic_name = _legend_infos[_legend_data]['statistic_name']  # 统计名称
            _filter_infos = _legend_infos[_legend_data]['filter_infos']  # 过滤条件
            print(_filter_infos)
            ds = logic.project_ds_info[_project_name]  # 查询数据源
            table = _project_name + "_" + _statistic_type  # YXYBB_interface
            self_mongo_instance = Mongo.getInstance(table=table, ds=ds)
            self_collection = self_mongo_instance.getCollection()

            _search_filter_infos[_legend_data] = {
                "project_name": _project_name,
                "self_collection": self_collection,  # 连接额外数据源
                "filter_infos": _filter_infos,  # 过滤机制
                "statistic_type": _statistic_type,  # 统计类型
                "statistic_name": _statistic_name  # 统计名称
            }
        _result = Line.getInsatnce(search_filter_infos=_search_filter_infos, _step=_step, _step_count=_step_count, _title_text=_title_text, _type=_type).getLineChartData()
        self_mongo_instance.close()
        _PR.setResult(_result)
        return _PR.getPRBytes()
 def logic(self, data,xxx="xxx"):
     _PR = PR.getInstance()
     _data = {
         "title": {
             "text": 'ECharts 入门示例'
         },
         "tooltip": {
         },
         "legend": {
             "data": ['销量']
         },
         "xAxis": {
             "data": ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
         },
         "yAxis": {},
         "series": [{
             "name": '销量',
             "type": 'bar',
             "data": [5, 20, 36, 10, 10, 200]
         }]
     }
     _PR.setResult(_data)
     print(_PR.getResult())
     # L.debug(_data)
     # L.info(_data)
     # L.warn(_data)
     # L.error(_data)
     # L.critical(_data)
     return _PR.getPRBytes()
Beispiel #4
0
def getInstance(data):
    if data is None:
        pr = PR.getInstance()
        pr.setCode(PR.Code_PARERROR)
        pr.setMsg("not set the instance par")
        return pr
        # return PR.getInstance().setCode(PR.Code_PARERROR).setMsg("not set the instance par").setResult(data).getPRBytes()
    return Msg_logic(data)
Beispiel #5
0
def getInstance(data):
    if data is None:
        pr = PR.getInstance()
        pr.setCode(PR.Code_PARERROR)
        pr.setMsg("not set the instance par")
        return pr
        # return PR.getInstance().setCode(PR.Code_PARERROR).setMsg("not set the instance par").setResult(data).getPRBytes()
    return Msg_logic(data)
    def xx(self, data):
        _PR = PR.getInstance()

        chart = Echart('GDP', 'This is a fake chart')
        chart.use(Bar('China', [2, 3, 4, 5]))
        chart.use(Legend(['GDP']))
        chart.use(Axis('category', 'bottom', data=['Nov', 'Dec', 'Jan', 'Feb']))
        _chart = chart.json
        print(_chart)
        _chart["tooltip"] = {}
        _PR.setResult(_chart)
        return _PR.getPRBytes()
Beispiel #7
0
    def xx(self, data):
        _PR = PR.getInstance()

        chart = Echart('GDP', 'This is a fake chart')
        chart.use(Bar('China', [2, 3, 4, 5]))
        chart.use(Legend(['GDP']))
        chart.use(Axis('category', 'bottom', data=['Nov', 'Dec', 'Jan',
                                                   'Feb']))
        _chart = chart.json
        print(_chart)
        _chart["tooltip"] = {}
        _PR.setResult(_chart)
        return _PR.getPRBytes()
Beispiel #8
0
 def get(self):
     _PR = PR.getInstance()
     try:
         method = self.get_argument('method', '__error__')
         if method == "__error__":
             _PR.setCode(PR.Code_METHODERROR)
             _PR.setMsg("method ERROR , not give the method or get the method is __error__")
             return self.write(_PR.getPRBytes())
         data = json.loads(self.get_argument('data', None))
         L.debug("the service request method : " + str(method))
         L.debug("the service request parameter : " + str(data))
         self.write(operator.get(method)(data))
     except Exception as e:
         _PR.setCode(PR.Code_EXCEPTION)
         _PR.setMsg("exception ERROR :" + str(e))
         self.write(_PR.getPRBytes())
    def line_test(self, data):
        _PR = PR.getInstance()

        _title_text = data['title_text']  # 标题
        _step_count = data["step_count"]  # 横坐标点
        _step = data['step']  # 步长(单位:min)
        _type = data['type']  # 绘图类型
        # 保宝网的点击量和保宝网的观看人数统计的折线图 怎么处理??? 项目 类型
        _legend_infos = data['legend_infos']  # 数据项信息
        print(_legend_infos)
        _legend_datas = _legend_infos.keys()  # 数据项名称

        _search_filter_infos = {}
        for _legend_data in _legend_datas:
            _project_name = _legend_infos[_legend_data]['project_name']  # 项目名称
            _statistic_type = _legend_infos[_legend_data][
                'statistic_type']  # 统计类型
            _statistic_name = _legend_infos[_legend_data][
                'statistic_name']  # 统计名称
            _filter_infos = _legend_infos[_legend_data]['filter_infos']  # 过滤条件
            print(_filter_infos)
            ds = logic.project_ds_info[_project_name]  # 查询数据源
            table = _project_name + "_" + _statistic_type  # YXYBB_interface
            self_mongo_instance = Mongo.getInstance(table=table, ds=ds)
            self_collection = self_mongo_instance.getCollection()

            _search_filter_infos[_legend_data] = {
                "project_name": _project_name,
                "self_collection": self_collection,  # 连接额外数据源
                "filter_infos": _filter_infos,  # 过滤机制
                "statistic_type": _statistic_type,  # 统计类型
                "statistic_name": _statistic_name  # 统计名称
            }
        _result = Line.getInsatnce(search_filter_infos=_search_filter_infos,
                                   _step=_step,
                                   _step_count=_step_count,
                                   _title_text=_title_text,
                                   _type=_type).getLineChartData()
        self_mongo_instance.close()
        _PR.setResult(_result)
        return _PR.getPRBytes()
    def get(self):
        _PR = PR.getInstance()
        try:
            method="open_falcon_send_mail"
            method = self.get_argument('method', '__error__')
            if method == "__error__":
                _PR.setCode(PR.Code_METHODERROR)
                _PR.setMsg("method ERROR , not give the method or get the method is __error__")
                return self.write(_PR.getPRBytes())

            # 需要重新进行单独处理数据数据结构
            data = json.loads(self.get_argument('data', None))

            L.debug("the service request method : " + str(method))
            L.debug("the service request parameter : " + str(data))
            self.write(operator.get(method)(data))
        except Exception as e:
            _PR.setCode(PR.Code_EXCEPTION)
            _PR.setMsg("exception ERROR :" + str(e))
            self.write(_PR.getPRBytes())
        pass